summaryrefslogtreecommitdiff
path: root/manifests/irc_bot.pp
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2012-06-05 19:34:51 -0300
committermh <mh@immerda.ch>2012-06-05 19:34:51 -0300
commit0fe7552f256f0b1508cc5d3cab952eb93bee6811 (patch)
tree9769eab5ea4b9bf6f49c2c11d9a9b9e1736361c9 /manifests/irc_bot.pp
parent3db1ca8f85b28978a3a9c09de3551f536b1375a6 (diff)
new style for 2.7
Diffstat (limited to 'manifests/irc_bot.pp')
-rw-r--r--manifests/irc_bot.pp45
1 files changed, 19 insertions, 26 deletions
diff --git a/manifests/irc_bot.pp b/manifests/irc_bot.pp
index fc47884..5d684f8 100644
--- a/manifests/irc_bot.pp
+++ b/manifests/irc_bot.pp
@@ -1,33 +1,26 @@
-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 ? {
- '' => $::operatingsystem ? {
+class nagios::irc_bot(
+ $nsa_socket = hiera('nagios_nsa_socket','absent'),
+ $nsa_server = hiera('nagios_nsa_server'),
+ $nsa_port = hiera('nagios_nsa_port',6667),
+ $nsa_nickname = hiera('nagios_nsa_nickname'),
+ $nsa_password = hiera('nagios_nsa_password',''),
+ $nsa_channel = hiera('nagios_nsa_channel'),
+ $nsa_pidfile = hiera('nagios_nsa_pidfile','absent'),
+ $nsa_realname = hiera('nagios_nsa_realname','Nagios')
+) {
+ $real_nsa_socket = $nsa_socket ? {
+ 'absent' => $::operatingsystem ? {
centos => '/var/run/nagios-nsa/nsa.socket',
default => '/var/run/nagios3/nsa.socket'
},
- default => $nagios_nsa_socket,
+ default => $nsa_socket,
}
- $nagios_nsa_pidfile = $nagios_nsa_pidfile ? {
- '' => $::operatingsystem ? {
+ $real__nsa_pidfile = $nsa_pidfile ? {
+ 'absent' => $::operatingsystem ? {
centos => '/var/run/nagios-nsa/nsa.pid',
default => '/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 = ''
+ default => $nsa_pidfile,
}
file { "/usr/local/bin/riseup-nagios-client.pl":
@@ -64,12 +57,12 @@ class nagios::irc_bot {
case $::operatingsystem {
centos: {
Package['libnet-irc-perl']{
- name => 'perl-Net-IRC',
+ 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",
@@ -87,7 +80,7 @@ class nagios::irc_bot {
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 {
+ if hiera('use_shorewall',false) {
include shorewall::rules::out::irc
}
}