summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README5
-rw-r--r--files/irc_bot/riseup-nagios-server.pl6
-rw-r--r--manifests/irc_bot.pp4
-rw-r--r--templates/irc_bot/nsa.cfg.erb19
4 files changed, 24 insertions, 10 deletions
diff --git a/README b/README
index 4ca4c3e..167b7aa 100644
--- a/README
+++ b/README
@@ -163,6 +163,11 @@ Options to change the behavior of the nagios module:
- nagios_nsa_realname: The IRC bot user's real name that will be displayed. By
default, the real name is 'Nagios'.
+- nagios_nsa_usenotices: The IRC bot will by default "say" to the channel the
+ nagios message, but you can switch this variable to
+ 'notice' if you would prefer them to be sent as IRC
+ NOTICE messages.
+
Examples
========
diff --git a/files/irc_bot/riseup-nagios-server.pl b/files/irc_bot/riseup-nagios-server.pl
index 7880dde..b69ecab 100644
--- a/files/irc_bot/riseup-nagios-server.pl
+++ b/files/irc_bot/riseup-nagios-server.pl
@@ -101,7 +101,11 @@ sub socket_has_data {
my $self = shift;
$self->{socket}->recv(my $data, 1024);
- $self->{conn}->privmsg($CFG::Nsa{'channel'}, $data);
+ if ($CFG::Nsa{'usenotices'} {
+ $self->{conn}->notice($CFG::Nsa{'channel'}, $data);
+ } else {
+ $self->{conn}->privmsg($CFG::Nsa{'channel'}, $data);
+ }
}
sub irc_on_connect {
diff --git a/manifests/irc_bot.pp b/manifests/irc_bot.pp
index 31d7add..130f46f 100644
--- a/manifests/irc_bot.pp
+++ b/manifests/irc_bot.pp
@@ -30,6 +30,10 @@ class nagios::irc_bot {
$nagios_nsa_password = ''
}
+ if (! $nagios_nsa_usenotices) {
+ $nagios_nsa_usenotices = ''
+ }
+
file { "/usr/local/bin/riseup-nagios-client.pl":
owner => root, group => root, mode => 0755,
source => "puppet:///modules/nagios/irc_bot/riseup-nagios-client.pl",
diff --git a/templates/irc_bot/nsa.cfg.erb b/templates/irc_bot/nsa.cfg.erb
index 7cba62c..6abb16d 100644
--- a/templates/irc_bot/nsa.cfg.erb
+++ b/templates/irc_bot/nsa.cfg.erb
@@ -1,13 +1,14 @@
%Nsa = (
- 'socket' => '<%= nagios_nsa_socket %>',
- 'server' => '<%= nagios_nsa_server %>',
- 'port' => '<%= nagios_nsa_port %>',
- 'nickname' => '<%= nagios_nsa_nickname %>',
- 'password' => '<%= nagios_nsa_password %>',
+ 'socket' => '<%= nagios_nsa_socket %>',
+ 'server' => '<%= nagios_nsa_server %>',
+ 'port' => '<%= nagios_nsa_port %>',
+ 'nickname' => '<%= nagios_nsa_nickname %>',
+ 'password' => '<%= nagios_nsa_password %>',
# this needs libio-socket-ssl-perl
# doesn't actually works because Net::IRC is braindead and tries to use IO::Socket::SSL->read/write instead of the builtin print, see http://search.cpan.org/dist/IO-Socket-SSL/SSL.pm
- #'SSL' => 0,
- 'channel' => '<%= nagios_nsa_channel %>',
- 'pidfile' => '<%= nagios_nsa_pidfile %>', # set to undef to disable
- 'realname' => "<%= nagios_nsa_realname %>",
+ #'SSL' => 0,
+ 'channel' => '<%= nagios_nsa_channel %>',
+ 'pidfile' => '<%= nagios_nsa_pidfile %>', # set to undef to disable
+ 'realname' => "<%= nagios_nsa_realname %>",
+ 'messagetype' => "<%= nagios_nsa_usenotices %>",
);