[Gllug] PERL/Nagios Experts

Sunny Aujla sunnyfedora99 at gmail.com
Fri Sep 10 10:56:48 UTC 2010


Hi Jan,

My bad NAS - Network Audio System, god knows what i was thinking when i was
typing :)

Thanks for the information you have provided.  I'll give it a whirl and get
back to you.

Thanks,
Sunny

On Fri, Sep 10, 2010 at 11:27 AM, Jan Henkins <jan at henkins.za.net> wrote:

>  Hello Sunny,
>
> On 10/09/10 11:00, Sunny Aujla wrote:
> > Hi All,
> >
> > Just want some advice.  I need to know if it is possible to do the
> > following:
> >
> > Here is the scenario:
> >
> > I have a Nagios system which monitors the devices we develop.  When
> > the host is down, it sends a email to our Helpdesk email. We have a
> > NAS (Network Sound Server) which plays a sound when there is a host
> > down. Currently it just plays one sound file for all devices.
>
> Sorry to sound confused, but NAS != Network Sound Server, AFAIK it means
> "Network Attached Storage"...
>
> >
> > I would like to have something like a perl wrapper which will look at
> > the email, extract which device is down and play the particular sound
> > file according to the device. for example: "Device A is down" or
> > "Device B is down".
> >
> > Can this be easily done?
> >
>
>  From what I can visualise from the limited info above, yes you can do
> it using a script of some sort. Perl will work, BASH with formail will
> also work. You can test this quite easily on a Linux box by adding the
> script to a .forward file in the home directory of the user you are
> sending mail to. It should look something like this:
>
> ---start---
> "| /path/to/script.pl"
> anotheruser
> ---end---
>
> Important to note the quotes around the first line, which denotes a pipe
> to an external program, in this case your perl script. The "anotheruser"
> is an optional entry. Why I include that here, is that it is important
> to note that the mail message will be discarded after it is sent through
> the pipe to the perl script. If you want to keep a copy of the mail, you
> have to put in a mailbox name in place of "anotheruser", either the same
> one you are using for this exercise, or another local user. It could be
> a full email address of a mailbox on another system, for that matter.
>
> To get back to the script, what basically happens with the pipe is that
> you are pushing the full contents of the email message trough your
> script. The nice thing with this is that you can easily do regex and
> pattern matching based on headers or strings in the message body,
> whatever you want to do. Fairly straightforward as these things goes.
>
> PS: I run a system using this principle as an email to SMS gateway for
> the company I work for.
>
> --
> Regards,
> Jan Henkins
>
> --
> Gllug mailing list  -  Gllug at gllug.org.uk
> http://lists.gllug.org.uk/mailman/listinfo/gllug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20100910/84359151/attachment.html>
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list