Acknowledge issues via e-mail

Terry td3201 at gmail.com
Mon Jan 30 20:07:33 CET 2006


I have a solution that is still in "development" (kinda).  It doesn't
quite work yet, but I haven't given it much attention in a while.  And
I am not a skilled programmer by any stretch of the imagination but
you get my logic at least.

procmailrc:

GETTEXT="[  ]*\/[^  ].*"

:0:
* ^From:.*(user1|user2).*domain\.com
* ^Subject:
* $ ^Subject:${GETTEXT}
| /usr/share/nagios/contrib/processmailcommands.pl "${MATCH}"


Here is the perl script ran from above:

#!/usr/bin/perl

$commandfile = "/var/log/nagios/rw/nagios.cmd";
$now = `date +%s`;
$subject = "$ARGV[0]";
chomp $subject;
$comment = "Remote Acknowledgement";
$author = "remote";

# UNCOMMENT TO TEST

#$commandfile = "/tmp/foobarnagios";
#$subject = "msp ack RE: PROBLEM: ACM Biztalk Server #1/CPU - Call
866-378-3791 is CRITICAL";

($password, $action, $crap, $crap, $crap, $crap) = split(/ /,"$subject");
($foo) = $subject=~/PROBLEM: (.*\/.*) is/;
($host, $service) = split(/\//,"$foo");
if( $password =~ /(?i)msp/ ){
        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 1/30/06, Dany Allard <dany.allard at aeso.ca> wrote:
> Hello everyone
>
>  I did a few google searches, and looked through Nagiosexchange but I
> was not able to find anything that would allow me to acknowledge issues
> via e-mail.
>
>  What I would like to be able to do is receive and e-mail for a problem,
> then be able to reply to that e-mail acknowledging the issue.
> This would likely be used for on-call people to acknowledge problems
> from their mobile phones.
>
>  Any input would be appreciated? Or any alternative solutions?
>
>  Thank you all for your time.
>
> Dany Allard
> 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: Splunk Inc. Do you grep through log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmdlnk&kid3432&bid#0486&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
>


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&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