diff options
-rw-r--r-- | README | 5 | ||||
-rw-r--r-- | files/plugins/check_jabber_login | 30 | ||||
-rw-r--r-- | manifests/base.pp | 16 | ||||
-rw-r--r-- | manifests/defaults/host_templates.pp | 12 | ||||
-rw-r--r-- | manifests/defaults/hostgroups.pp | 20 | ||||
-rw-r--r-- | manifests/defaults/service_templates.pp | 18 | ||||
-rw-r--r-- | manifests/nsca/client.pp | 6 | ||||
-rw-r--r-- | manifests/nsca/server.pp | 6 | ||||
-rw-r--r-- | manifests/plugin.pp | 9 |
9 files changed, 56 insertions, 66 deletions
@@ -12,7 +12,10 @@ In it's current form, this module can be used on CentOS and Debian. Overview ======== -To use the nagios resources, activate storeconfigs on the puppetmaster. +To use the nagios resources, activate storeconfigs on the +puppetmaster. + +You need to be running verison 0.25 or later of puppet. Monitor diff --git a/files/plugins/check_jabber_login b/files/plugins/check_jabber_login deleted file mode 100644 index dac0e1f..0000000 --- a/files/plugins/check_jabber_login +++ /dev/null @@ -1,30 +0,0 @@ -#!/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 6106ab2..d609196 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -54,7 +54,8 @@ class nagios::base { file { 'nagios_private_resource_cfg': path => "${nagios_cfgdir}/private/resource.cfg", - source => "puppet://$server/nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}", + source => [ "puppet://$server/modules/nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}", + "puppet://$server/modules/site-nagios/configs/${operatingsystem}/private/resource.cfg.${architecture}" ], notify => Service['nagios'], owner => root, group => nagios, mode => '0640'; } @@ -81,53 +82,66 @@ class nagios::base { Nagios_serviceescalation <<||>> Nagios_serviceextinfo <<||>> Nagios_timeperiod <<||>> + File <<| tag == 'nagios_plugin' |>> Nagios_command <||> { target => "${nagios_cfgdir}/conf.d/nagios_command.cfg", + require => File['nagios_confd'], notify => Service['nagios'], } Nagios_contact <||> { target => "${nagios_cfgdir}/conf.d/nagios_contact.cfg", + require => File['nagios_confd'], notify => Service['nagios'], } Nagios_contactgroup <||> { target => "${nagios_cfgdir}/conf.d/nagios_contactgroup.cfg", + require => File['nagios_confd'], notify => Service['nagios'], } Nagios_host <||> { target => "${nagios_cfgdir}/conf.d/nagios_host.cfg", + require => File['nagios_confd'], notify => Service['nagios'], } Nagios_hostextinfo <||> { target => "${nagios_cfgdir}/conf.d/nagios_hostextinfo.cfg", + require => File['nagios_confd'], notify => Service['nagios'], } Nagios_hostgroup <||> { target => "${nagios_cfgdir}/conf.d/nagios_hostgroup.cfg", + require => File['nagios_confd'], notify => Service['nagios'], } Nagios_hostgroupescalation <||> { target => "${nagios_cfgdir}/conf.d/nagios_hostgroupescalation.cfg", + require => File['nagios_confd'], notify => Service['nagios'], } Nagios_service <||> { target => "${nagios_cfgdir}/conf.d/nagios_service.cfg", + require => File['nagios_confd'], notify => Service['nagios'], } Nagios_servicedependency <||> { target => "${nagios_cfgdir}/conf.d/nagios_servicedependency.cfg", + require => File['nagios_confd'], notify => Service['nagios'], } Nagios_serviceescalation <||> { target => "${nagios_cfgdir}/conf.d/nagios_serviceescalation.cfg", + require => File['nagios_confd'], notify => Service['nagios'], } Nagios_serviceextinfo <||> { target => "${nagios_cfgdir}/conf.d/nagios_serviceextinfo.cfg", + require => File['nagios_confd'], notify => Service['nagios'], } Nagios_timeperiod <||> { target => "${nagios_cfgdir}/conf.d/nagios_timeperiod.cfg", + require => File['nagios_confd'], notify => Service['nagios'], } diff --git a/manifests/defaults/host_templates.pp b/manifests/defaults/host_templates.pp index 699b965..0f47324 100644 --- a/manifests/defaults/host_templates.pp +++ b/manifests/defaults/host_templates.pp @@ -12,12 +12,12 @@ class nagios::defaults::host_templates { process_perf_data => '1', retain_status_information => '1', retain_nonstatus_information => '1', - check_command => 'check-host-alive', - max_check_attempts => '10', - notification_interval => '0', - notification_period => '24x7', - notification_options => 'd,u,r', - contact_groups => 'admins', + check_command => 'check-host-alive', + max_check_attempts => '10', + notification_interval => '0', + notification_period => '24x7', + notification_options => 'd,u,r', + contact_groups => 'admins', register => '0', } diff --git a/manifests/defaults/hostgroups.pp b/manifests/defaults/hostgroups.pp index 3a4f4d1..8715ade 100644 --- a/manifests/defaults/hostgroups.pp +++ b/manifests/defaults/hostgroups.pp @@ -1,13 +1,11 @@ class nagios::defaults::hostgroups { - - nagios_hostgroup { - 'all': - alias => 'All Servers', - members => '*'; - 'debian-servers': - alias => 'Debian GNU/Linux Servers'; - 'centos-servers': - alias => 'CentOS GNU/Linux Servers'; - } - + nagios_hostgroup { + 'all': + alias => 'All Servers', + members => '*'; + 'debian-servers': + alias => 'Debian GNU/Linux Servers'; + 'centos-servers': + alias => 'CentOS GNU/Linux Servers'; + } } diff --git a/manifests/defaults/service_templates.pp b/manifests/defaults/service_templates.pp index 326ce05..84740af 100644 --- a/manifests/defaults/service_templates.pp +++ b/manifests/defaults/service_templates.pp @@ -17,15 +17,15 @@ class nagios::defaults::service_templates { process_perf_data => '1', retain_status_information => '1', retain_nonstatus_information => '1', - notification_interval => '0', - is_volatile => '0', - check_period => '24x7', - normal_check_interval => '5', - retry_check_interval => '1', - max_check_attempts => '4', - notification_period => '24x7', - notification_options => 'w,u,c,r', - contact_groups => 'admins', + notification_interval => '0', + is_volatile => '0', + check_period => '24x7', + normal_check_interval => '5', + retry_check_interval => '1', + max_check_attempts => '4', + notification_period => '24x7', + notification_options => 'w,u,c,r', + contact_groups => 'admins', register => '0', } diff --git a/manifests/nsca/client.pp b/manifests/nsca/client.pp index b4ca878..5314b3d 100644 --- a/manifests/nsca/client.pp +++ b/manifests/nsca/client.pp @@ -3,9 +3,9 @@ class nagios::nsca::client { package { 'nsca': ensure => installed } file { '/etc/send_nsca.cfg': - source => [ "puppet://${server}/site-nagios/nsca/{$fqdn}/send_nsca.cfg", - "puppet://${server}/site-nagios/nsca/send_nsca.cfg", - "puppet://${server}/nagios/nsca/send_nsca.cfg" ], + source => [ "puppet://${server}/modules/site-nagios/nsca/{$fqdn}/send_nsca.cfg", + "puppet://${server}/modules/site-nagios/nsca/send_nsca.cfg", + "puppet://${server}/modules/nagios/nsca/send_nsca.cfg" ], owner => 'nagios', group => 'nogroup', mode => '400', diff --git a/manifests/nsca/server.pp b/manifests/nsca/server.pp index c682e24..e1cb83c 100644 --- a/manifests/nsca/server.pp +++ b/manifests/nsca/server.pp @@ -9,9 +9,9 @@ class nagios::nsca::server { } file { '/etc/nsca.cfg': - source => [ "puppet://${server}/site-nagios/nsca/{$fqdn}/nsca.cfg", - "puppet://${server}/site-nagios/nsca/nsca.cfg", - "puppet://${server}/nagios/nsca/nsca.cfg" ], + source => [ "puppet://${server}/modules/site-nagios/nsca/{$fqdn}/nsca.cfg", + "puppet://${server}/modules/site-nagios/nsca/nsca.cfg", + "puppet://${server}/modules/nagios/nsca/nsca.cfg" ], owner => 'nagios', group => 'nogroup', mode => '400', diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 4789345..b001810 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -1,13 +1,18 @@ 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", }, ensure => $ensure, - source => "puppet://$server/modules/nagios/plugins/$name", + source => $source ? { + 'absent' => "puppet://$server/modules/nagios/plugins/$name", + default => "puppet://$server/modules/$source" + }, + tag => 'nagios_plugin', require => Package['nagios-plugins'], owner => root, group => 0, mode => 0755; } |