[Nagiosplug-help] Bitten by ePN?
Chris Haulmark
chris at sigd.net
Wed Nov 21 21:13:42 CET 2007
Hello Ralph:
> Hello List Subscribers,
>
> I have written a custom SMS notification "plugin" in Perl
> which isn't working as expected.
>
> Whenever I run it as user nagios from the Nagios server in an
> interactive shell
> SMS messages are sent to my mobile.
>
> Whereas when having the plugin executed by the nagios daemon (or
> rather one of its child procs)
> no SMS keeps coming in.
>
> This could well be an issue with our SMS gateway relay.
> So, I asked the admin of this relay to check his logs to tell me
> what went wrong.
> But he says all he can see is messages saying that the sender's
> address hadn't been matched in the
> allowed users' database, which isn't all that helpful.
>
> I found out that in my plugin I need to "spoof" the SMTP "MAIL
> FROM" value in the envelope
> to something this SMS GW would accept.
> As I am using Mail::Mailer I found that this can be achieved by
> setting the environment MAILDOMAIN
> appropiately.
> So I am doing something similar to
>
> my $sender = 'someone@'.$ENV{MAILDOMAIN};
>
> Also, instead of passing in Nagios Macros as parameters I fetch
> them from the environment
> similar to e.g.
>
> my @rcpts = ($ENV{NAGIOS_CONTACTEMAIL}) ||
> qw(someone at fallback.domain);
>
>
> I now wonder if I am possibly bitten by embedded Perl Nagios
> here?
I am not an expert with Perl but I have worked with Perl scripts before.
I
learned that the embedded Perl support is strict in how the Perl scripts
are
wrote and executed. Plugins should be working in the strict.
That means that all variables should be initialized or your plugins
would
be executed repeatly with the old variables values. That sounds like
your
problem?
There are some reading at
http://nagios.sourceforge.net/docs/2_0/embeddedperl.html
Chris
>
> Cheers
>
> Ralph
>
>
>
-----------------------------------------------------------------------
> --
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Nagiosplug-help mailing list
> Nagiosplug-help at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
> ::: Please include plugins version (-v) and OS when reporting any
> issue.
> ::: Messages without supporting info will risk being sent to /dev/null
More information about the Help
mailing list