diff options
author | Micah Anderson <micah@riseup.net> | 2013-01-23 11:44:05 -0500 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2013-01-23 11:44:05 -0500 |
commit | 08c3aa9aaf2cc90cfdee2c8191d83f9cede4bf39 (patch) | |
tree | c29ec1e86efd6eaa84520b37613d847855cedfe2 /manifests/irc_bot | |
parent | 3a1ebac1ed5c34df90bd174f0f269f2f7ac62974 (diff) | |
parent | 8fd89115cc15295e20234578b45fdecc8bcf1c70 (diff) |
Merge remote-tracking branch 'shared/master'
Conflicts:
README
manifests/irc_bot.pp
manifests/irc_bot/base.pp
templates/irc_bot/nsa.cfg.erb
Diffstat (limited to 'manifests/irc_bot')
-rw-r--r-- | manifests/irc_bot/base.pp | 94 | ||||
-rw-r--r-- | manifests/irc_bot/centos.pp | 10 | ||||
-rw-r--r-- | manifests/irc_bot/debian.pp | 8 |
3 files changed, 47 insertions, 65 deletions
diff --git a/manifests/irc_bot/base.pp b/manifests/irc_bot/base.pp index 6fab2ac..fff9da4 100644 --- a/manifests/irc_bot/base.pp +++ b/manifests/irc_bot/base.pp @@ -1,69 +1,41 @@ class nagios::irc_bot::base { + file { + '/usr/local/bin/riseup-nagios-client.pl': + source => 'puppet:///modules/nagios/irc_bot/riseup-nagios-client.pl', + owner => root, group => 0, mode => '0755'; - # Default values for the two first variables are defined in nagios::irc_bot - $nsa_socket = $nsa_socket ? { - '' => $nsa_default_socket, - default => $nsa_socket, - } - $nsa_pidfile = $nsa_pidfile ? { - '' => $nsa_default_pidfile, - default => $nsa_pidfile, - } - $nsa_port = $nsa_port ? { - '' => '6667', - default => $nsa_port, - } - $nsa_realname = $nsa_realname ? { - '' => 'Nagios', - default => $nsa_realname, - } + '/usr/local/bin/riseup-nagios-server.pl': + source => 'puppet:///modules/nagios/irc_bot/riseup-nagios-server.pl', + owner => root, group => 0, mode => '0755'; - if (! $nsa_password) { - $nsa_password = '' - } + '/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 => 0, mode => '0755'; - if (! $nsa_usenotices) { - $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"], - } + '/etc/nagios_nsa.cfg': + ensure => present, + content => template('nagios/irc_bot/nsa.cfg.erb'), + owner => nagios, group => 0, mode => '0400', + notify => Service['nagios-nsa']; + } - package { "libnet-irc-perl": - ensure => present, - } + 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'] ], - } + service { 'nagios-nsa': + ensure => 'running', + hasstatus => true, + require => [ File['/etc/nagios_nsa.cfg'], + 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"'; - } + 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"'; + } } diff --git a/manifests/irc_bot/centos.pp b/manifests/irc_bot/centos.pp index e77e93a..d7b1906 100644 --- a/manifests/irc_bot/centos.pp +++ b/manifests/irc_bot/centos.pp @@ -1,7 +1,9 @@ class nagios::irc_bot::centos inherits nagios::irc_bot::base { + Package['libnet-irc-perl']{ + name => 'perl-Net-IRC', + } - Package['libnet-irc-perl']{ - name => 'perl-Net-IRC', - } - + Service['nagios-nsa']{ + enable => true, + } } diff --git a/manifests/irc_bot/debian.pp b/manifests/irc_bot/debian.pp new file mode 100644 index 0000000..93ea64b --- /dev/null +++ b/manifests/irc_bot/debian.pp @@ -0,0 +1,8 @@ +class nagios::irc_bot::debian inherits nagios::irc_bot::base { + 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'], + } +} |