diff options
Diffstat (limited to 'manifests/irc_bot.pp')
-rw-r--r-- | manifests/irc_bot.pp | 65 |
1 files changed, 16 insertions, 49 deletions
diff --git a/manifests/irc_bot.pp b/manifests/irc_bot.pp index 77c5fa8..88d769c 100644 --- a/manifests/irc_bot.pp +++ b/manifests/irc_bot.pp @@ -1,3 +1,4 @@ +<<<<<<< HEAD class nagios::irc_bot( $nsa_socket = 'absent', $nsa_server, @@ -6,7 +7,9 @@ class nagios::irc_bot( $nsa_password = '', $nsa_channel, $nsa_pidfile = 'absent', - $nsa_realname = 'Nagios' + $nsa_realname = 'Nagios', + $nsa_usenotices = false, + $nsa_commandfile = 'absent' ) { $real_nsa_socket = $nsa_socket ? { 'absent' => $::operatingsystem ? { @@ -15,67 +18,31 @@ class nagios::irc_bot( }, default => $nsa_socket, } - $real__nsa_pidfile = $nsa_pidfile ? { + $real_nsa_pidfile = $nsa_pidfile ? { 'absent' => $::operatingsystem ? { centos => '/var/run/nagios-nsa/nsa.pid', default => '/var/run/nagios3/nsa.pid' }, default => $nsa_pidfile, } - - file { - '/usr/local/bin/riseup-nagios-client.pl': - source => 'puppet:///modules/nagios/irc_bot/riseup-nagios-client.pl', - owner => root, group => root, mode => 0755; - '/usr/local/bin/riseup-nagios-server.pl': - source => 'puppet:///modules/nagios/irc_bot/riseup-nagios-server.pl', - owner => root, group => root, mode => 0755; - '/etc/init.d/nagios-nsa': - content => template("nagios/irc_bot/${::operatingsystem}/nagios-nsa.sh.erb"), - require => File['/usr/local/bin/riseup-nagios-server.pl'], - owner => root, group => root, mode => 0755; - '/etc/nagios_nsa.cfg': - ensure => present, - content => template('nagios/irc_bot/nsa.cfg.erb'), - owner => nagios, group => root, mode => 0400; - } - - package { 'libnet-irc-perl': - ensure => present, - } - - service { "nagios-nsa": - ensure => "running", - hasstatus => true, - require => [ File["/etc/nagios_nsa.cfg"], - Package["libnet-irc-perl"], - Service['nagios'] ], + $real_nsa_commandfile = $nsa_commandfile ? { + 'absent' => $::operatingsystem ? { + centos => '/var/spool/nagios/cmd/nagios.cmd', + default => '/var/lib/nagios3/rw/nagios.cmd' + }, + default => $nsa_commandfile, } case $::operatingsystem { centos: { - Package['libnet-irc-perl']{ - name => 'perl-Net-IRC', - } - Service['nagios-nsa']{ - enable => true, - } + include nagios::irc_bot::centos } 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'], - } + include nagios::irc_bot::debian + } + default: { + include nagios::irc_bot::base } - } - - 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"'; } if $nagios::manage_shorewall { |