Hi Jan,<br><br>My bad NAS - Network Audio System, god knows what i was thinking when i was typing :)  <br><br>Thanks for the information you have provided.  I'll give it a whirl and get back to you. <br><br>Thanks,<br>
Sunny<br><br><div class="gmail_quote">On Fri, Sep 10, 2010 at 11:27 AM, Jan Henkins <span dir="ltr"><<a href="mailto:jan@henkins.za.net">jan@henkins.za.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
  Hello Sunny,<br>
<div class="im"><br>
On 10/09/10 11:00, Sunny Aujla wrote:<br>
> Hi All,<br>
><br>
> Just want some advice.  I need to know if it is possible to do the<br>
> following:<br>
><br>
> Here is the scenario:<br>
><br>
> I have a Nagios system which monitors the devices we develop.  When<br>
> the host is down, it sends a email to our Helpdesk email. We have a<br>
> NAS (Network Sound Server) which plays a sound when there is a host<br>
> down. Currently it just plays one sound file for all devices.<br>
<br>
</div>Sorry to sound confused, but NAS != Network Sound Server, AFAIK it means<br>
"Network Attached Storage"...<br>
<div class="im"><br>
><br>
> I would like to have something like a perl wrapper which will look at<br>
> the email, extract which device is down and play the particular sound<br>
> file according to the device. for example: "Device A is down" or<br>
> "Device B is down".<br>
><br>
> Can this be easily done?<br>
><br>
<br>
</div> From what I can visualise from the limited info above, yes you can do<br>
it using a script of some sort. Perl will work, BASH with formail will<br>
also work. You can test this quite easily on a Linux box by adding the<br>
script to a .forward file in the home directory of the user you are<br>
sending mail to. It should look something like this:<br>
<br>
---start---<br>
"| /path/to/<a href="http://script.pl" target="_blank">script.pl</a>"<br>
anotheruser<br>
---end---<br>
<br>
Important to note the quotes around the first line, which denotes a pipe<br>
to an external program, in this case your perl script. The "anotheruser"<br>
is an optional entry. Why I include that here, is that it is important<br>
to note that the mail message will be discarded after it is sent through<br>
the pipe to the perl script. If you want to keep a copy of the mail, you<br>
have to put in a mailbox name in place of "anotheruser", either the same<br>
one you are using for this exercise, or another local user. It could be<br>
a full email address of a mailbox on another system, for that matter.<br>
<br>
To get back to the script, what basically happens with the pipe is that<br>
you are pushing the full contents of the email message trough your<br>
script. The nice thing with this is that you can easily do regex and<br>
pattern matching based on headers or strings in the message body,<br>
whatever you want to do. Fairly straightforward as these things goes.<br>
<br>
PS: I run a system using this principle as an email to SMS gateway for<br>
the company I work for.<br>
<br>
--<br>
Regards,<br>
Jan Henkins<br>
<font color="#888888"><br>
--<br>
</font><div><div></div><div class="h5">Gllug mailing list  -  <a href="mailto:Gllug@gllug.org.uk">Gllug@gllug.org.uk</a><br>
<a href="http://lists.gllug.org.uk/mailman/listinfo/gllug" target="_blank">http://lists.gllug.org.uk/mailman/listinfo/gllug</a><br>
</div></div></blockquote></div><br>