Update
This commit is contained in:
parent
9f7533ed4c
commit
33b81de014
@ -78,7 +78,7 @@ sub on_connect {
|
||||
my $self = shift;
|
||||
|
||||
$identified_to_nickserv = 1;
|
||||
print "Joining #april-admin...\n";
|
||||
print "Joining #april-monitoring...\n";
|
||||
|
||||
# FIXME: this is broken right now. when this is re-added, it has to happen
|
||||
# before we try to join channels.
|
||||
@ -86,7 +86,7 @@ sub on_connect {
|
||||
#$self->privmsg('nickserv',"identify xxx");
|
||||
|
||||
# CONFIG: channels you want us to announce to ...
|
||||
$self->join("#april-admin");
|
||||
$self->join("#april-monitoring");
|
||||
#$self->join("#status");
|
||||
}
|
||||
|
||||
@ -151,11 +151,11 @@ sub on_public {
|
||||
# FIXME: the logging gets spammy ... do we actually want to log to stdout?
|
||||
print "<$nick> $arg\n";
|
||||
|
||||
if ($arg =~ /^$mynick[,: ]/i) {
|
||||
if ($arg =~ /^$mynick[,: ]\s*ignore (.+)\s*$/i) {
|
||||
if ($arg =~ /^$mynick[,: ]/i || $arg =~ /^!/ ) {
|
||||
if ($arg =~ /^(?:$mynick[,: ]|!)\s*ignore (.+)\s*$/i) {
|
||||
$ignore{$1} = 1;
|
||||
$self->privmsg([ @to ], "$nick: ok, ignoring notifications about $1");
|
||||
} elsif ($arg =~ /^$mynick[,: ]\s*ignore$/i) {
|
||||
} elsif ($arg =~ /^(?:$mynick[,: ]|!)\s*ignore$/i) {
|
||||
if (keys %ignore) {
|
||||
foreach my $i (keys %ignore) {
|
||||
$self->privmsg([ @to ], "$nick: ignoring $i");
|
||||
@ -164,14 +164,14 @@ sub on_public {
|
||||
} else {
|
||||
$self->privmsg([ @to ], "$nick: I'm not currently ignoring any notifications");
|
||||
}
|
||||
} elsif ($arg =~ /^$mynick[,: ]\s*unignore (.+)\s*$/i) {
|
||||
} elsif ($arg =~ /^(?:$mynick[,: ]|!)\s*unignore (.+)\s*$/i) {
|
||||
if (!exists($ignore{$1})) {
|
||||
$self->privmsg([ @to ], "$nick: notifications about $1 weren't being ignored anyway.");
|
||||
} else {
|
||||
delete $ignore{$1};
|
||||
$self->privmsg([ @to ], "$nick: ok, notifications about $1 no longer being ignored.");
|
||||
}
|
||||
} elsif ($arg =~ /^$mynick[,: ]+(?:\s*ack\s*)?(\d+)(?:\s*ack\s*)?[:\s]+([^:]+)\s*$/) {
|
||||
} elsif ($arg =~ /^(?:$mynick[,: ]|!)+(?:\s*ack\s*)?(\d+)(?:\s*ack\s*)?[:\s]+([^:]+)\s*$/) {
|
||||
open CMDPIPE,">",$nagioscmd;
|
||||
my ( $host, $svc ) = @{ $ACKS[$1] || [ undef, undef ] };
|
||||
if ( defined $host && defined $svc ) {
|
||||
@ -180,15 +180,15 @@ sub on_public {
|
||||
printf CMDPIPE "[%lu] ACKNOWLEDGE_HOST_PROBLEM;%s;1;1;1;%s;%s\n",time(),$host,$nick,$2;
|
||||
}
|
||||
close CMDPIPE;
|
||||
} elsif ($arg =~ /^$mynick[,: ]\s*ack ([^:]+):([^:]+)\s*$/) {
|
||||
} elsif ($arg =~ /^(?:$mynick[,: ]|!)\s*ack ([^:]+):([^:]+)\s*$/) {
|
||||
open CMDPIPE,">",$nagioscmd;
|
||||
printf CMDPIPE "[%lu] ACKNOWLEDGE_HOST_PROBLEM;%s;1;1;1;%s;%s\n",time(),$1,$nick,$2;
|
||||
close CMDPIPE;
|
||||
} elsif ($arg =~ /^$mynick[,: ]\s*ack ([^:]+):([^:]+):([^:]+)\s*$/) {
|
||||
} elsif ($arg =~ /^(?:$mynick[,: ]|!)\s*ack ([^:]+):([^:]+):([^:]+)\s*$/) {
|
||||
open CMDPIPE,">",$nagioscmd;
|
||||
printf CMDPIPE "[%lu] ACKNOWLEDGE_SVC_PROBLEM;%s;%s;1;1;1;%s;%s\n",time(),$1,$2,$nick,$3;
|
||||
close CMDPIPE;
|
||||
} elsif ($arg =~ /^$mynick[,: ]\s*unack (\d+)$/) {
|
||||
} elsif ($arg =~ /^(?:$mynick[,: ]|!)\s*unack (\d+)$/) {
|
||||
open CMDPIPE,">",$nagioscmd;
|
||||
my ( $host, $svc ) = @{ $ACKS[$1] || [ undef, undef ] };
|
||||
if ( defined $host && defined $svc ) {
|
||||
@ -199,17 +199,17 @@ sub on_public {
|
||||
$self->privmsg([ @to ], "$nick: ok, acknowledgment (if any) for $host has been removed.");
|
||||
}
|
||||
close CMDPIPE;
|
||||
} elsif ($arg =~ /^$mynick[,: ]\s*unack ([^:]+)\s*$/) {
|
||||
} elsif ($arg =~ /^(?:$mynick[,: ]|!)\s*unack ([^:]+)\s*$/) {
|
||||
open CMDPIPE,">",$nagioscmd;
|
||||
printf CMDPIPE "[%lu] REMOVE_HOST_ACKNOWLEDGEMENT;%s\n",time(),$1;
|
||||
close CMDPIPE;
|
||||
$self->privmsg([ @to ], "$nick: ok, acknowledgment (if any) for $1 has been removed.");
|
||||
} elsif ($arg =~ /^$mynick[,: ]\s*unack ([^:]+):([^:]+)\s*$/) {
|
||||
} elsif ($arg =~ /^(?:$mynick[,: ]|!)\s*unack ([^:]+):([^:]+)\s*$/) {
|
||||
open CMDPIPE,">",$nagioscmd;
|
||||
printf CMDPIPE "[%lu] REMOVE_SVC_ACKNOWLEDGEMENT;%s;%s\n",time(),$1,$2;
|
||||
close CMDPIPE;
|
||||
$self->privmsg([ @to ], "$nick: ok, acknowledgment (if any) for $1:$2 has been removed.");
|
||||
} elsif ($arg =~ /^$mynick[,: ]\s*status (\S.*?)\s*$/) {
|
||||
} elsif ($arg =~ /^(?:$mynick[,: ]|!)\s*status (\S.*?)\s*$/) {
|
||||
my @lines = ();
|
||||
open CMDPIPE,"-|","/usr/local/bin/nag-stat",$1;
|
||||
while (<CMDPIPE>) {
|
||||
@ -220,8 +220,9 @@ sub on_public {
|
||||
foreach my $line (@lines) {
|
||||
$self->privmsg([ @to ], "$nick: $line");
|
||||
}
|
||||
} elsif ($arg =~ /^$mynick[,: ]\s*help/i) {
|
||||
} elsif ($arg =~ /^(?:$mynick[,: ]|!)\s*help/i) {
|
||||
$self->privmsg([ @to ], "$nick: You're right, I need help!");
|
||||
$self->privmsg([ @to ], "$nick: supported commands: ignore, unignore, ack, unack, help");
|
||||
} elsif ($arg =~ /(?:hey|hi|hello|yo)(?:\.|,|\!|\s_)/i) {
|
||||
$self->privmsg([ @to ], "Yo, $nick!");
|
||||
} else {
|
||||
@ -330,7 +331,7 @@ sub on_notice {
|
||||
print "Joining channels...\n";
|
||||
|
||||
# CONFIG: channels that should be joined go here.
|
||||
$self->join("#april-admin");
|
||||
$self->join("#april-monitoring");
|
||||
}
|
||||
}
|
||||
|
||||
@ -393,7 +394,7 @@ while (1) {
|
||||
|
||||
if ($identified_to_nickserv) {
|
||||
# CONFIG: change where we announce stuff here
|
||||
my @channels = ('#april-admin');
|
||||
my @channels = ('#april-monitoring');
|
||||
while (defined (my $line = <NAGIOS>)) {
|
||||
print $line;
|
||||
chomp($line);
|
||||
|
Loading…
Reference in New Issue
Block a user