diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/apache.pp | 21 | ||||
-rw-r--r-- | manifests/debian.pp | 7 | ||||
-rw-r--r-- | manifests/defaults/commands.pp | 245 | ||||
-rw-r--r-- | manifests/init.pp | 3 | ||||
-rw-r--r-- | manifests/nrpe.pp | 4 | ||||
-rw-r--r-- | manifests/nrpe/base.pp | 52 | ||||
-rw-r--r-- | manifests/nrpe/debian.pp | 6 | ||||
-rw-r--r-- | manifests/pnp4nagios.pp | 71 | ||||
-rw-r--r-- | manifests/pnp4nagios/popup.pp | 27 | ||||
-rw-r--r-- | manifests/service.pp | 18 | ||||
-rw-r--r-- | manifests/service/mysql.pp | 2 | ||||
-rw-r--r-- | manifests/stored_config.pp | 19 | ||||
-rw-r--r-- | manifests/target.pp | 12 |
13 files changed, 279 insertions, 208 deletions
diff --git a/manifests/apache.pp b/manifests/apache.pp index 1e4224e..b1da837 100644 --- a/manifests/apache.pp +++ b/manifests/apache.pp @@ -1,12 +1,31 @@ class nagios::apache( $allow_external_cmd = false, $manage_shorewall = false, - $manage_munin = false + $manage_munin = false, + $stored_config = true ) { class{'nagios': httpd => 'apache', allow_external_cmd => $allow_external_cmd, manage_munin => $manage_munin, manage_shorewall => $manage_shorewall, + stored_config => $stored_config + } + + case $::operatingsystem { + 'debian': { + file { "${nagios::defaults::vars::int_cfgdir}/apache2.conf": + ensure => present, + source => [ "puppet:///modules/site_nagios/configs/${::fqdn}/apache2.conf", + "puppet:///modules/site_nagios/configs/apache2.conf", + "puppet:///modules/nagios/configs/apache2.conf"], + } + + apache::config::global { "nagios3.conf": + ensure => link, + target => "${nagios::defaults::vars::int_cfgdir}/apache2.conf", + require => File["${nagios::defaults::vars::int_cfgdir}/apache2.conf"], + } + } } } diff --git a/manifests/debian.pp b/manifests/debian.pp index 0f451e3..f26bd97 100644 --- a/manifests/debian.pp +++ b/manifests/debian.pp @@ -18,13 +18,15 @@ class nagios::debian inherits nagios::base { path => "${nagios::defaults::vars::int_cfgdir}/commands.cfg", ensure => present, notify => Service['nagios'], - mode => 0644, owner => root, group => root; + mode => 0644, owner => root, group => root, + require => Package['nagios'], } file { "${nagios::defaults::vars::int_cfgdir}/stylesheets": ensure => directory, purge => false, recurse => true, + require => Package['nagios'], } if $nagios::allow_external_cmd { @@ -33,16 +35,19 @@ class nagios::debian inherits nagios::base { unless => 'dpkg-statoverride --list nagios www-data 2710 /var/lib/nagios3/rw && dpkg-statoverride --list nagios nagios 751 /var/lib/nagios3', logoutput => false, notify => Service['nagios'], + require => Package['nagios'], } exec { 'nagios_external_cmd_perms_1': command => 'chmod 0751 /var/lib/nagios3 && chown nagios:nagios /var/lib/nagios3', unless => 'test "`stat -c "%a %U %G" /var/lib/nagios3`" = "751 nagios nagios"', notify => Service['nagios'], + require => Package['nagios'], } exec { 'nagios_external_cmd_perms_2': command => 'chmod 2751 /var/lib/nagios3/rw && chown nagios:www-data /var/lib/nagios3/rw', unless => 'test "`stat -c "%a %U %G" /var/lib/nagios3/rw`" = "2751 nagios www-data"', notify => Service['nagios'], + require => Package['nagios'], } } } diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index 777a74e..18925e1 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -1,3 +1,4 @@ +# configure nagios commands on the server class nagios::defaults::commands { include nagios::command::smtp @@ -5,140 +6,138 @@ class nagios::defaults::commands { # common service commands case $::operatingsystem { - debian,ubuntu: { - nagios_command { - check_dummy: - command_line => '$USER1$/check_dummy $ARG1$'; - check_https_cert: - command_line => '$USER1$/check_http --ssl -C 20 -H $HOSTADDRESS$ -I $HOSTADDRESS$'; - check_http_url: - command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$'; - check_http_url_regex: - command_line => '$USER1$/check_http -H $ARG1$ -p $ARG2$ -u $ARG3$ -e $ARG4$'; - check_https_url: - command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$'; - check_https_url_regex: - command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$ -e $ARG3$'; - check_mysql_db: - command_line => '$USER1$/check_mysql -H $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$ -d $ARG5$'; - check_ntp_time: - command_line => '$USER1$/check_ntp_time -H $HOSTADDRESS$ -w 0.5 -c 1'; - check_silc: - command_line => '$USER1$/check_tcp -p 706 -H $ARG1$'; - check_sobby: - command_line => '$USER1$/check_tcp -H $ARG1$ -p $ARG2$'; - check_jabber: - command_line => '$USER1$/check_jabber -H $ARG1$'; - check_git: - command_line => '$USER1$/check_tcp -H $ARG1$ -p 9418'; - } + debian,ubuntu: { + nagios_command { + 'check_dummy': + command_line => '$USER1$/check_dummy $ARG1$'; + 'check_https_cert': + command_line => '$USER1$/check_http --ssl -C 20 -H $HOSTADDRESS$ -I $HOSTADDRESS$'; + 'check_http_url': + command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$'; + 'check_http_url_regex': + command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$ -e $ARG3$'; + 'check_https_url': + command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$'; + 'check_https_url_regex': + command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$ -e $ARG3$'; + 'check_mysql_db': + command_line => '$USER1$/check_mysql -H $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$ -d $ARG5$'; + 'check_ntp_time': + command_line => '$USER1$/check_ntp_time -H $HOSTADDRESS$ -w 0.5 -c 1'; + 'check_openvpn_server': + command_line => '$USER1$/check_openvpn_server.pl -H $HOSTADDRESS$ -p 1194'; + 'check_openvpn_server_ip_port': + command_line => '$USER1$/check_openvpn_server.pl -H $ARG1$ -p $ARG2$'; + 'check_silc': + command_line => '$USER1$/check_tcp -p 706 -H $ARG1$'; + 'check_sobby': + command_line => '$USER1$/check_tcp -H $ARG1$ -p $ARG2$'; + 'check_jabber': + command_line => '$USER1$/check_jabber -H $ARG1$'; + 'check_git': + command_line => '$USER1$/check_tcp -H $ARG1$ -p 9418'; } - default: { - nagios_command { - check_dummy: - command_line => '$USER1$/check_dummy $ARG1$'; - check_ping: - command_line => '$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$'; - check-host-alive: - command_line => '$USER1$/check_ping -H $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1'; - check_tcp: - command_line => '$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$'; - check_udp: - command_line => '$USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$'; - check_load: - command_line => '$USER1$/check_load --warning=$ARG1$,$ARG2$,$ARG3$ --critical=$ARG4$,$ARG5$,$ARG6$'; - check_disk: - command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -e -p $ARG3$'; - check_all_disks: - command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -e'; - check_ssh: - command_line => '$USER1$/check_ssh $HOSTADDRESS$'; - check_ssh_port: - command_line => '$USER1$/check_ssh -p $ARG1$ $HOSTADDRESS$'; - check_ssh_port_host: - command_line => '$USER1$/check_ssh -p $ARG1$ $ARG2$'; - check_http: - command_line => '$USER1$/check_http -H $HOSTADDRESS$ -I $HOSTADDRESS$'; - check_https: - command_line => '$USER1$/check_http --ssl -H $HOSTADDRESS$ -I $HOSTADDRESS$'; - check_https_cert: - command_line => '$USER1$/check_http --ssl -C 20 -H $HOSTADDRESS$ -I $HOSTADDRESS$'; - check_http_url: - command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$'; - check_http_url_regex: - command_line => '$USER1$/check_http -H $ARG1$ -p $ARG2$ -u $ARG3$ -e $ARG4$'; - check_https_url: - command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$'; - check_https_url_regex: - command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$ -e $ARG3$'; - check_mysql: - command_line => '$USER1$/check_mysql -H $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$'; - check_mysql_db: - command_line => '$USER1$/check_mysql -H $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$ -d $ARG5$'; - check_ntp_time: - command_line => '$USER1$/check_ntp_time -H $HOSTADDRESS$ -w 0.5 -c 1'; - check_silc: - command_line => '$USER1$/check_tcp -p 706 -H $ARG1$'; - check_sobby: - command_line => '$USER1$/check_tcp -H $ARG1$ -p $ARG2$'; - check_jabber: - command_line => '$USER1$/check_jabber -H $ARG1$'; - check_git: - command_line => '$USER1$/check_tcp -H $ARG1$ -p 9418'; - } + } + default: { + nagios_command { + 'check_dummy': + command_line => '$USER1$/check_dummy $ARG1$'; + 'check_ping': + command_line => '$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$'; + 'check-host-alive': + command_line => '$USER1$/check_ping -H $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1'; + 'check_tcp': + command_line => '$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$'; + 'check_udp': + command_line => '$USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$'; + 'check_load': + command_line => '$USER1$/check_load --warning=$ARG1$,$ARG2$,$ARG3$ --critical=$ARG4$,$ARG5$,$ARG6$'; + 'check_disk': + command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -e -p $ARG3$'; + 'check_all_disks': + command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -e'; + 'check_ssh': + command_line => '$USER1$/check_ssh $HOSTADDRESS$'; + 'check_ssh_port': + command_line => '$USER1$/check_ssh -p $ARG1$ $HOSTADDRESS$'; + 'check_ssh_port_host': + command_line => '$USER1$/check_ssh -p $ARG1$ $ARG2$'; + 'check_http': + command_line => '$USER1$/check_http -H $HOSTADDRESS$ -I $HOSTADDRESS$'; + 'check_https': + command_line => '$USER1$/check_http --ssl -H $HOSTADDRESS$ -I $HOSTADDRESS$'; + 'check_https_cert': + command_line => '$USER1$/check_http --ssl -C 20 -H $HOSTADDRESS$ -I $HOSTADDRESS$'; + 'check_http_url': + command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$'; + 'check_http_url_regex': + command_line => '$USER1$/check_http -H $ARG1$ -p $ARG2$ -u $ARG3$ -e $ARG4$'; + 'check_https_url': + command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$'; + 'check_https_url_regex': + command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$ -e $ARG3$'; + 'check_mysql': + command_line => '$USER1$/check_mysql -H $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$'; + 'check_mysql_db': + command_line => '$USER1$/check_mysql -H $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$ -d $ARG5$'; + 'check_ntp_time': + command_line => '$USER1$/check_ntp_time -H $HOSTADDRESS$ -w 0.5 -c 1'; + 'check_silc': + command_line => '$USER1$/check_tcp -p 706 -H $ARG1$'; + 'check_sobby': + command_line => '$USER1$/check_tcp -H $ARG1$ -p $ARG2$'; + 'check_jabber': + command_line => '$USER1$/check_jabber -H $ARG1$'; + 'check_git': + command_line => '$USER1$/check_tcp -H $ARG1$ -p 9418'; } + } } - # commands for services defined by other modules + # commands for services defined by other modules - nagios_command { - # from apache module - http_port: - command_line => '$USER1$/check_http -p $ARG1$ -H $HOSTADDRESS$ -I $HOSTADDRESS$'; + nagios_command { + # from apache module + 'http_port': + command_line => '$USER1$/check_http -p $ARG1$ -H $HOSTADDRESS$ -I $HOSTADDRESS$'; - check_http_port_url_content: - command_line => '$USER1$/check_http -H $ARG1$ -p $ARG2$ -u $ARG3$ -s $ARG4$'; - check_https_port_url_content: - command_line => '$USER1$/check_http --ssl -H $ARG1$ -p $ARG2$ -u $ARG3$ -s $ARG4$'; - check_http_url_content: - command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$ -s $ARG3$'; - check_https_url_content: - command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$ -s $ARG3$'; + 'check_http_port_url_content': + command_line => '$USER1$/check_http -H $ARG1$ -p $ARG2$ -u $ARG3$ -s $ARG4$'; + 'check_https_port_url_content': + command_line => '$USER1$/check_http --ssl -H $ARG1$ -p $ARG2$ -u $ARG3$ -s $ARG4$'; + 'check_http_url_content': + command_line => '$USER1$/check_http -H $ARG1$ -u $ARG2$ -s $ARG3$'; + 'check_https_url_content': + command_line => '$USER1$/check_http --ssl -H $ARG1$ -u $ARG2$ -s $ARG3$'; - # from bind module - check_dig2: - command_line => '$USER1$/check_dig -H $HOSTADDRESS$ -l $ARG1$ --record_type=$ARG2$'; + # from bind module + 'check_dig2': + command_line => '$USER1$/check_dig -H $HOSTADDRESS$ -l $ARG1$ --record_type=$ARG2$'; - # from mysql module - check_mysql_health: - command_line => '$USER1$/check_mysql_health --hostname $ARG1$ --port $ARG2$ --username $ARG3$ --password $ARG4$ --mode $ARG5$ --database $ARG6$ $ARG7$ $ARG8$'; + # from mysql module + 'check_mysql_health': + command_line => '$USER1$/check_mysql_health --hostname $ARG1$ --port $ARG2$ --username $ARG3$ --password $ARG4$ --mode $ARG5$ --database $ARG6$ $ARG7$ $ARG8$'; - # better check_dns - check_dns2: - command_line => '$USER1$/check_dns2 -c $ARG1$ A $ARG2$'; + # better check_dns + 'check_dns2': + command_line => '$USER1$/check_dns2 -c $ARG1$ A $ARG2$'; - # dnsbl checking - check_dnsbl: - command_line => '$USER1$/check_dnsbl -H $ARG1$'; - } - - # notification commands + # dnsbl checking + 'check_dnsbl': + command_line => '$USER1$/check_dnsbl -H $ARG1$'; + } - $mail_cmd_location = $::operatingsystem ? { - centos => '/bin/mail', - default => '/usr/bin/mail' - } + # notification commands - case $::lsbdistcodename { - 'wheezy': { } - default: { - nagios_command { - 'notify-host-by-email': - command_line => "/usr/bin/printf \"%b\" \"***** Nagios *****\\n\\nNotification Type: \$NOTIFICATIONTYPE\$\\nHost: \$HOSTNAME\$\\nState: \$HOSTSTATE\$\\nAddress: \$HOSTADDRESS\$\\nInfo: \$HOSTOUTPUT\$\\n\\nDate/Time: \$LONGDATETIME\$\\n\" | ${mail_cmd_location} -s \"** \$NOTIFICATIONTYPE\$ Host Alert: \$HOSTNAME\$ is \$HOSTSTATE\$ **\" \$CONTACTEMAIL\$"; - 'notify-service-by-email': - command_line => "/usr/bin/printf \"%b\" \"***** Nagios *****\\n\\nNotification Type: \$NOTIFICATIONTYPE\$\\n\\nService: \$SERVICEDESC\$\\nHost: \$HOSTALIAS\$\\nAddress: \$HOSTADDRESS\$\\nState: \$SERVICESTATE\$\\n\\nDate/Time: \$LONGDATETIME\$\\n\\nAdditional Info:\\n\\n\$SERVICEOUTPUT\$\" | ${mail_cmd_location} -s \"** \$NOTIFICATIONTYPE\$ Service Alert: \$HOSTALIAS\$/\$SERVICEDESC\$ is \$SERVICESTATE\$ **\" \$CONTACTEMAIL\$"; - } - } - } + $mail_cmd_location = $::operatingsystem ? { + centos => '/bin/mail', + default => '/usr/bin/mail' + } + nagios_command { + 'notify-host-by-email': + command_line => "/usr/bin/printf \"%b\" \"***** Nagios *****\\n\\nNotification Type: \$NOTIFICATIONTYPE\$\\n\\nHost: \$HOSTNAME\$ (\$HOSTALIAS\$)\\nAddress: \$HOSTADDRESS\$\\nState: \$HOSTSTATE\$\\nDuration: \$HOSTDURATION\$\\n\\nDate/Time: \$LONGDATETIME\$\\n\\nOutput: \$HOSTOUTPUT\$\" | ${mail_cmd_location} -s \"\$HOSTSTATE\$ - \$HOSTNAME\$\" \$CONTACTEMAIL\$"; + 'notify-service-by-email': + command_line => "/usr/bin/printf \"%b\" \"***** Nagios *****\\n\\nNotification Type: \$NOTIFICATIONTYPE\$\\n\\nHost: \$HOSTNAME\$ (\$HOSTALIAS\$)\\nAddress: \$HOSTADDRESS\$\\n\\nService: \$SERVICEDESC\$\\nState: \$SERVICESTATE\$\\nDuration: \$SERVICEDURATION\$\\n\\nDate/Time: \$LONGDATETIME\$\\n\\nOutput: \$SERVICEOUTPUT\$\" | ${mail_cmd_location} -s \"\$SERVICESTATE\$ - \$HOSTALIAS\$: \$SERVICEDESC\$\" \$CONTACTEMAIL\$"; + } } diff --git a/manifests/init.pp b/manifests/init.pp index c800637..088286f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -19,7 +19,8 @@ class nagios( $httpd = 'apache', $allow_external_cmd = false, $manage_shorewall = false, - $manage_munin = false + $manage_munin = false, + $stored_config = true ) { case $nagios::httpd { 'absent': { } diff --git a/manifests/nrpe.pp b/manifests/nrpe.pp index 3ef7d07..8482df8 100644 --- a/manifests/nrpe.pp +++ b/manifests/nrpe.pp @@ -8,10 +8,10 @@ class nagios::nrpe { include nagios::nrpe::freebsd } - 'Debian': { + 'Debian','Ubuntu': { if $nagios_nrpe_pid_file == '' { $nagios_nrpe_pid_file = '/var/run/nagios/nrpe.pid' } if $nagios_plugin_dir == '' { $nagios_plugin_dir = '/usr/lib/nagios/plugins' } - include nagios::nrpe::linux + include nagios::nrpe::debian } default: { if $nagios_nrpe_pid_file == '' { $nagios_nrpe_pid_file = '/var/run/nrpe.pid' } diff --git a/manifests/nrpe/base.pp b/manifests/nrpe/base.pp index 17abb04..3412f7e 100644 --- a/manifests/nrpe/base.pp +++ b/manifests/nrpe/base.pp @@ -2,31 +2,33 @@ class nagios::nrpe::base { if $nagios_nrpe_cfgdir == '' { $nagios_nrpe_cfgdir = '/etc/nagios' } if $processorcount == '' { $processorcount = 1 } - - package { "nagios-nrpe-server": ensure => present; - "nagios-plugins-basic": ensure => present; - "libwww-perl": ensure => present; # for check_apache - } + + # libwww-perl for check_apache + include perl::extensions::libwww + + package { [ 'nagios-nrpe-server', 'nagios-plugins-basic' ]: + ensure => present; + } # Special-case lenny. the package doesn't exist - if $lsbdistcodename != 'lenny' { - package { "libnagios-plugin-perl": ensure => present; } + if $::lsbdistcodename != 'lenny' { + package { 'libnagios-plugin-perl': ensure => present; } } - - file { [ $nagios_nrpe_cfgdir, "$nagios_nrpe_cfgdir/nrpe.d" ]: - ensure => directory } + + file { [ $nagios_nrpe_cfgdir, "$nagios_nrpe_cfgdir/nrpe.d" ]: + ensure => directory } if $nagios_nrpe_dont_blame == '' { $nagios_nrpe_dont_blame = 1 } file { "$nagios_nrpe_cfgdir/nrpe.cfg": - content => template('nagios/nrpe/nrpe.cfg'), - owner => root, group => 0, mode => 644; + content => template('nagios/nrpe/nrpe.cfg'), + owner => root, group => root, mode => '0644'; } - + # default commands - nagios::nrpe::command { "basic_nrpe": - source => [ "puppet:///modules/site-nagios/configs/nrpe/nrpe_commands.${fqdn}.cfg", - "puppet:///modules/site-nagios/configs/nrpe/nrpe_commands.cfg", - "puppet:///modules/nagios/nrpe/nrpe_commands.cfg" ], + nagios::nrpe::command { 'basic_nrpe': + source => [ "puppet:///modules/site-nagios/configs/nrpe/nrpe_commands.${::fqdn}.cfg", + 'puppet:///modules/site-nagios/configs/nrpe/nrpe_commands.cfg', + 'puppet:///modules/nagios/nrpe/nrpe_commands.cfg' ], } # the check for load should be customized for each server based on number # of CPUs and the type of activity. @@ -36,15 +38,15 @@ class nagios::nrpe::base { $critical_1_threshold = 10 * $processorcount $critical_5_threshold = 9 * $processorcount $critical_15_threshold = 8 * $processorcount - nagios::nrpe::command { "check_load": - command_line => "${nagios_plugin_dir}/check_load -w ${warning_1_threshold},${warning_5_threshold},${warning_15_threshold} -c ${critical_1_threshold},${critical_5_threshold},${critical_15_threshold}", + nagios::nrpe::command { 'check_load': + command_line => "${::nagios::nrpe::nagios_plugin_dir}/check_load -w ${warning_1_threshold},${warning_5_threshold},${warning_15_threshold} -c ${critical_1_threshold},${critical_5_threshold},${critical_15_threshold}", } - service { "nagios-nrpe-server": - ensure => running, - enable => true, - pattern => "nrpe", - subscribe => File["$nagios_nrpe_cfgdir/nrpe.cfg"], - require => Package["nagios-nrpe-server"], + service { 'nagios-nrpe-server': + ensure => running, + enable => true, + pattern => 'nrpe', + subscribe => File["$nagios_nrpe_cfgdir/nrpe.cfg"], + require => Package['nagios-nrpe-server'], } } diff --git a/manifests/nrpe/debian.pp b/manifests/nrpe/debian.pp new file mode 100644 index 0000000..fcaf851 --- /dev/null +++ b/manifests/nrpe/debian.pp @@ -0,0 +1,6 @@ +class nagios::nrpe::debian inherits nagios::nrpe::base { + include nagios::nrpe::linux + Service['nagios-nrpe-server'] { + hasstatus => false, + } +} diff --git a/manifests/pnp4nagios.pp b/manifests/pnp4nagios.pp index 5ade74f..230772f 100644 --- a/manifests/pnp4nagios.pp +++ b/manifests/pnp4nagios.pp @@ -2,27 +2,32 @@ class nagios::pnp4nagios { include nagios::defaults::pnp4nagios package { 'pnp4nagios': - ensure => installed } + ensure => installed, + require => Package['nagios'] + } - # unfortunatly we can't use the nagios_host and nagios_service - # definition to define templates, so we need to copy a file here. - # see http://projects.reductivelabs.com/issues/1180 for this limitation + # unfortunatly i didn't find a way to use nagios_host and nagios_service definition, because + # imho puppet can't handle the "name" variable needed in these 2 definitions + # so we need to copy a file here. file { 'pnp4nagios-templates.cfg': - path => "${nagios::defaults::vars::int_cfgdir}/conf.d/pnp4nagios-templates.cfg", - source => [ 'puppet:///modules/site_nagios/pnp4nagios/pnp4nagios-templates.cfg', - 'puppet:///modules/nagios/pnp4nagios/pnp4nagios-templates.cfg' ], - mode => '0644', - owner => root, - group => root, - notify => Service['nagios'], + path => "${nagios::defaults::vars::int_cfgdir}/conf.d/pnp4nagios-templates.cfg", + source => [ + 'puppet:///modules/site-nagios/pnp4nagios/pnp4nagios-templates.cfg', + 'puppet:///modules/nagios/pnp4nagios/pnp4nagios-templates.cfg' ], + mode => '0644', + owner => root, + group => root, + notify => Service['nagios'], + require => Package['pnp4nagios'], } file { 'apache.conf': path => '/etc/pnp4nagios/apache.conf', - source => [ 'puppet:///modules/site_nagios/pnp4nagios/apache.conf', - 'puppet:///modules/nagios/pnp4nagios/apache.conf' ], + source => [ + 'puppet:///modules/site-nagios/pnp4nagios/apache.conf', + 'puppet:///modules/nagios/pnp4nagios/apache.conf' ], mode => '0644', owner => root, group => root, @@ -33,31 +38,35 @@ class nagios::pnp4nagios { # run npcd as daemon file { '/etc/default/npcd': - path => '/etc/default/npcd', - source => [ 'puppet:///modules/site_nagios/pnp4nagios/npcd', - 'puppet:///modules/nagios/pnp4nagios/npcd' ], - mode => '0644', - owner => root, - group => root, - notify => Service['npcd']; + path => '/etc/default/npcd', + source => [ + 'puppet:///modules/site-nagios/pnp4nagios/npcd', + 'puppet:///modules/nagios/pnp4nagios/npcd' ], + mode => '0644', + owner => root, + group => root, + notify => Service['npcd'], + require => Package['pnp4nagios'], } service { 'npcd': - ensure => running, - enable => true, - hasstatus => true, - require => Package['pnp4nagios'], + ensure => running, + enable => true, + hasstatus => true, + require => Package['pnp4nagios'], } # modify action.gif file { '/usr/share/nagios3/htdocs/images/action.gif': - path => '/usr/share/nagios3/htdocs/images/action.gif', - source => [ 'puppet:///modules/site_nagios/pnp4nagios/action.gif', - 'puppet:///modules/nagios/pnp4nagios/action.gif' ], - mode => '0644', - owner => root, - group => root, - notify => Service['nagios']; + path => '/usr/share/nagios3/htdocs/images/action.gif', + source => [ + 'puppet:///modules/site-nagios/pnp4nagios/action.gif', + 'puppet:///modules/nagios/pnp4nagios/action.gif' ], + mode => '0644', + owner => root, + group => root, + notify => Service['nagios'], + require => Package['pnp4nagios'], } } diff --git a/manifests/pnp4nagios/popup.pp b/manifests/pnp4nagios/popup.pp index 0dc04b0..91136cc 100644 --- a/manifests/pnp4nagios/popup.pp +++ b/manifests/pnp4nagios/popup.pp @@ -1,19 +1,24 @@ -class nagios::pnp4nagios::popup inherits nagios::pnp4nagios { +class nagios::pnp4nagios::popup inherits nagios::pnp4nagios { File['pnp4nagios-templates.cfg']{ - source => [ 'puppet:///modules/site_nagios/pnp4nagios/pnp4nagios-popup-templates.cfg', - 'puppet:///modules/nagios/pnp4nagios/pnp4nagios-popup-templates.cfg' ], + source => [ + 'puppet:///modules/site-nagios/pnp4nagios/pnp4nagios-popup-templates.cfg', + 'puppet:///modules/nagios/pnp4nagios/pnp4nagios-popup-templates.cfg' ], } file { '/usr/share/nagios3/htdocs/ssi': - ensure => directory } + ensure => directory, + require => Package['nagios'], + } file { 'status-header.ssi': - path => '/usr/share/nagios3/htdocs/ssi/status-header.ssi', - source => [ 'puppet:///modules/site_nagios/pnp4nagios/status-header.ssi', - 'puppet:///modules/nagios/pnp4nagios/status-header.ssi' ], - mode => '0644', - owner => root, - group => root, - notify => Service['nagios'], + path => '/usr/share/nagios3/htdocs/ssi/status-header.ssi', + source => [ + 'puppet:///modules/site-nagios/pnp4nagios/status-header.ssi', + 'puppet:///modules/nagios/pnp4nagios/status-header.ssi'], + mode => '0644', + owner => root, + group => root, + notify => Service['nagios'], + require => Package['nagios'], } } diff --git a/manifests/service.pp b/manifests/service.pp index 3e8f6c8..9e265a6 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -12,7 +12,7 @@ define nagios::service ( $contact_groups = '', $use = 'generic-service', $service_description = 'absent', - $use_nrpe = '', + $use_nrpe = false, $nrpe_args = '', $nrpe_timeout = 10 ) { @@ -30,20 +30,22 @@ define nagios::service ( if $check_command == 'absent' { fail("Must pass a check_command to ${name} if it should be present") } - if ($use_nrpe == true) { + if $use_nrpe == true { include nagios::command::nrpe_timeout if ($nrpe_args != '') { - $real_check_command = "check_nrpe_timeout!$nrpe_timeout!$check_command!\"$nrpe_args\"" - } else { - $real_check_command = "check_nrpe_1arg_timeout!$nrpe_timeout!$check_command" - } - } else { + $real_check_command = "check_nrpe_timeout!$nrpe_timeout!$check_command!\"$nrpe_args\"" + } + else { + $real_check_command = "check_nrpe_1arg_timeout!$nrpe_timeout!$check_command" + } + } + else { $real_check_command = "$check_command" } Nagios_service["${real_name}"] { - check_command => $check_command, + check_command => $real_check_command, host_name => $host_name, use => $use, service_description => $service_description ?{ diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp index 2c74717..9559b17 100644 --- a/manifests/service/mysql.pp +++ b/manifests/service/mysql.pp @@ -27,7 +27,7 @@ define nagios::service::mysql( if $check_warning != undef { $real_check_warning = "!--warning $check_warning" } - + if $check_critical != undef { $real_check_critical = "!--critical $check_critical" } diff --git a/manifests/stored_config.pp b/manifests/stored_config.pp new file mode 100644 index 0000000..5afda04 --- /dev/null +++ b/manifests/stored_config.pp @@ -0,0 +1,19 @@ +class nagios::stored_config { + # collect exported resources + + Nagios_command <<||>> + Nagios_contactgroup <<||>> + Nagios_contact <<||>> + Nagios_hostdependency <<||>> + Nagios_hostescalation <<||>> + Nagios_hostextinfo <<||>> + Nagios_hostgroup <<||>> + Nagios_host <<||>> + Nagios_servicedependency <<||>> + Nagios_serviceescalation <<||>> + Nagios_servicegroup <<||>> + Nagios_serviceextinfo <<||>> + Nagios_service <<||>> + Nagios_timeperiod <<||>> + +} diff --git a/manifests/target.pp b/manifests/target.pp index be6c40e..40ff18a 100644 --- a/manifests/target.pp +++ b/manifests/target.pp @@ -3,8 +3,9 @@ class nagios::target( $parents = 'absent', $address = $::ipaddress, - $nagios_alias = false, - $hostgroups = 'absent' + $nagios_alias = $::false, + $hostgroups = 'absent', + $notes = 'absent' ){ @@nagios_host { $::fqdn: address => $address, @@ -19,10 +20,13 @@ class nagios::target( } if ($parents != 'absent') { - Nagios_host["${::fqdn}"] { parents => $parents } + Nagios_host[ $::fqdn ] { parents => $parents } } if ($hostgroups != 'absent') { - Nagios_host["${::fqdn}"] { hostgroups => $hostgroups } + Nagios_host[ $::fqdn ] { hostgroups => $hostgroups } + } + if ($notes != 'absent') { + Nagios_host[ $::fqdn ] { notes => $notes } } } |