123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626 |
- #!/usr/bin/perl
- # What this script does :
- # -----------------------
- # 1/ check nagios.log
- # 2/ setup an array of alerts
- # 3/ ability to remove-change alerts on new notification for same host/[service]
- # 4/ dialog with livestatus to replay full alerts on load/setup : irssi command /nagrefresh
- # 5/ define !recheck to nagios
- # 6/ ability to define chan/server on irssi configuration instead of bot config.
- #
- # What it should do :
- # -------------------
- # TODO
- # define !ack irc command
- # use %ACK_INDEX by alert type HOST / SERVICE
- # use %ACK_INDEX_LEVEL by alert type CRIT/UP/DOWN/WARN/UNK…
- use strict;
- use vars qw($VERSION %IRSSI);
- use Irssi;
- use POSIX "sys_wait_h";
- use POSIX qw(strftime);
- use Term::ANSIColor qw/ :constants /;
- use Fcntl; # provides `O_NONBLOCK' and `O_RDONLY' constants
- ##########################################################################
- # Part A : script configuration / Prototypes
- # Put signals to irssi ###################################################
- our ( $FIFO, # fifo absolute filename (expanded from Irssi config)
- $FIFO_HANDLE, # fifo filehandle for `open' et al.
- $FIFO_TAG ); # fifo signal tag for `input_add'
- $VERSION = "0.3.0";
- %IRSSI = (
- authors => 'asr',
- contact => 'root@lautre.net',
- name => 'nagios-ack',
- description => 'ack nagios alerts in irc / follow nagios log',
- license => 'GPLv2',
- url => 'http://www.lautre.net/',
- changed => '20141006',
- modules => ''
- );
- # Put signals to irssi ###################################################
- Irssi::settings_add_str($IRSSI{name}, # default fifo_remote_file
- 'fifo_remote_file', '/home/tc-14/var/nagios-fifo'); #
- Irssi::settings_add_str("nagios_ack", "nagios_ack_channel", "#main_channel"); # see also etc/config.template
- Irssi::settings_add_str("nagios_ack", "nagios_ack_nick", ""); # any user (none by default)
- Irssi::settings_add_str("nagios_ack", "nagios_command", "/var/lib/nagios3/rw/live");
- #Irssi::command_bind( 'ack', \&nagios_ack );
- #Irssi::command_bind( 'nagstat', \&nagios_status );
- Irssi::command_bind( 'nagrefresh', \&nagios_query_status );
- # CONFIG: point this where your Nagios configuration files live
- #my $nagioslog = "/var/log/nagios3/nagios.log";
- # To be used to check immediately / hosts-stats
- my $nagioscmd = Irssi::settings_get_str("nagios_command");
- my $nagios_ack_channel= Irssi::settings_get_str("nagios_ack_channel");
- my $nagios_ack_nick= Irssi::settings_get_str("nagios_ack_nick");
- my %renot; # { "host" or "host:service" => time_last_notification }
- my @cmdqueue = ();
- my %ignore = ();
- my @ACKS;
- my %ACK_Ind;
- my %C = (
- K => "\x0301", # 00. White
- B => "\x0302", # 01. Black
- G => "\x0303", # 02. Blue (Navy)
- R => "\x0304", # 03. Green
- # 04. Red
- V => "\x0306", # 05. Brown (Maroon)
- O => "\x0307", # 06. Purple
- Y => "\x0308", # 07. Orange
- Gg => "\x0309", # 08. Yellow
- # 09. Light Green (Lime)
- C => "\x0311", # 10. Teal (Green/Blue Cyan)
- Bb => "\x0312", # 11. Light Cyan (Cyan) (Aqua)
- Ma => "\x0313", # 12. Light Blue (Royal)
- Gr => "\x0314", # 13. Pink (Light Purple) (Fuchsia)
- W => "\x0315", # 14. Grey
- # 15. Light Grey (Silver)
- Z => "\x03",
- );
- # Numeric to string conversion of nagios status
- # 0..4 : hosts
- # 10..14 : services
- my @NagStates = qw/UP DOWN WARNING UNKNOWN .. .. .. .. .. ..
- OK WARNING CRITICAL UNKNOWN/;
- # Bold: U+0002 ("0x02") — Example: ^Bold Text^ whereas ^ represents the control character.
- # Italics: U+001D ("0x1D") — Example: ^Italicized Text^ whereas ^ represents the control character.
- # Underline: U+001F ("0x1F") — Example: ^Underlined Text^ whereas ^ represents the control character.
- # The control character used for color is U+0003 ("0x03").
- my $state_to_color = {
- OK => $C{G},
- UP => $C{G},
- WARNING => $C{Y},
- CRITICAL => $C{R},
- DOWN => $C{V},
- UNKNOWN => $C{Gr},
- };
- # Global use to limit memory use. Probably a bad idea : better to check
- # where is the memory leak.
- my ($status_line);
- my @match;
- my ($msg,$num);
- my ($message,$i);
- my ($type,$data);
- my ($d,$type,$host,$service,$state,$output);
- my ( $host, $svc, $state, $msg, $id );
- my ($server, $msg, $nick, $addr, $target);
- my ( $param, $server, $window );
- my (@issue, $issue);
- #my $state_to_color = { OK => '', UP => '', WARNING => '', CRITICAL => '', DOWN => '', UNKNOWN => '' };
- # Alert Acknowledment ####################################################
- my $last_alert;
- my $DEBUG=Irssi::settings_get_str("nagios_ack_channel");
- # Simple subs ############################################################
- sub TRUE() { 1 } # some constants [perlsyn(1)
- sub FALSE() { "" } # "Constant Functions"]
- sub DEBUG(@) { print "%B", join(":", @_),"%n" }# DEBUG thingy
- sub time2date($) {
- my ($d)=@_;
- return strftime("%d/%m/%y %H:%M", localtime($d));
- }
- ##########################################################################
- # Part B : user Actions ##################################################
- # Acknowledge alerts #####################################################
- # Global use to limit memory use. Probably a bad idea : better to check
- # where is the memory leak.
- # Four unused subs. Still there to be implemented later
- sub parse_status();
- sub nagios_ack($$$);
- sub nagios_check($$$);
- sub nagios_inject;
- #sub nagios_status();
- # Return alert ID "[FF01]"
- # F : caracter to display (! : ; C : change ; + : new alert ; - : green flag ; ? : green but not found)
- # I : numeric ID
- # state : state string, from @NagStates or %state_to_color
- sub format_alert_id($$$); # ($Flag,$I,$state)
- # Add alert to array / index
- sub insert_alert($$$$$); #( $host, $svc, $state, $msg, $d )
- ##########################################################################
- # Part C : Logfile management ############################################
- # disable fifo and erase fifo file
- sub destroy_fifo($); # [2004-08-14]
- # Open logfile/fifo
- sub open_fifo($); # [2004-08-14]
- # read from fifo
- # (called by fifo input signal)
- sub read_fifo(); # [2004-08-14]
- # Read logfile ###########################################################
- # create named fifo and open it for input
- # (called on script load and fifo name changes)
- sub create_fifo($); # [2004-08-14]
- # Query nagios ###########################################################
- sub nagios_query_status($);
- ##########################################################################
- # Part D : Alert processing ##############################################
- # Search for services/host informations, and post them to IRC ############
- # Delimiter : ; for logs; @ for direct nagios custom notification command
- # one parameter : the logline to parse.
- sub parse_nagios_log($);
- # Use alert fields to print and insert it
- # timestamp, alert-type, hostname, state, plugin output, service_name
- sub handle_alert($$$$$$$); # $d,$type,$host,$state,$output,$service
- ##########################################################################
- # IRSSI Events ###########################################################
- # create new fifo (erase any old) and get command prefix
- # (called on script loading and on user /set)
- sub setup(); # [2004-08-13]
- # Interact with IRC chan users
- sub event_privmsg ($$$$);
- # REFERENCES
- # ----------
- #
- # This script is mainly adapted from 3 other scripts related to nagios :
- #
- # https://github.com/zorkian/nagios-irc-bot/blob/master/nagiosirc.pl
- # http://www.update.uu.se/~zrajm/programs/irssi-scripts/fifo_remote.pl-0.5
- # https://github.com/mikegrb/irssi-scripts/blob/master/nagios-ack.pl
- ##########################################################################
- # CODE ###################################################################
- ##########################################################################
-
- ##########################################################################
- # Part B : user Actions ##################################################
- sub parse_status() {
- return $1 if $last_alert =~ /^PROBLEM - (\S+) is DOWN/;
- return ($1, $2) if $last_alert =~ /^PROBLEM - (\S+) on (\S+) is/;
- return;
- }
- sub nagios_ack($$$) {
- ( $param, $server, $window ) = @_;
- @issue = parse_status();
- if (!@issue) {
- #$window->print("Failed to parse last status: $last_alert");
- }
- my $message = " ACK ".$param . join ' ', reverse @issue;
- Irssi::active_server->command('MSG ' . $DEBUG . $message);
- }
- sub nagios_check($$$) {
- #1412375470;filer2;DISK_all;2;W=10% C=5%
- ( $param, $server, $window ) = @_;
- @issue = parse_status();
- if (!@issue) {
- #$window->print("Failed to parse last status: $last_alert");
- }
- my $message = " CHECK ".$param . join ' ', reverse @issue;
- Irssi::active_server->command('MSG ' . $DEBUG . $message);
- # handle_alert($$$$$$) { # $d,$type,$host,$state,$output,$service }
- }
- sub nagios_inject {
- $last_alert = shift;
- }
- #sub nagios_status {
- # (undef, undef, $window) = @_;
- # $issue = join ',', map { "'" . $_ . "'" } reverse parse_status();
- # $window->print("Last issue: '$last_alert' ($issue)");
- #
- #}
- # Return alert ID
- sub format_alert_id($$$) {
- my ($Flag,$I,$state)=@_;
- my $M=sprintf('%02d', scalar @ACKS % 100);
- my $N=sprintf('%02d', $I % 100);
- if (($I == 0) && (scalar @ACKS == 0)) {
- return "[".$Flag.$Flag." ]/$M ";
- } else {
- return "[".$Flag.$Flag.$state_to_color->{$state}.$N.$C{Z}."]/$M ";
- }
- }
- # Add alert to array / index
- sub insert_alert($$$$$) {
- #Irssi::print(">> On vire $host/$svc");
- my $i;
- ( $host, $svc, $state, $msg, $d ) = @_;
- # ALERT
- if ( $state eq 'WARNING' || $state eq 'CRITICAL' || $state eq 'UNKNOWN' || $state eq 'DOWN' ) {
- while ($i <= $#ACKS) {
- # Update, or insert ?
- if (($ACKS[$i]->[0] eq $host) && ($ACKS[$i]->[1] eq $svc)) {
- $ACKS[$i]->[4]=$d;
- Irssi::print(">> found $i");
- if ($ACKS[$i]->[2] ne $state) {
- # Same alert, but different level
- $ACKS[$i]->[2]=$state;
- return format_alert_id('C', $i, $state);
- } else {
- # Same alert
- return format_alert_id('!', $i, $state);
- # No need to display...
- }
- }
- $i++;
- }
- # New alert, insert.
- push (@ACKS, [ $host, $svc, $state, $msg, $d ] );
- return format_alert_id('+',scalar @ACKS,$state);
- # Clear alert
- } else {
- # Irssi::print(">> On vire $host/$svc");
- $i=0;
- # Find alert (need to be used by service/host index)
- while ($i <= $#ACKS) {
- if (($ACKS[$i]->[0] eq $host) && ($ACKS[$i]->[1] eq $svc)) {
- $ACKS[$i] = pop @ACKS;
- $i=$#ACKS;
- Irssi::print(">> found $i");
- return format_alert_id('-',$i+1,$state);
- }
- $i++;
- }
- return format_alert_id('?',0,$state);
- }
- }
- ##########################################################################
- # Part C : Logfile management ############################################
- # disable fifo and erase fifo file
- sub destroy_fifo($) { # [2004-08-14]
- my ($fifo) = @_; # get args
- if (defined $FIFO_TAG) { # if fifo signal is active
- Irssi::input_remove($FIFO_TAG); # disable fifo signal
- undef $FIFO_TAG; # and forget its tag
- } #
- if (defined $FIFO_HANDLE) { # if fifo is open
- close $FIFO_HANDLE; # close it
- undef $FIFO_HANDLE; # and forget handle
- } #
- if (-p $fifo) { # if named fifo exists
- unlink $fifo; # erase fifo file
- undef $FIFO; # and forget filename
- } #
- return 1; # return
- } #
- # Open logfile/fifo
- sub open_fifo($) { # [2004-08-14]
- my ($fifo) = @_; # get args
- if (not sysopen $FIFO_HANDLE, $fifo, # open fifo for non-blocking
- O_NONBLOCK | O_RDONLY) { # reading
- print CLIENTERROR "could not open nagios logfile for reading";
- return ""; #
- } #
- Irssi::input_remove($FIFO_TAG) # disable fifo reading signal
- if defined $FIFO_TAG; # if there is one
- $FIFO_TAG = Irssi::input_add # set up signal called when
- fileno($FIFO_HANDLE), INPUT_READ, # there's input in the pipe
- \&read_fifo, ''; #
- return 1; #
- }
- # read from fifo
- # (called by fifo input signal)
- sub read_fifo() { # [2004-08-14]
- # Read logfile ###########################################################
- foreach (<$FIFO_HANDLE>) { # for each input line
- chomp; # strip trailing newline
- parse_nagios_log($_); #if (/ALERT/ && /HARD;/);
- #Irssi::active_win->print( # show incoming commands (debug)
- # "\u$IRSSI{name} received command: \"$_\"", #
- # MSGLEVEL_CLIENTNOTICE); #
- # Irssi::active_win->command($_); # run incoming commands
- } #
- open_fifo($FIFO); # re-open fifo
- # TODO: Is the above re-opening of fifo really necessary? -- If not
- # invoked here `read_fifo' is called repeatedly, even though no input
- # is to be found on the fifo. (This seems a waste of resources to me.)
- }
- # create named fifo and open it for input
- # (called on script load and fifo name changes)
- sub create_fifo($) { # [2004-08-14]
- my ($new_fifo) = @_; # get args
- if (not -p $new_fifo) { # create fifo if non-existant
- if (system "mkfifo '$new_fifo' &>/dev/null" and
- system "chmod 777 '$new_fifo' &>/dev/null" and
- system "mknod '$new_fifo' &>/dev/null"){
- print CLIENTERROR "`mkfifo' failed -- could not create named pipe";
- # TODO: capture `mkfifo's stderr and show that here
- return ""; #
- } #
- } #
- $FIFO = $new_fifo; # remember fifo name
- open_fifo($new_fifo); # open fifo for reading
- } #
- # Query nagios ###########################################################
- sub nagios_query_status($){
- # 1412478149;hyppocampe;apt;2;CRITICAL : unknown: qemu-utils, qemu-kvm, qemu-keymaps
- my ($option)=@_;
- my @unixcat;
- my $unixline;
- $nagioscmd = Irssi::settings_get_str("nagios_command");
- foreach $unixline ( `echo "GET services
- Columns: last_state_change host_name display_name state plugin_output
- Filter: state > 0
- Filter: acknowledged = 0
- And: 2" | unixcat $nagioscmd` ) {
- ($d,$host,$service,$state,$output)=split /;/,$unixline;
- handle_alert($option,$d,'SERVICE',$host,$NagStates[$state+10],$output,$service);
- chomp $unixline;
- Irssi::print("%B>>%n $unixline", MSGLEVEL_CLIENTCRAP);
- }
- return;
- foreach $unixline ( `echo "GET hosts
- Columns: last_state_change host_name state plugin_output
- Filter: state > 0
- Filter: acknowledged = 0
- And: 2" | unixcat $nagioscmd` ) {
- ($d,$host,$state,$output)=split /;/,$unixline;
- handle_alert($option,$d,'HOST',$host,$NagStates[$state],$output,"");
- chomp $unixline;
- Irssi::print("%B>>%n $unixline", MSGLEVEL_CLIENTCRAP);
- }
- }
- ##########################################################################
- # Part D : Alert processing ##############################################
- # Search for services/host informations, and post them to IRC ############
- # Delimiter : ; for logs; @ for direct nagios custom notification command
- sub parse_nagios_log($){
- my $option="";
- $d=0; $status_line=""; $host="";$output="";$service="";
- $status_line=shift;
- ### log :
- # [1412330770] SERVICE ALERT: ella;IMAPs_LOGIN;OK;SOFT;2;OK - CO1N OK LOGIN Ok.
- # /\[\d+\] (\w+) ALERT: (\w+);(\w+);(\w+);HARD;(\d+);(.+)/
- # [1410969598] HOST ALERT: filou;DOWN;SOFT;1;PING CRITICAL - Paquets perdus = 100%
- # [TIMESTAMP] PROCESS type ALERT: host;service;STATE1;HARD;num;commentaire
- if (@match=$status_line =~ /\[?(\d+)\]? HOST ALERT: ([^@;]+)[@;]([^;@]+)[@;]HARD[@;][^;@]*[@;](.+)/) {
- # HOST ########################
- ($d,$host,$state,$output)=@match;
- handle_alert($option,$d,"HOST",$host,$state,$output,$service);
-
- # SERVICE #####################
- } elsif (@match=$status_line =~ /\[?(\d+)\]? (\w+) ALERT: ([^;@]+)[@;]([^;@]+)[@;]([^;@]+)[@;]HARD[@;][^;@]*[@;](.+)/) {
- ($d,$type,$host,$service,$state,$output)=@match;
- $service=~s/[^\w\d_-]/_/g;
- handle_alert($option,$d,$type,$host,$state,$output,$service);
- # OTHER #######################
- } elsif (@match=$status_line =~ /\[\d+\] (\w+) ALERT: (.*)/) {
- ($type,$data)=@match;
- Irssi::print( "%B>>%n $IRSSI{name} $type - $data", MSGLEVEL_CLIENTCRAP) unless ($status_line =~ /[;@]SOFT[@;]/);
- # FALLBACK ####################
- } else {
- Irssi::print( #
- "%B>>%n $IRSSI{name} received message: \"$_\"",
- MSGLEVEL_CLIENTCRAP); #
- next
- }
- }
- # Use alert fields to print and insert it
- sub handle_alert($$$$$$$) { # $d,$type,$host,$state,$output,$service
- my $option;
- # Temporisation
- ($option,$d,$type,$host,$state,$output,$service)=@_;
- next if exists $renot{"$host:$service"} && $renot{"$host:$service"} >= time() - 5;
- $renot{"$host:$service"} = time();
- # HOST or SERVICE ?
- $id = insert_alert($host,$service,$state,$output,$d);
- $msg = "$id".$state_to_color->{$state} . "$host:$service".$C{Z}." is $state : $output";
- #Irssi::print( "%B>>%n $IRSSI{name} $msg", MSGLEVEL_CLIENTCRAP);
- $last_alert="NAGIOS - $host/$service is $state";
- $d=time2date($d);
- $message = " $d - $last_alert - $msg";
- # Silently ignore previously sent alerts
- return if $id =~ '\[!' ;
- $nagios_ack_channel= Irssi::settings_get_str("nagios_ack_channel");
- Irssi::active_server->command('MSG ' . $nagios_ack_channel .
- " ".$message) unless ($option eq "silent");
- # Irssi::print( "%B>>%n $IRSSI{name} $msg", MSGLEVEL_CLIENTCRAP);
- }
- ##########################################################################
- # IRSSI Events ###########################################################
- # create new fifo (erase any old) and get command prefix
- # (called on script loading and on user /set)
- sub setup() { # [2004-08-13]
- my $new_fifo = Irssi::settings_get_str # setting from Irssi
- 'fifo_remote_file'; # (and add path to it)
- return if $new_fifo eq $FIFO and -p $FIFO; # do nada if already exists
- destroy_fifo($FIFO) if -p $FIFO; # destroy old fifo
- create_fifo($new_fifo) # create new fifo
- and $FIFO = $new_fifo; # and remember that fifo
- # To ADD :
- # request to livestatus to fetch stored alerts
- }
- # Interact with IRC chan users
- sub event_privmsg($$$$) {
- # Commamd channel
- my $K;
- my ($server, $data, $nick, $mask) =@_;
- my ($target, $text, $arg) = $data =~ /^(\S*)\s:(.*)/;
- #print ( "C:$target X:$text A:$admin D:$warndate L:$last W:$warn N:$nick D:$data" );
- if ( $text =~ /^!nagios ?(.*)/i ) {
- $arg=$1;
- # If we are not in command channel : NoOP
- $nagios_ack_channel=Irssi::settings_get_str("nagios_ack_channel");
- Irssi::print(">> $arg - $nagios_ack_channel - $target");
- return if $target ne $nagios_ack_channel ;
- # !nagios [*] :
-
- # !nagios list [*] :
- if ($arg =~ /^refresh ?(.*)/i) {
- $arg=$1;
- Irssi::print(">> $arg");
- if ($arg =~ /^silent/) {
- nagios_query_status("silent");
- } else {
- nagios_query_status("");
- $server->command ( "msg ".$nagios_ack_channel.
- 'Refresh nagios. Use "silent" keyword to disable display.');
- }
- $server->command ( "msg ".$nagios_ack_channel.
- " ".scalar @ACKS." alertes");
- }
- elsif ($arg =~ /^list ?(.*)/i) {
- $server->command ( "msg ".$nagios_ack_channel.
- " ".scalar @ACKS." alertes");
- my $i=0;
- my $grepto;
- my $togrep="$1";
- Irssi::print("> ".$togrep);
- foreach $K (@ACKS) {
- my $grepto="@$K";
- Irssi::print("> ".$grepto);
- $server->command ( "msg ".$nagios_ack_channel.
- " ". format_alert_id(' ',$i,$K->[2]) ." ".$K->[0]." / $K->[1] / $K->[2] / $K->[3] / ".time2date $K->[4]) if ($grepto =~ /$togrep/);
- $i++;
- }
- }
- elsif ($arg =~ /^help/i) {
- $server->command ( "msg ".$nagios_ack_channel.
- " !nagios list [pattern] :liste des alertes nagios reçues ici");
- $server->command ( "msg ".$nagios_ack_channel.
- " !nagios help : l'aide");
- $server->command ( "msg ".$nagios_ack_channel.
- " !nagios ack <#ALERTE> <message> : aquitte l'alerte");
- $server->command ( "msg ".$nagios_ack_channel.
- " !nagios check <#ALERTE> : recheck une alerte donnée (service/host)");
- $server->command ( "msg ".$nagios_ack_channel.
- " !nagios refresh [silent] : interroge le nagios pour avoir la liste de toutes les alertes");
- } elsif ( $arg =~ /^check ?(.*)/i ){
- nagios_check($1,$server,undef);
- } elsif ( $arg =~ /^ack ?(.*)/i ){
- nagios_ack($1,$server,undef);
- } else {
- $server->command ( "msg ".$nagios_ack_channel.
- " ".scalar @ACKS." alertes");
- }
- }
- return 1;
- }
- ##########################################################################
- # Main ###################################################################
- ##########################################################################
- print "starting...\n";
- # clean up fifo on unload
- # (called on /script unload)
- Irssi::signal_add_first #
- 'command script unload', sub { # [2004-08-13]
- my ($script) = @_; # get args
- return unless $script =~ # only do cleanup when
- /(?:^|\s) $IRSSI{name} # unloading *this* script
- (?:\.[^. ]*)? (?:\s|$) /x; #
- destroy_fifo($FIFO) if -p $FIFO; # destroy old fifo
- Irssi::print("%B>>%n $IRSSI{name} $VERSION unloaded", MSGLEVEL_CLIENTCRAP);
- }; #
- setup(); # initialize setup values
- Irssi::signal_add('event privmsg', 'event_privmsg');
- Irssi::signal_add("message public", "event_privmsg");
- Irssi::signal_add('setup changed', \&setup); # re-read setup when it changes
- print CLIENTCRAP "%B>>%n $IRSSI{name} $VERSION (by $IRSSI{authors}) loaded";
- 1;
- ##########################################################################
- # References #############################################################
- ##########################################################################
- # REFERENCES
- # ----------
- #
- # This script is mainly adapted from 3 other scripts related to nagios :
- #
- # https://github.com/zorkian/nagios-irc-bot/blob/master/nagiosirc.pl
- # http://www.update.uu.se/~zrajm/programs/irssi-scripts/fifo_remote.pl-0.5
- # https://github.com/mikegrb/irssi-scripts/blob/master/nagios-ack.pl
|