diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/defaults/commands.pp | 14 | ||||
-rw-r--r-- | manifests/defaults/plugins.pp | 2 | ||||
-rw-r--r-- | manifests/irc_bot.pp | 34 | ||||
-rw-r--r-- | manifests/irc_bot/base.pp | 4 | ||||
-rw-r--r-- | manifests/service/imap.pp | 32 | ||||
-rw-r--r-- | manifests/service/mysql.pp | 14 | ||||
-rw-r--r-- | manifests/service/pop.pp | 32 |
7 files changed, 113 insertions, 19 deletions
diff --git a/manifests/defaults/commands.pp b/manifests/defaults/commands.pp index f542d7b..f5fface 100644 --- a/manifests/defaults/commands.pp +++ b/manifests/defaults/commands.pp @@ -6,6 +6,12 @@ class nagios::defaults::commands { # common service commands case $operatingsystem { debian,ubuntu: { + # debian and ubuntu ship the nagios::command::smtp and + # nagios::command::imap_pop3 commands in the nagios-plugins packages, + # which are placed in /etc/nagios-plugins/config/mail.cfg, however they + # are inferior to the ones provided in this module below because they do + # not provide port options, so we just remove them + file { '/etc/nagios-plugins/config/mail.cfg': ensure => absent; } nagios_command { check_dummy: command_line => '$USER1$/check_dummy $ARG1$'; @@ -29,6 +35,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'; } } default: { @@ -109,11 +117,15 @@ 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$'; + 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$'; + + # dnsbl checking + check_dnsbl: + command_line => '$USER1$/check_dnsbl -H $ARG1$'; } # notification commands 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'; } } diff --git a/manifests/irc_bot.pp b/manifests/irc_bot.pp index 59f7ed4..7629b94 100644 --- a/manifests/irc_bot.pp +++ b/manifests/irc_bot.pp @@ -1,22 +1,22 @@ 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") - } + 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") + } - case $operatingsystem { - centos: { - $nagios_nsa_default_socket = '/var/run/nagios-nsa/nsa.socket' - $nagios_nsa_default_pidfile = '/var/run/nagios-nsa/nsa.pid' - include nagios::irc_bot::centos - } - default: { - $nagios_nsa_default_socket = '/var/run/nagios3/nsa.socket' - $nagios_nsa_default_pidfile = '/var/run/nagios3/nsa.pid' - include nagios::irc_bot::base - } + case $operatingsystem { + centos: { + $nagios_nsa_default_socket = '/var/run/nagios-nsa/nsa.socket' + $nagios_nsa_default_pidfile = '/var/run/nagios-nsa/nsa.pid' + include nagios::irc_bot::centos } - - if $use_shorewall { - include shorewall::rules::out::irc + default: { + $nagios_nsa_default_socket = '/var/run/nagios3/nsa.socket' + $nagios_nsa_default_pidfile = '/var/run/nagios3/nsa.pid' + include nagios::irc_bot::base } + } + + if $use_shorewall { + include shorewall::rules::out::irc + } } diff --git a/manifests/irc_bot/base.pp b/manifests/irc_bot/base.pp index 2c9b27b..c36d8e6 100644 --- a/manifests/irc_bot/base.pp +++ b/manifests/irc_bot/base.pp @@ -22,6 +22,10 @@ class nagios::irc_bot::base { $nagios_nsa_password = '' } + if (! $nagios_nsa_usenotices) { + $nagios_nsa_usenotices = '' + } + file { "/usr/local/bin/riseup-nagios-client.pl": owner => root, group => 0, mode => 0755, source => "puppet:///modules/nagios/irc_bot/riseup-nagios-client.pl", diff --git a/manifests/service/imap.pp b/manifests/service/imap.pp new file mode 100644 index 0000000..b703db4 --- /dev/null +++ b/manifests/service/imap.pp @@ -0,0 +1,32 @@ +define nagios::service::imap( + $ensure = 'present', + $host = 'absent', + $port = '143', + $tls = true, + $tls_port = '993' +){ + + $real_host = $host ? { + 'absent' => $name, + default => $host + } + + nagios::service{ + "imap_${name}_${port}": + ensure => $ensure; + "imaps_${name}_${tls_port}": + ensure => $tls ? { + true => $ensure, + default => 'absent' + }; + } + + if $ensure != 'absent' { + Nagios::Service["imap_${name}_${port}"]{ + check_command => "check_imap!${real_host}!${port}", + } + Nagios::Service["imaps_${name}_${tls_port}"]{ + check_command => "check_imap_ssl!${real_host}!${tls_port}", + } + } +} diff --git a/manifests/service/mysql.pp b/manifests/service/mysql.pp index d501f06..2fde402 100644 --- a/manifests/service/mysql.pp +++ b/manifests/service/mysql.pp @@ -20,7 +20,19 @@ define nagios::service::mysql( if ($check_host == 'absent') { fail("Please specify a hostname, ip address or socket to check a mysql instance.") } + + if $check_name != undef { + $real_check_name = "!--name $check_name" + } + if $check_warning != undef { + $real_check_warning = "!--warning $check_warning" + } + + if $check_critical != undef { + $real_check_critical = "!--critical $check_critical" + } + case $check_mode { 'tcp': { if ($check_host == 'localhost') { @@ -42,6 +54,6 @@ define nagios::service::mysql( nagios::service { "mysql_health_${name}": ensure => $ensure, - check_command => "check_mysql_health!${check_host}!${check_port}!${check_username}!${check_password}!${name}!${check_database}", + check_command => "check_mysql_health!${real_check_host}!${check_port}!${check_username}!${check_password}!${check_health_mode}!${check_database}${real_check_name}${real_check_warning}${real_check_critical}", } } diff --git a/manifests/service/pop.pp b/manifests/service/pop.pp new file mode 100644 index 0000000..9ec4aec --- /dev/null +++ b/manifests/service/pop.pp @@ -0,0 +1,32 @@ +define nagios::service::pop( + $ensure = 'present', + $host = 'absent', + $port = '110', + $tls = true, + $tls_port = '995' +){ + + $real_host = $host ? { + 'absent' => $name, + default => $host + } + + nagios::service{ + "pop_${name}_${port}": + ensure => $ensure; + "pops_${name}_${tls_port}": + ensure => $tls ? { + true => $ensure, + default => 'absent' + }; + } + + if $ensure != 'absent' { + Nagios::Service["pop_${name}_${port}"]{ + check_command => "check_pop3!${real_host}!${port}", + } + Nagios::Service["pops_${name}_${tls_port}"]{ + check_command => "check_pop3_ssl!${real_host}!${tls_port}", + } + } +} |