Acknowledge issues via e-mail
Terry
td3201 at gmail.com
Thu Mar 16 02:49:02 CET 2006
Here is my working updated script.
- Set up a pop3 account with the same email address as the FROM
address of your nagios alerts
- When you receive an alert, simply reply to the alert and prepend
your password and command to the subject. Like this:
foobar ack PROBLEM: server01/Test Service Webmin is CRITICAL
You can get fancy and have people specify their name too as the author
of the comment if you are in a large environment. Might even do FROM
header matching and pass that on as the author if you really feel the
need.
Also, here is the updated procmail recipe:
BODY=`formail -I ""`
:0w:
| /usr/share/nagios/contrib/processmailcommands.sh "$BODY"
Script:
#!/usr/bin/perl
$commandfile = "/var/log/nagios/rw/nagios.cmd";
$now = `date +%s`;
$body = "$ARGV[0]";
chomp $body;
$body =~ s/\n//g;
$comment = "Remote Acknowledgement";
$author = "remote";
($password, $action, $crap, $crap, $crap, $crap) = split(/ /,"$body");
($foo) = $body=~/PROBLEM: (.*\/.*) is/;
($host, $service) = split(/\//,"$foo");
if( $password =~ /(?i)foobar/ ){
if( $action =~ /(?i)ack/ ){
open(F,">>$commandfile") or die ("Cant open");
$output = `/usr/bin/printf "[%lu]
ACKNOWLEDGE_SVC_PROBLEM;$host;$service;1;$comment\n" $now`;
print F $output;
$output = `/usr/bin/printf "[%lu]
ADD_SVC_COMMENT;$host;$service;1;$author;$comment\n" $now`;
print F $output;
close F; }
elsif ( $action =~ /(?i)nosvcchk/ ){
open(F,">>$commandfile") or die ("Cant open");
$output = `/usr/bin/printf "[%lu]
DISABLE_SVC_CHECK;$host;$service\n" $now`;
print F $output;
close F; }
elsif ( $action =~ /(?i)nosvcnotify/ ){
open(F,">>$commandfile") or die ("Cant open");
$output = `/usr/bin/printf "[%lu]
DISABLE_SVC_NOTIFICATIONS;$host;$service\n" $now`;
print F $output;
close F; }
elsif ( $action =~ /(?i)nohostchk/ ){
open(F,">>$commandfile") or die ("Cant open");
$output = `/usr/bin/printf "[%lu]
DISABLE_HOST_SVC_CHECKS;$host\n" $now`;
print F $output;
close F; }
} else {
exit 1;
}
On 3/15/06, Dany Allard <dany.allard at aeso.ca> wrote:
> David
>
> We are still working on getting it implemented (change
> control/paperwork).
> The script that was sent to the list by Terry works well enough on the
> command line. We are now working on the e-mail parsing piece.
> Unfortunately due to other priorities this has fallen behind a bit.
> Once I have the completed solution I will post back to the list.
>
> Thanks
>
> Dany Allard
>
> -----Original Message-----
> From: David Schlecht [mailto:dschlecht at doit.nv.gov]
> Sent: Wednesday, March 15, 2006 3:52 PM
> To: nagios-users at lists.sourceforge.net; td3201 at gmail.com;
> andrew at profitability.net; Dany Allard; chad.osmond at holburn.com
> Subject: Re: [Nagios-users] Acknowledge issues via e-mail
>
> Hi Dany
>
>
>
> So, Dany, how did your endeavors go? Did you get it working?
>
>
>
> We're looking for the same solution. Are you willing to share your=
> experience with the list?
>
>
>
>
>
> - David Schlecht (dschl)
>
>
>
> -----------------------
>
> This thread is located in the archive at this URL:
>
> http://www.nagiosexchange.org/nagios-users.34.0.html?&tx_maillisttofaq_p
> i=
> 1[showUid]=14824
>
>
> This message is intended only for the addressee and may contain personal, privileged or confidential information.
> If you have received this message in error, please notify the sender immediately and delete or destroy this
> message without making copies or opening any attachments. Any further distribution, duplication or disclosure
> is prohibited.
>
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list