summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2009-02-02 22:27:01 +0000
committermh <mh@immerda.ch>2009-02-02 22:27:01 +0000
commit732d514f65f46f10736f300e54325f8da9fd9125 (patch)
treeac932c8c1a48a433e9e7f6566f1e20ca5b881406
parent9bbdcbc8ed5e0e752949aaeb4f5bfe0f11053a1a (diff)
added jabber commands
-rwxr-xr-xfiles/plugins/check_jabber_login30
-rw-r--r--manifests/defines.pp12
-rw-r--r--manifests/init.pp21
3 files changed, 56 insertions, 7 deletions
diff --git a/files/plugins/check_jabber_login b/files/plugins/check_jabber_login
new file mode 100755
index 0000000..dac0e1f
--- /dev/null
+++ b/files/plugins/check_jabber_login
@@ -0,0 +1,30 @@
+#!/usr/bin/env ruby
+require 'rubygems'
+require 'xmpp4r'
+
+
+def usage
+ puts "#{$0} jabberid password"
+ exit 3
+end
+
+usage unless ARGV.size == 2
+
+begin
+ my_client = Jabber::Client.new(ARGV[0])
+ my_client.connect
+ my_client.auth(ARGV[1])
+rescue Jabber::ClientAuthenticationFailure => detail
+ puts "CRITICAL: Login Error"
+ exit 2
+rescue Errno::ECONNREFUSED => detail
+ puts "CRITICAL: Connection refused"
+ exit 2
+rescue SocketError => detail
+ puts "CRITICAL: Socket Error"
+ exit 2
+#rescue
+# puts "CRITICAL: Unknown Error"
+# exit 2
+end
+puts "OK: Login for #{ARGV[0]} successfull"
diff --git a/manifests/defines.pp b/manifests/defines.pp
index 382f21a..7dede0e 100644
--- a/manifests/defines.pp
+++ b/manifests/defines.pp
@@ -157,3 +157,15 @@ define nagios::service::http(
}
}
}
+
+define nagios::plugin(){
+ file{$name:
+ path => $hardwaremodel ? {
+ 'x86_64' => "/usr/lib64/nagios/plugins/$name",
+ default => "/usr/lib/nagios/plugins/$name",
+ },
+ source => "puppet://$server/nagios/plugins/$name",
+ require => Package['nagios-plugins'],
+ owner => root, group => 0, mode => 0755;
+ }
+}
diff --git a/manifests/init.pp b/manifests/init.pp
index 1df5008..38f57ed 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -98,15 +98,17 @@ class nagios::base {
mode => 0644, owner => root, group => 0;
}
+ nagios::plugin{'check_jabber_login': }
+
nagios::command{
ssh_port:
- command_line => '$USER1$/check_ssh -p $ARG1$ $HOSTADDRESS$';
- # from apache2.pp
- http_port:
- command_line => '$USER1$/check_http -p $ARG1$ -H $HOSTADDRESS$ -I $HOSTADDRESS$';
- # from bind.pp
- check_dig2:
- command_line => '$USER1$/check_dig -H $HOSTADDRESS$ -l $ARG1$ --record_type=$ARG2$';
+ command_line => '$USER1$/check_ssh -p $ARG1$ $HOSTADDRESS$';
+ # from apache2.pp
+ http_port:
+ command_line => '$USER1$/check_http -p $ARG1$ -H $HOSTADDRESS$ -I $HOSTADDRESS$';
+ # from bind.pp
+ check_dig2:
+ command_line => '$USER1$/check_dig -H $HOSTADDRESS$ -l $ARG1$ --record_type=$ARG2$';
check_ntp:
command_line => '$USER1$/check_ntp -H $HOSTADDRESS$ -w 0.5 -c 1';
check_http_url:
@@ -121,6 +123,11 @@ class nagios::base {
command_line => '$USER1$/check_http -S -H $HOSTADDRESS$';
check_silc:
command_line => '$USER1$/check_tcp -p 706 -H $ARG1$';
+ check_jabber:
+ command_line => '$USER1$/check_jabber -H $ARG1$';
+ check_jabber:
+ command_line => '$USER1$/check_jabber_login $ARG1$ $ARG2$',
+ require => Nagios::Plugin['check_jabber_login'];
}
Nagios_command <<||>>