diff options
-rw-r--r-- | files/plugins/check_jabber_login | 30 | ||||
-rw-r--r-- | manifests/base.pp | 6 | ||||
-rw-r--r-- | manifests/defaults/plugins.pp | 6 | ||||
-rw-r--r-- | manifests/plugin.pp | 2 | ||||
-rw-r--r-- | manifests/plugin/deploy.pp | 6 |
5 files changed, 38 insertions, 12 deletions
diff --git a/files/plugins/check_jabber_login b/files/plugins/check_jabber_login new file mode 100644 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/base.pp b/manifests/base.pp index 315298d..5a7cb7d 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -46,7 +46,6 @@ class nagios::base { file { 'nagios_private': path => "${nagios::defaults::vars::int_nagios_cfgdir}/private/", - source => "puppet:///modules/common/empty", ensure => directory, purge => true, recurse => true, @@ -64,15 +63,12 @@ class nagios::base { file { 'nagios_confd': path => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/", - source => "puppet:///modules/common/empty", ensure => directory, purge => true, recurse => true, notify => Service['nagios'], mode => '0750', owner => root, group => nagios; } - Package <<| tag == 'nagios::plugin::deploy::package' |>> - File <<| tag == 'nagios::plugin::deploy::file' |>> Nagios_command <<||>> Nagios_contactgroup <<||>> Nagios_contact <<||>> @@ -87,7 +83,6 @@ class nagios::base { Nagios_serviceextinfo <<||>> Nagios_service <<||>> Nagios_timeperiod <<||>> - File <<| tag == 'nagios_plugin' |>> Nagios_command <||> { target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_command.cfg", @@ -182,7 +177,6 @@ class nagios::base { # must be defined after exported resource overrides and cfg file defs file { 'nagios_cfgdir': path => "${nagios::defaults::vars::int_nagios_cfgdir}/", - source => "puppet:///modules/common/empty", ensure => directory, recurse => true, purge => true, diff --git a/manifests/defaults/plugins.pp b/manifests/defaults/plugins.pp index 18f8161..b713354 100644 --- a/manifests/defaults/plugins.pp +++ b/manifests/defaults/plugins.pp @@ -1,5 +1,4 @@ class nagios::defaults::plugins { - nagios::plugin { 'check_mysql_health': source => 'nagios/plugins/check_mysql_health'; @@ -7,6 +6,9 @@ class nagios::defaults::plugins { source => 'nagios/plugins/check_dns2'; 'check_dnsbl': source => 'nagios/plugins/check_dnsbl'; + 'check_jabber_login': + source => 'nagios/plugins/check_jabber_login'; } - + # for check_jabber_login + require rubygems::xmpp4r } diff --git a/manifests/plugin.pp b/manifests/plugin.pp index abaa6e5..c2e7676 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -2,7 +2,7 @@ define nagios::plugin( $source = 'absent', $ensure = present ){ - @@file{$name: + file{$name: path => $hardwaremodel ? { 'x86_64' => "/usr/lib64/nagios/plugins/$name", default => "/usr/lib/nagios/plugins/$name", diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 75f87d7..96fea41 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -10,14 +10,14 @@ define nagios::plugin::deploy($source = '', $ensure = 'present', $config = '', $ } if !defined(Package[$require_package]) { - @@package { $require_package: + package { $require_package: ensure => installed, tag => "nagios::plugin::deploy::package"; } } include nagios::plugin::scriptpaths - @@file { "nagios_plugin_${name}": + file { "nagios_plugin_${name}": path => "$nagios::plugin::scriptpaths::script_path/${name}", source => "puppet://$server/modules/$real_source", mode => 0755, owner => root, group => 0, @@ -26,5 +26,5 @@ define nagios::plugin::deploy($source = '', $ensure = 'present', $config = '', $ } # register the plugin - @@nagios::plugin{$name: ensure => $ensure, require => Package['nagios-plugins'] } + nagios::plugin{$name: ensure => $ensure, require => Package['nagios-plugins'] } } |