ePN: notification script

Robert Hajime Lanning lanning at lanning.cc
Mon Mar 6 19:08:29 CET 2006


<quote who="John R. Daily">
> Here's the bare minimum script I had originally set up for testing:
> ---
> #!/usr/bin/perl -w
>
> use utils qw(%ERRORS);
>
> print "Perl here.\n\n";
> exit($ERRORS{'OK'});
[snip]
> The debugging log that I set up as per Stanley's suggestion of
> editing p1.pl:
>
> Mon Mar  6 11:27:08 2006 eval_file: successfully compiled "/etc/
> nagios/messages/test | /bin/mail -s "** PROBLEM alert - localhost/
> HTTPD is CRITICAL **" jdaily at apparatus.net".
> Mon Mar  6 11:27:08 2006 run_package: "/etc/nagios/messages/test | /
> bin/mail -s "** PROBLEM alert - localhost/HTTPD is CRITICAL **"
> jdaily at apparatus.net" returning (0, "Perl here.
>
> ").
>
>
> So it looks to me as if ePN is fine with the script, but the output
> does not seem to be delivered to /bin/mail as it is with the shell
> version.

Ah, you are running into the problem that in ePN STDOUT does not
go to STDOUT.  It is redirected to an array inside of p1.pl.

The best way to fix this is to not use the "|" on the commandline.
Use:

open(CMD,"|/bin/mail arg1 arg2...");
print CMD "Perl here.\n\n";
close(CMD);

or if you really need to use the commandline pipe, then you have
to not use ePN (ie. use "/usr/bin/perl script_name | /bin/mail ..."

-- 
And, did Guloka think the Ulus were too ugly to save?
                                         -Centauri



-------------------------------------------------------
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&kid=110944&bid=241720&dat=121642
_______________________________________________
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