diff options
author | Micah Anderson <micah@riseup.net> | 2011-07-14 17:55:33 -0400 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2011-07-14 17:55:33 -0400 |
commit | 6ad1e288af0f8b6691aa6b57b2b23c44b06d4165 (patch) | |
tree | 3a127ba89ab98012ffc154380978389eedf3b2fd /manifests/irc_bot | |
parent | b0ca021364957715bb608d25ad47baed568f078a (diff) | |
parent | db9b47560068218125cfb82b0a19a491cffba002 (diff) |
Merge remote-tracking branch 'remotes/lelutin/bot_fixes'
Conflicts:
manifests/irc_bot.pp
Had to merge in the use_notices change that we had in our branch
Diffstat (limited to 'manifests/irc_bot')
-rw-r--r-- | manifests/irc_bot/base.pp | 69 | ||||
-rw-r--r-- | manifests/irc_bot/centos.pp | 7 | ||||
-rw-r--r-- | manifests/irc_bot/disable.pp | 8 |
3 files changed, 84 insertions, 0 deletions
diff --git a/manifests/irc_bot/base.pp b/manifests/irc_bot/base.pp new file mode 100644 index 0000000..c36d8e6 --- /dev/null +++ b/manifests/irc_bot/base.pp @@ -0,0 +1,69 @@ +class nagios::irc_bot::base { + + # Default values for the two first variables are defined in nagios::irc_bot + $nagios_nsa_socket = $nagios_nsa_socket ? { + '' => $nagios_nsa_default_socket, + default => $nagios_nsa_socket, + } + $nagios_nsa_pidfile = $nagios_nsa_pidfile ? { + '' => $nagios_nsa_default_pidfile, + 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 = '' + } + + 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", + } + file { "/usr/local/bin/riseup-nagios-server.pl": + owner => root, group => 0, mode => 0755, + source => "puppet:///modules/nagios/irc_bot/riseup-nagios-server.pl", + } + file { "/etc/init.d/nagios-nsa": + owner => root, group => 0, mode => 0755, + content => template("nagios/irc_bot/${operatingsystem}/nagios-nsa.sh.erb"), + require => File["/usr/local/bin/riseup-nagios-server.pl"], + } + file { "/etc/nagios_nsa.cfg": + ensure => present, + owner => nagios, group => 0, mode => 0400, + content => template('nagios/irc_bot/nsa.cfg.erb'), + notify => Service["nagios-nsa"], + } + + package { "libnet-irc-perl": + ensure => present, + } + + service { "nagios-nsa": + ensure => "running", + hasstatus => true, + enable => true, + require => [File["/etc/nagios_nsa.cfg"], + File["/etc/init.d/nagios-nsa"], + Package["libnet-irc-perl"], + Service['nagios'] ], + } + + nagios_command { + "notify-by-irc": + command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($SERVICEDESC$) $NOTIFICATIONTYPE$ $SERVICEATTEMPT$/$MAXSERVICEATTEMPTS$ $SERVICESTATETYPE$ $SERVICEEXECUTIONTIME$s $SERVICELATENCY$s $SERVICEOUTPUT$ $SERVICEPERFDATA$"'; + "host-notify-by-irc": + command_line => '/usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($HOSTALIAS$) $NOTIFICATIONTYPE$ $HOSTATTEMPT$/$MAXHOSTATTEMPTS$ $HOSTSTATETYPE$ took $HOSTEXECUTIONTIME$s $HOSTOUTPUT$ $HOSTPERFDATA$ $HOSTLATENCY$s"'; + } +} diff --git a/manifests/irc_bot/centos.pp b/manifests/irc_bot/centos.pp new file mode 100644 index 0000000..e77e93a --- /dev/null +++ b/manifests/irc_bot/centos.pp @@ -0,0 +1,7 @@ +class nagios::irc_bot::centos inherits nagios::irc_bot::base { + + Package['libnet-irc-perl']{ + name => 'perl-Net-IRC', + } + +} diff --git a/manifests/irc_bot/disable.pp b/manifests/irc_bot/disable.pp new file mode 100644 index 0000000..d6b7c55 --- /dev/null +++ b/manifests/irc_bot/disable.pp @@ -0,0 +1,8 @@ +class nagios::irc_bot::disable inherits nagios::irc_bot::base { + + Service['nagios-nsa'] { + ensure => stopped, + enable => false, + } + +} |