Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding puppet_master sensu plugin for puppet

  • Loading branch information...
commit 7a9ccd5354e4efbaf712138ad6f43578c0b2afd8 1 parent e7efb49
Eslam El Husseiny authored
Showing with 39 additions and 0 deletions.
  1. +39 −0 dist/puppet/modules/sensu/files/plugins/puppet_master.rb
View
39 dist/puppet/modules/sensu/files/plugins/puppet_master.rb
@@ -0,0 +1,39 @@
+#!/usr/bin/env ruby
+# Copyright 2011 James Turnbull
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Puppet Master Plugin
+# ===
+#
+# This plugin checks to see if the Puppet Labs Puppet master is running
+#
+
+`which tasklist`
+case
+when $? == 0
+ procs = `tasklist`
+else
+ procs = `ps aux`
+end
+running = false
+procs.each_line do |proc|
+ running = true if proc.find { |p| /puppetmasterd|puppet master/ =~ p }
+end
+if running
+ puts 'PUPPET MASTER - OK - Puppet master is running'
+ exit 0
+else
+ puts 'PUPPET MASTER - WARNING - Puppet master is NOT running'
+ exit 1
+end
Please sign in to comment.
Something went wrong with that request. Please try again.