From 364cef55a216e01dc393129c48328bef0e979031 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 7 Jun 2010 22:43:25 -0300 Subject: Adding legacy path for htpasswd.users --- manifests/base.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/base.pp b/manifests/base.pp index 6106ab2..8dd3955 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -38,7 +38,8 @@ class nagios::base { file { 'nagios_htpasswd': path => "${nagios_cfgdir}/htpasswd.users", source => [ "puppet://$server/modules/site-nagios/htpasswd.users", - "puppet://$server/modules/nagios/htpasswd.users" ], + "puppet://$server/modules/nagios/htpasswd.users", + "puppet://$server/files/etc/nagios3/htpasswd.users" ], mode => 0640, owner => root, group => apache; } -- cgit v1.2.3 From 3673e3872846a5d1d99d875091204e33d844e046 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 22 Aug 2010 15:24:56 -0300 Subject: Specifying 'modules' in file path --- manifests/base.pp | 2 +- manifests/nsca/server.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/base.pp b/manifests/base.pp index 8dd3955..6bf2533 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -55,7 +55,7 @@ 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}", notify => Service['nagios'], owner => root, group => nagios, mode => '0640'; } diff --git a/manifests/nsca/server.pp b/manifests/nsca/server.pp index c682e24..8cdfe75 100644 --- a/manifests/nsca/server.pp +++ b/manifests/nsca/server.pp @@ -11,7 +11,7 @@ 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" ], + "puppet://${server}/modules/nagios/nsca/nsca.cfg" ], owner => 'nagios', group => 'nogroup', mode => '400', -- cgit v1.2.3 From 4ab9195df1b71173e0e54159523cf0d167a1abb7 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 20 Oct 2010 21:15:10 +0200 Subject: rename check_ssh port cmd, add ssh_port_host cmd --- manifests/defaults/commands.pp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index 25ab1bc..bd67198 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -49,8 +49,10 @@ class nagios::defaults::commands { command_line => '$USER1$/check_disk -w $ARG1$ -c $ARG2$ -e'; check_ssh: command_line => '$USER1$/check_ssh $HOSTADDRESS$'; - ssh_port: + 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: -- cgit v1.2.3 From a6fc95172382e10b3341e6f973b7d7f4159cf67b Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 20 Oct 2010 23:16:40 +0200 Subject: add check_git command --- manifests/defaults/commands.pp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'manifests') diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index bd67198..9375858 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -79,6 +79,8 @@ class nagios::defaults::commands { 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'; } } } -- cgit v1.2.3 From 6227899364bc721b9c728151a69c46386d96cf44 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 21 Oct 2010 02:24:09 +0200 Subject: add check_dns2 check_dns had some problems with down nameservers. This one properly checks the right nameserver. --- manifests/defaults/commands.pp | 4 ++++ manifests/defaults/plugins.pp | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index 9375858..06e45e9 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -98,6 +98,10 @@ class nagios::defaults::commands { # from mysql module check_mysql_health: command_line => '$USER1$/check_mysql_health --hostname $ARG1$ --port $ARG2$ --username $ARG3$ --password $ARG4$ --mode $ARG5$ --database $ARG6$'; + + # better check_dns + check_dns2: + command_line => '$USER1$/check_dns2 -c $ARG1 A $ARG2'; } # notification commands diff --git a/manifests/defaults/plugins.pp b/manifests/defaults/plugins.pp index 1df8064..842f9ce 100644 --- a/manifests/defaults/plugins.pp +++ b/manifests/defaults/plugins.pp @@ -1,5 +1,10 @@ class nagios::defaults::plugins { - nagios::plugin { 'check_mysql_health': source => 'nagios/plugins/check_mysql_health'; } + nagios::plugin { + 'check_mysql_health': + source => 'nagios/plugins/check_mysql_health'; + 'check_dns2': + source => 'nagios/plugins/check_dns2'; + } } -- cgit v1.2.3 From e0c7a26923547adeee09429c1b419f18f4577dac Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 21 Oct 2010 03:33:54 +0200 Subject: fix typo in commands --- manifests/defaults/commands.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index 06e45e9..e061e79 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -101,7 +101,7 @@ class nagios::defaults::commands { # better check_dns check_dns2: - command_line => '$USER1$/check_dns2 -c $ARG1 A $ARG2'; + command_line => '$USER1$/check_dns2 -c $ARG1$ A $ARG2$'; } # notification commands -- cgit v1.2.3 From 9dfbd0d0e01f4d64b693779658bbd9c1faad7d08 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 23 Oct 2010 00:53:18 +0200 Subject: add some more http(s) tests --- manifests/defaults/commands.pp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'manifests') diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index e061e79..655da48 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -17,6 +17,14 @@ class nagios::defaults::commands { 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_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_mysql_db: command_line => '$USER1$/check_mysql -H $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$ -d $ARG5$'; check_ntp_time: -- cgit v1.2.3 From 36522dfeac8f5b2405282b9d01cd6e83d50d3de6 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 23 Oct 2010 01:09:41 +0200 Subject: define commands at the right place --- manifests/defaults/commands.pp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'manifests') diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index 655da48..e0b97d1 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -17,14 +17,6 @@ class nagios::defaults::commands { 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_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_mysql_db: command_line => '$USER1$/check_mysql -H $ARG1$ -P $ARG2$ -u $ARG3$ -p $ARG4$ -d $ARG5$'; check_ntp_time: @@ -99,6 +91,16 @@ class nagios::defaults::commands { # 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$'; + # from bind module check_dig2: command_line => '$USER1$/check_dig -H $HOSTADDRESS$ -l $ARG1$ --record_type=$ARG2$'; -- cgit v1.2.3 From 2214b80b579e68fcbe329b7a626944af0b3834ad Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 25 Nov 2010 00:14:11 +0100 Subject: tcp and udp are now one package --- manifests/centos.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/centos.pp b/manifests/centos.pp index 4d9507b..35379b8 100644 --- a/manifests/centos.pp +++ b/manifests/centos.pp @@ -1,6 +1,6 @@ class nagios::centos inherits nagios::base { - package { [ 'nagios-plugins', 'nagios-plugins-smtp','nagios-plugins-http', 'nagios-plugins-ssh', 'nagios-plugins-udp', 'nagios-plugins-tcp', 'nagios-plugins-dig', 'nagios-plugins-nrpe', 'nagios-plugins-load', 'nagios-plugins-dns', 'nagios-plugins-ping', 'nagios-plugins-procs', 'nagios-plugins-users', 'nagios-plugins-ldap', 'nagios-plugins-disk', 'nagios-plugins-swap', 'nagios-plugins-nagios', 'nagios-plugins-perl', 'nagios-plugins-ntp', 'nagios-plugins-snmp' ]: + package { [ 'nagios-plugins', 'nagios-plugins-smtp','nagios-plugins-http', 'nagios-plugins-ssh', 'nagios-plugins-tcp', 'nagios-plugins-dig', 'nagios-plugins-nrpe', 'nagios-plugins-load', 'nagios-plugins-dns', 'nagios-plugins-ping', 'nagios-plugins-procs', 'nagios-plugins-users', 'nagios-plugins-ldap', 'nagios-plugins-disk', 'nagios-plugins-swap', 'nagios-plugins-nagios', 'nagios-plugins-perl', 'nagios-plugins-ntp', 'nagios-plugins-snmp' ]: ensure => 'present', notify => Service['nagios'], } -- cgit v1.2.3 From c9c4f5bb895e98e31d84c751a7fcbdae9bf57008 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 12 Dec 2010 12:44:01 +0100 Subject: add smtp checks --- manifests/command/smtp.pp | 14 +++++++++++++ manifests/service/smtp.pp | 52 ++++++++++++++++++++++++++++++++++++++++++++++ manifests/service/ssmtp.pp | 34 ++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 manifests/command/smtp.pp create mode 100644 manifests/service/smtp.pp create mode 100644 manifests/service/ssmtp.pp (limited to 'manifests') diff --git a/manifests/command/smtp.pp b/manifests/command/smtp.pp new file mode 100644 index 0000000..04f8543 --- /dev/null +++ b/manifests/command/smtp.pp @@ -0,0 +1,14 @@ +class nagios::command::smtp { + nagios_command{ + 'check_smtp': + command_line => '$USER1$/check_smtp -H $ARG1$ -p $ARG2$'; + 'check_smtp_tls': + command_line => '$USER1$/check_smtp -H $ARG1$ -p $ARG2$ -S'; + 'check_smtp_cert': + command_line => '$USER1$/check_smtp -H $ARG1$ -p $ARG2$ -S -D $ARG3$'; + 'check_ssmtp': + command_line => '$USER1$/check_ssmtp -H $ARG1$ -p $ARG2$ -S'; + 'check_ssmtp_cert': + command_line => '$USER1$/check_ssmtp -H $ARG1$ -p $ARG2$ -S -D $ARG3$'; + } +} diff --git a/manifests/service/smtp.pp b/manifests/service/smtp.pp new file mode 100644 index 0000000..0175bf7 --- /dev/null +++ b/manifests/service/smtp.pp @@ -0,0 +1,52 @@ +# true: +# - true : check tls and plain connect *defualt* +# - false : check plain connection only +# cert_days: +# If tls is used add an additionl check +# to check for validity for cert. +# - 'absent' : do not execute that check +# - INTEGER : Minimum number of days a certificate +# has to be valid. Default: 10 +define nagios::service::smtp( + $ensure = 'present', + $host = 'absent', + $port = '25', + $tls = true, + $cert_days = 10 +){ + $real_host = $host ? { + 'absent' => $name, + default => $host + } + + include nagios::command::smtp + + nagios::service{ + "smtp_${name}_${port}": + ensure => $ensure; + "smtp_tls_${name}_${port}": + ensure => $tls ? { + true => $ensure, + default => 'absent' + }; + "smtp_tls_cert_${name}_${port}": + ensure => $cert_days ? { + 'absent' => 'absent', + default => $ensure + }; + } + + if $ensure != 'absent' { + Nagios::Service["smtp_${name}_${port}"]{ + check_command => "check_smtp!${real_host}!${port}", + } + Nagios::Service["smtp_tls_${name}_${port}"]{ + check_command => "check_smtp_tls!${real_host}!${port}", + } + if $cert_days != 'absent' { + Nagios::Service["smtp_tls_cert_${name}_${port}"]{ + check_command => "check_smtp_cert!${real_host}!${port}!${cert_days}", + } + } + } +} diff --git a/manifests/service/ssmtp.pp b/manifests/service/ssmtp.pp new file mode 100644 index 0000000..2467fe0 --- /dev/null +++ b/manifests/service/ssmtp.pp @@ -0,0 +1,34 @@ +define nagios::service::ssmtp( + $ensure = 'present', + $host = 'absent', + $port = '465', + $cert_days = 10 +){ + $real_host = $host ? { + 'absent' => $name, + default => $host + } + + include nagios::command::smtp + + nagios::service{ + "ssmtp_${name}_${port}": + ensure => $ensure; + "ssmtp_cert_${name}_${port}": + ensure => $cert_days ? { + 'absent' => 'absent', + default => $ensure + }; + } + + if $ensure != 'absent' { + Nagios::Service["ssmtp_${name}_${port}"]{ + check_command => "check_ssmtp!${real_host}!${port}", + } + if $cert_days != 'absent' { + Nagios::Service["ssmtp_cert_${name}_${port}"]{ + check_command => "check_ssmtp_cert!${real_host}!${port}!${cert_days}", + } + } + } +} -- cgit v1.2.3 From 0c101a6577dcb5c7f07d33e200ac0d04ac6dceef Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 12 Dec 2010 16:24:47 +0100 Subject: include the commands at the right place --- manifests/defaults/commands.pp | 3 ++- manifests/service/smtp.pp | 2 -- manifests/service/ssmtp.pp | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) (limited to 'manifests') diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index e0b97d1..27cb641 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -1,7 +1,8 @@ class nagios::defaults::commands { - # common service commands + include nagios::command::smtp, + # common service commands case $operatingsystem { debian,ubuntu: { nagios_command { diff --git a/manifests/service/smtp.pp b/manifests/service/smtp.pp index 0175bf7..14237a9 100644 --- a/manifests/service/smtp.pp +++ b/manifests/service/smtp.pp @@ -19,8 +19,6 @@ define nagios::service::smtp( default => $host } - include nagios::command::smtp - nagios::service{ "smtp_${name}_${port}": ensure => $ensure; diff --git a/manifests/service/ssmtp.pp b/manifests/service/ssmtp.pp index 2467fe0..b05678a 100644 --- a/manifests/service/ssmtp.pp +++ b/manifests/service/ssmtp.pp @@ -9,8 +9,6 @@ define nagios::service::ssmtp( default => $host } - include nagios::command::smtp - nagios::service{ "ssmtp_${name}_${port}": ensure => $ensure; -- cgit v1.2.3 From 7800742705a44ff6d32bbb0415ea0b1f954a8fcd Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 12 Dec 2010 16:38:46 +0100 Subject: fix typo --- manifests/defaults/commands.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index 27cb641..c5147b4 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -1,6 +1,6 @@ class nagios::defaults::commands { - include nagios::command::smtp, + include nagios::command::smtp # common service commands case $operatingsystem { -- cgit v1.2.3 From 1c4de48baf4ffcf5f39894a101a3c59479959b47 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 12 Dec 2010 17:41:28 +0100 Subject: add imap and pop3 commands --- manifests/command/imap_pop3.pp | 12 ++++++++++++ manifests/defaults/commands.pp | 1 + 2 files changed, 13 insertions(+) create mode 100644 manifests/command/imap_pop3.pp (limited to 'manifests') diff --git a/manifests/command/imap_pop3.pp b/manifests/command/imap_pop3.pp new file mode 100644 index 0000000..a857d74 --- /dev/null +++ b/manifests/command/imap_pop3.pp @@ -0,0 +1,12 @@ +class nagios::command::imap_pop3 { + nagios_command{ + 'check_imap': + command_line => '$USER1$/check_imap -H $ARG1$ -p $ARG2$'; + 'check_imap_ssl': + command_line => '$USER1$/check_imap -H $ARG1$ -p $ARG2$ -S'; + 'check_pop3': + command_line => '$USER1$/check_pop -H $ARG1$ -p $ARG2$ -S'; + 'check_pop3_ssl': + command_line => '$USER1$/check_pop -H $ARG1$ -p $ARG2$ -S'; + } +} diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index c5147b4..933f3b9 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -1,6 +1,7 @@ class nagios::defaults::commands { include nagios::command::smtp + include nagios::command::imap_pop3 # common service commands case $operatingsystem { -- cgit v1.2.3 From 1784190780c1054b65508b242963abd0e584d477 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 12 Dec 2010 19:15:51 +0100 Subject: add check for managesieve --- manifests/command/imap_pop3.pp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'manifests') diff --git a/manifests/command/imap_pop3.pp b/manifests/command/imap_pop3.pp index a857d74..c81e2d0 100644 --- a/manifests/command/imap_pop3.pp +++ b/manifests/command/imap_pop3.pp @@ -8,5 +8,7 @@ class nagios::command::imap_pop3 { command_line => '$USER1$/check_pop -H $ARG1$ -p $ARG2$ -S'; 'check_pop3_ssl': command_line => '$USER1$/check_pop -H $ARG1$ -p $ARG2$ -S'; + 'check_managesieve': + command_line => '$USER1$/check_tcp -H $ARG1$ -p 2000'; } } -- cgit v1.2.3 From 4fe59df65853631ec78ce3c731f62097d6182563 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 12 Dec 2010 22:17:03 +0100 Subject: no ssl connection for pop3 --- manifests/command/imap_pop3.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/command/imap_pop3.pp b/manifests/command/imap_pop3.pp index c81e2d0..174b09c 100644 --- a/manifests/command/imap_pop3.pp +++ b/manifests/command/imap_pop3.pp @@ -5,7 +5,7 @@ class nagios::command::imap_pop3 { 'check_imap_ssl': command_line => '$USER1$/check_imap -H $ARG1$ -p $ARG2$ -S'; 'check_pop3': - command_line => '$USER1$/check_pop -H $ARG1$ -p $ARG2$ -S'; + command_line => '$USER1$/check_pop -H $ARG1$ -p $ARG2$'; 'check_pop3_ssl': command_line => '$USER1$/check_pop -H $ARG1$ -p $ARG2$ -S'; 'check_managesieve': -- cgit v1.2.3 From 12212a762f3c188fef94f763e3a006e49e3a333b Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Mon, 13 Dec 2010 19:40:20 -0500 Subject: Make nagios::apache manage the apache config. Currently, the nagios module purges all files under the Nagios configuration directory. This has the unwanted effect of removing files that are added by default by the .deb packages, thus making the Nagios interface non functional under apache. To fix the situation, make nagios::apache under Debian manage the apache config file and link to it in apache's conf.d directory, in the same manner as the Debian packages do. Signed-off-by: Gabriel Filion --- manifests/apache.pp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'manifests') diff --git a/manifests/apache.pp b/manifests/apache.pp index 36994f8..a91fee9 100644 --- a/manifests/apache.pp +++ b/manifests/apache.pp @@ -1,4 +1,21 @@ class nagios::apache { $nagios_httpd = 'apache' include nagios + + case $operatingsystem { + 'debian': { + file { "${nagios::nagios_cfgdir}/apache2.conf": + ensure => present, + source => ["puppet:///site-nagios/configs/${fqdn}/apache2.conf", + "puppet:///site-nagios/configs/apache2.conf", + "puppet:///nagios/configs/apache2.conf"], + } + + apache::config::global { "nagios3.conf": + ensure => link, + target => "${nagios::nagios_cfgdir}/apache2.conf", + require => File["${nagios::nagios_cfgdir}/apache2.conf"], + } + } + } } -- cgit v1.2.3 From 7c9f6d224d9bf66bc1c69b1baa066f98b9302999 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Tue, 14 Dec 2010 15:14:54 -0500 Subject: Add nagios IRC bot Koumbit is using an IRC bot that Micah provided. It is a pair of perl scripts that send Nagios notifications as messages in an IRC channel. Add a class to make installing this IRC bot easy. It also defines commands 'notify-by-irc' and 'host-notify-by-irc' that can be used with checks to send notifications via the bot. Signed-off-by: Gabriel Filion --- manifests/irc_bot.pp | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 manifests/irc_bot.pp (limited to 'manifests') diff --git a/manifests/irc_bot.pp b/manifests/irc_bot.pp new file mode 100644 index 0000000..4092e67 --- /dev/null +++ b/manifests/irc_bot.pp @@ -0,0 +1,71 @@ +class nagios::irc_bot { + if ( ! ($nagios_nsa_server and $nagios_nsa_nickname and $nagios_nsa_channel) ) { + fail("Please provide values at least for \$nagios_nsa_server, \$nagios_nsa_nickname and \$nagios_nsa_channel") + } + + $nagios_nsa_socket = $nagios_nsa_socket ? { + '' => '/var/run/nagios3/nsa.socket', + default => $nagios_nsa_socket, + } + $nagios_nsa_pidfile = $nagios_nsa_pidfile ? { + '' => '/var/run/nagios3/nsa.pid', + default => $nagios_nsa_pidfile, + } + $nagios_nsa_port = $nagios_nsa_port ? { + '' => '6667', + default => $nagios_nsa_port, + } + $nagios_nsa_realname = $nagios_nsa_realname ? { + '' => 'Nagios', + default => $nagios_nsa_realname, + } + + if (! $nagios_nsa_password) { + $nagios_nsa_password = '' + } + + file { "/usr/local/bin/riseup-nagios-client.pl": + owner => root, group => root, mode => 0755, + source => "puppet:///modules/nagios/irc_bot/riseup-nagios-client.pl", + } + file { "/usr/local/bin/riseup-nagios-server.pl": + owner => root, group => root, mode => 0755, + source => "puppet:///modules/nagios/irc_bot/riseup-nagios-server.pl", + } + file { "/etc/init.d/nagios-nsa": + owner => root, group => root, mode => 0755, + content => template('nagios/irc_bot/nagios-nsa.sh.erb'), + require => File["/usr/local/bin/riseup-nagios-server.pl"], + } + file { "/etc/nagios_nsa.cfg": + ensure => present, + owner => nagios, group => root, mode => 0400, + content => template('nagios/irc_bot/nsa.cfg.erb'), + } + + package { "libnet-irc-perl": + ensure => present, + } + + exec { "nagios_nsa_init_script": + command => "/usr/sbin/update-rc.d nagios-nsa defaults", + unless => "/bin/ls /etc/rc3.d/ | /bin/grep nagios-nsa", + require => File["/etc/init.d/nagios-nsa"], + } + service { "nagios-nsa": + ensure => "running", + pattern => "riseup-nagios-server.pl", + hasstatus => true, + require => [File["/etc/nagios_nsa.cfg"], + Exec["nagios_nsa_init_script"], + Package["libnet-irc-perl"], + Service['nagios'] ], + } + + nagios_command { + "notify-by-irc": + command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($SERVICEDESC$) $NOTIFICATIONTYPE$ n.$SERVICEATTEMPT$ $SERVICESTATETYPE$ $SERVICEEXECUTIONTIME$s $SERVICELATENCY$s $SERVICEOUTPUT$ $SERVICEPERFDATA$"'; + "host-notify-by-irc": + command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($HOSTALIAS$) $NOTIFICATIONTYPE$ n.$HOSTATTEMPT$ $HOSTSTATETYPE$ took $HOSTEXECUTIONTIME$s $HOSTOUTPUT$ $HOSTPERFDATA$ $HOSTLATENCY$s"'; + } +} -- cgit v1.2.3 From 95ff26b01a6d3cfe58490d39a6abe0e4f20d3eab Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Fri, 14 Jan 2011 17:45:50 -0500 Subject: Add missing Nagios resource types to base.pp Some Nagios resource types are currently not being managed. This has the result that exported resources for those types are not collected by nagios servers, and also that configuration files for those resources are put in their default path which is wrong for some OSes and with possibly wrong permissions. Add the missing resources to base.pp Signed-off-by: Gabriel Filion --- manifests/base.pp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/base.pp b/manifests/base.pp index 6106ab2..a798bcd 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -73,10 +73,13 @@ class nagios::base { Nagios_contact <<||>> Nagios_contactgroup <<||>> Nagios_host <<||>> + Nagios_hostdependency <<||>> + Nagios_hostescalation <<||>> Nagios_hostextinfo <<||>> Nagios_hostgroup <<||>> Nagios_hostgroupescalation <<||>> Nagios_service <<||>> + Nagios_servicegroup <<||>> Nagios_servicedependency <<||>> Nagios_serviceescalation <<||>> Nagios_serviceextinfo <<||>> @@ -98,6 +101,14 @@ class nagios::base { target => "${nagios_cfgdir}/conf.d/nagios_host.cfg", notify => Service['nagios'], } + Nagios_hostdependency <||> { + target => "${nagios_cfgdir}/conf.d/nagios_hostdependency.cfg", + notify => Service['nagios'], + } + Nagios_hostescalation <||> { + target => "${nagios_cfgdir}/conf.d/nagios_hostescalation.cfg", + notify => Service['nagios'], + } Nagios_hostextinfo <||> { target => "${nagios_cfgdir}/conf.d/nagios_hostextinfo.cfg", notify => Service['nagios'], @@ -114,6 +125,10 @@ class nagios::base { target => "${nagios_cfgdir}/conf.d/nagios_service.cfg", notify => Service['nagios'], } + Nagios_servicegroup <||> { + target => "${nagios_cfgdir}/conf.d/nagios_servicegroup.cfg", + notify => Service['nagios'], + } Nagios_servicedependency <||> { target => "${nagios_cfgdir}/conf.d/nagios_servicedependency.cfg", notify => Service['nagios'], @@ -131,14 +146,17 @@ class nagios::base { notify => Service['nagios'], } - file{[ "${nagios_cfgdir}/conf.d/nagios_command.cfg", - "${nagios_cfgdir}/conf.d/nagios_contact.cfg", + file{[ "${nagios_cfgdir}/conf.d/nagios_command.cfg", + "${nagios_cfgdir}/conf.d/nagios_contact.cfg", "${nagios_cfgdir}/conf.d/nagios_contactgroup.cfg", "${nagios_cfgdir}/conf.d/nagios_host.cfg", + "${nagios_cfgdir}/conf.d/nagios_hostdependency.cfg", + "${nagios_cfgdir}/conf.d/nagios_hostescalation.cfg", "${nagios_cfgdir}/conf.d/nagios_hostextinfo.cfg", "${nagios_cfgdir}/conf.d/nagios_hostgroup.cfg", "${nagios_cfgdir}/conf.d/nagios_hostgroupescalation.cfg", "${nagios_cfgdir}/conf.d/nagios_service.cfg", + "${nagios_cfgdir}/conf.d/nagios_servicegroup.cfg", "${nagios_cfgdir}/conf.d/nagios_servicedependency.cfg", "${nagios_cfgdir}/conf.d/nagios_serviceescalation.cfg", "${nagios_cfgdir}/conf.d/nagios_serviceextinfo.cfg", -- cgit v1.2.3 From 256f04298f993dc2f5175def6904e1133b34bc0e Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Tue, 18 Jan 2011 17:03:18 -0500 Subject: nagios::service : Pass on contact_groups The contact_groups argument to nagios::service is currently not passed on to the exported nagios_service resource. Pass this value on so that services can notify the right people. Signed-off-by: Gabriel Filion --- manifests/service.pp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'manifests') diff --git a/manifests/service.pp b/manifests/service.pp index 3e732b7..ffbbc72 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -53,6 +53,10 @@ define nagios::service ( Nagios_service["${real_name}"] { notification_options => $notification_options } } + if ($contact_groups != '') { + Nagios_service["${real_name}"] { contact_groups => $contact_groups } + } + if ($use == 'absent') { Nagios_service["${real_name}"] { use => 'generic-service' } } else { -- cgit v1.2.3 From bb1538f0458ea3eb8641490ea83a12b96b7d2947 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 6 Feb 2011 22:01:05 +0100 Subject: remove nagios_plugin - rerrange collection * the type nagios_type have been removed and puppet fails to collect unknown types. This has already been removed once, but reintroduced with 4e35b0bce0f2dd00d52e0de7488ab322867dd012 -> reremove it again * To better compare existing types and what we have in the module, I arranged the collection alphabetically to ease comparision. --- manifests/base.pp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'manifests') diff --git a/manifests/base.pp b/manifests/base.pp index a32edcf..ffe8fa9 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -73,18 +73,17 @@ class nagios::base { } Package <<| tag == 'nagios::plugin::deploy::package' |>> File <<| tag == 'nagios::plugin::deploy::file' |>> - Nagios_plugin <<||>> Nagios_command <<||>> - Nagios_contact <<||>> Nagios_contactgroup <<||>> - Nagios_host <<||>> + Nagios_contact <<||>> + Nagios_hostgroupescalation <<||>> Nagios_hostextinfo <<||>> Nagios_hostgroup <<||>> - Nagios_hostgroupescalation <<||>> - Nagios_service <<||>> + Nagios_host <<||>> Nagios_servicedependency <<||>> Nagios_serviceescalation <<||>> Nagios_serviceextinfo <<||>> + Nagios_service <<||>> Nagios_timeperiod <<||>> File <<| tag == 'nagios_plugin' |>> -- cgit v1.2.3 From d1c614a5054c5260ac496316ca802a9246e1a491 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 6 Feb 2011 22:14:50 +0100 Subject: Nagios_hostgroupescalation does also not anymore exist --- manifests/base.pp | 1 - 1 file changed, 1 deletion(-) (limited to 'manifests') diff --git a/manifests/base.pp b/manifests/base.pp index ffe8fa9..89ab79f 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -76,7 +76,6 @@ class nagios::base { Nagios_command <<||>> Nagios_contactgroup <<||>> Nagios_contact <<||>> - Nagios_hostgroupescalation <<||>> Nagios_hostextinfo <<||>> Nagios_hostgroup <<||>> Nagios_host <<||>> -- cgit v1.2.3 From 66e38fc0d07d265929081779730c97c460bf0e5d Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 6 Feb 2011 22:18:15 +0100 Subject: and we need also to remove the overwrite --- manifests/base.pp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'manifests') diff --git a/manifests/base.pp b/manifests/base.pp index 89ab79f..88ac64c 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -116,11 +116,6 @@ class nagios::base { require => File['nagios_confd'], notify => Service['nagios'], } - Nagios_hostgroupescalation <||> { - target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_hostgroupescalation.cfg", - require => File['nagios_confd'], - notify => Service['nagios'], - } Nagios_service <||> { target => "${nagios::defaults::vars::int_nagios_cfgdir}/conf.d/nagios_service.cfg", require => File['nagios_confd'], -- cgit v1.2.3 From af846ae596b65be991b1648fcb3b8da02e9aeb1d Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 6 Feb 2011 23:58:46 +0100 Subject: centosify irc_bot --- manifests/irc_bot.pp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'manifests') diff --git a/manifests/irc_bot.pp b/manifests/irc_bot.pp index 4092e67..46cea0c 100644 --- a/manifests/irc_bot.pp +++ b/manifests/irc_bot.pp @@ -34,7 +34,7 @@ class nagios::irc_bot { } file { "/etc/init.d/nagios-nsa": owner => root, group => root, mode => 0755, - content => template('nagios/irc_bot/nagios-nsa.sh.erb'), + content => template("nagios/irc_bot/${operatingsystem}/nagios-nsa.sh.erb"), require => File["/usr/local/bin/riseup-nagios-server.pl"], } file { "/etc/nagios_nsa.cfg": @@ -47,21 +47,33 @@ class nagios::irc_bot { ensure => present, } - exec { "nagios_nsa_init_script": - command => "/usr/sbin/update-rc.d nagios-nsa defaults", - unless => "/bin/ls /etc/rc3.d/ | /bin/grep nagios-nsa", - require => File["/etc/init.d/nagios-nsa"], - } service { "nagios-nsa": ensure => "running", - pattern => "riseup-nagios-server.pl", hasstatus => true, require => [File["/etc/nagios_nsa.cfg"], - Exec["nagios_nsa_init_script"], Package["libnet-irc-perl"], Service['nagios'] ], } + case $operatingsystem { + centos: { + Package['libnet-irc-perl']{ + name => 'perl-Net-IRC', + } + Service['nagios-nsa']{ + enable => true, + } + } + debian,ubuntu: { + exec { "nagios_nsa_init_script": + command => "/usr/sbin/update-rc.d nagios-nsa defaults", + unless => "/bin/ls /etc/rc3.d/ | /bin/grep nagios-nsa", + require => File["/etc/init.d/nagios-nsa"], + before => Service['nagios-nsa'], + } + } + } + nagios_command { "notify-by-irc": command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($SERVICEDESC$) $NOTIFICATIONTYPE$ n.$SERVICEATTEMPT$ $SERVICESTATETYPE$ $SERVICEEXECUTIONTIME$s $SERVICELATENCY$s $SERVICEOUTPUT$ $SERVICEPERFDATA$"'; -- cgit v1.2.3 From 6e520987ac41ef144f236c05b8095f285251471b Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 7 Feb 2011 00:36:10 +0100 Subject: fix pid/socket location for centos, open firewall if we want to connect to an irc server --- manifests/irc_bot.pp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/irc_bot.pp b/manifests/irc_bot.pp index 46cea0c..760abd0 100644 --- a/manifests/irc_bot.pp +++ b/manifests/irc_bot.pp @@ -4,11 +4,17 @@ class nagios::irc_bot { } $nagios_nsa_socket = $nagios_nsa_socket ? { - '' => '/var/run/nagios3/nsa.socket', + '' => $operatingsystem ? { + centos => '/var/run/nagios-nsa/nsa.socket', + default => '/var/run/nagios3/nsa.socket' + }, default => $nagios_nsa_socket, } $nagios_nsa_pidfile = $nagios_nsa_pidfile ? { - '' => '/var/run/nagios3/nsa.pid', + '' => $operatingsystem ? { + centos => '/var/run/nagios-nsa/nsa.socket', + default => '/var/run/nagios3/nsa.pid' + }, default => $nagios_nsa_pidfile, } $nagios_nsa_port = $nagios_nsa_port ? { @@ -80,4 +86,8 @@ class nagios::irc_bot { "host-notify-by-irc": command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($HOSTALIAS$) $NOTIFICATIONTYPE$ n.$HOSTATTEMPT$ $HOSTSTATETYPE$ took $HOSTEXECUTIONTIME$s $HOSTOUTPUT$ $HOSTPERFDATA$ $HOSTLATENCY$s"'; } + + if $use_shorewall { + include shorewall::rules::out::irc + } } -- cgit v1.2.3 From 85e6650451538486bd72b1206caf898d573ba987 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 7 Feb 2011 01:00:15 +0100 Subject: fix naming --- manifests/irc_bot.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/irc_bot.pp b/manifests/irc_bot.pp index 760abd0..961755a 100644 --- a/manifests/irc_bot.pp +++ b/manifests/irc_bot.pp @@ -12,7 +12,7 @@ class nagios::irc_bot { } $nagios_nsa_pidfile = $nagios_nsa_pidfile ? { '' => $operatingsystem ? { - centos => '/var/run/nagios-nsa/nsa.socket', + centos => '/var/run/nagios-nsa/nsa.pid', default => '/var/run/nagios3/nsa.pid' }, default => $nagios_nsa_pidfile, -- cgit v1.2.3 From 1c4844d696b7ab50b8e1337d6d294e75b73189b2 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 7 Feb 2011 01:31:50 +0100 Subject: fix mail cmd on centos --- manifests/defaults/commands.pp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'manifests') diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index 933f3b9..3c6bc9c 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -118,12 +118,16 @@ class nagios::defaults::commands { # notification commands + $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$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$'; + 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$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$' - + 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$"; } } -- cgit v1.2.3 From 21a7b14d884501e6bc649ff5bf9f17941a80a3dd Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 7 Feb 2011 01:47:09 +0100 Subject: escape new line as we have now double brackets --- manifests/defaults/commands.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index 3c6bc9c..e74368d 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -125,9 +125,9 @@ class nagios::defaults::commands { 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$"; + 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$"; + 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$"; } } -- cgit v1.2.3 From 1d9eeaba5f14172a685e3c1c34c0f7b4fd45ce34 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 7 Feb 2011 02:04:17 +0100 Subject: we need also to escape the $ --- manifests/defaults/commands.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index e74368d..f542d7b 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -125,9 +125,9 @@ class nagios::defaults::commands { 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$"; + 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$"; + 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\$"; } } -- cgit v1.2.3 From 7b91e8e32fe337dae802cf9d6cbaa4092ae497ac Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 19 Feb 2011 17:08:19 +0100 Subject: rearrange some variable setting --- manifests/service.pp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'manifests') diff --git a/manifests/service.pp b/manifests/service.pp index ffbbc72..afc8650 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -10,7 +10,7 @@ define nagios::service ( $notification_period = '', $notification_options = '', $contact_groups = '', - $use = 'absent', + $use = 'generic-service', $service_description = 'absent' ) { @@ -22,7 +22,12 @@ define nagios::service ( ensure => $ensure, check_command => $check_command, host_name => $host_name, + use => $use, notify => Service[nagios], + service_description => $service_description ?{ + 'absent' => $name, + default => $service_description + } } if ($check_period != '') { @@ -56,18 +61,5 @@ define nagios::service ( if ($contact_groups != '') { Nagios_service["${real_name}"] { contact_groups => $contact_groups } } - - if ($use == 'absent') { - Nagios_service["${real_name}"] { use => 'generic-service' } - } else { - Nagios_service["${real_name}"] { use => $use } - } - - if ($service_description == 'absent') { - Nagios_service["${real_name}"] { service_description => $name } - } else { - Nagios_service["${real_name}"] { service_description => $service_description } - } - } -- cgit v1.2.3 From 838e27b934513306aed5ba15bdcc445d6e5e845c Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 19 Feb 2011 17:08:32 +0100 Subject: allow setting of the template to be used --- manifests/service/http.pp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'manifests') diff --git a/manifests/service/http.pp b/manifests/service/http.pp index 5fd9890..8fd5059 100644 --- a/manifests/service/http.pp +++ b/manifests/service/http.pp @@ -8,6 +8,7 @@ define nagios::service::http( $check_domain = 'absent', $check_url = '/', $check_code = 'OK', + $use = 'generic-service', $ssl_mode = false ){ $real_check_domain = $check_domain ? { @@ -18,12 +19,14 @@ define nagios::service::http( 'force',true,'only': { nagios::service{"https_${name}_${check_code}": ensure => $ensure, + use => $use, check_command => "check_https_url_regex!${real_check_domain}!${check_url}!'${check_code}'", } case $ssl_mode { 'force': { nagios::service{"httprd_${name}": ensure => $ensure, + use => $use, check_command => "check_http_url_regex!${real_check_domain}!${check_url}!'301'", } } @@ -34,6 +37,7 @@ define nagios::service::http( false,true: { nagios::service{"http_${name}_${check_code}": ensure => $ensure, + use => $use, check_command => "check_http_url_regex!${real_check_domain}!${check_url}!'${check_code}'", } } -- cgit v1.2.3 From 7ceac56787ab3130024ad4a8e4cec05a8ec533fb Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 6 Mar 2011 18:00:30 +0100 Subject: add and deploy check_dnsbl script --- manifests/defaults/plugins.pp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'manifests') diff --git a/manifests/defaults/plugins.pp b/manifests/defaults/plugins.pp index 842f9ce..18f8161 100644 --- a/manifests/defaults/plugins.pp +++ b/manifests/defaults/plugins.pp @@ -5,6 +5,8 @@ class nagios::defaults::plugins { source => 'nagios/plugins/check_mysql_health'; 'check_dns2': source => 'nagios/plugins/check_dns2'; + 'check_dnsbl': + source => 'nagios/plugins/check_dnsbl'; } } -- cgit v1.2.3 From f2df62c9d17d481a3d616a4f2de9496638fadc0a Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 6 Mar 2011 18:12:14 +0100 Subject: add dnsbl check command --- manifests/defaults/commands.pp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'manifests') diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index f542d7b..17d1408 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -114,6 +114,10 @@ class nagios::defaults::commands { # 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 -- cgit v1.2.3