Page 1 of 1

Parsing Incoming Mail

Posted: Tue Nov 30, 2010 6:59 pm
by jengstro
Anyone know of a plug-in that will parse incoming mail and log/alert via Nagios XI?

Thanks!
-Jeff

Re: Parsing Incoming Mail

Posted: Wed Dec 01, 2010 10:42 am
by tonyyarusso
There are lots of plugins for checking the status of the mail server, size of the queue, etc., but I don't know of any that parse the actual mail itself. What is it you're trying to do with it, and with what sort of mail server & mailbox setup?

Re: Parsing Incoming Mail

Posted: Wed Dec 01, 2010 8:20 pm
by jengstro
I want to be able to have an email come directly to the Nagios server to be parsed. Currently the email goes to an Exchange mail box. If there is a way to parse the Exchange mailbox, that would work as well.

Thanks!

Re: Parsing Incoming Mail

Posted: Thu Dec 02, 2010 10:46 am
by tonyyarusso
Parsed for what? Are you looking for a particular string in an individual message, size of the user's mailbox, etc. Are you trying to just check the contents of a message, or take some action based on it?

Re: Parsing Incoming Mail

Posted: Thu Dec 02, 2010 7:52 pm
by jengstro
A particular string in an individual message or messages.

Re: Parsing Incoming Mail

Posted: Fri Dec 03, 2010 7:46 am
by compqact
Hi Tony,

I am looking for exactly what you have listed there. We are trying to use Nagios to parse and e-mail and depending on the content of the e-mail flag it as important or not. All of the messages will have a standard output depending on the severity level except for the customer name changing. Will nagios support this functionality ?

Thanks

Andrew

Re: Parsing Incoming Mail

Posted: Fri Dec 03, 2010 11:07 am
by mguthrie
Get Nagios to do this is simply a matter of either finding or creating a check plugin that will do this. I'd recommend looking around on the exchange.nagios.org website and see if you can find something that will do this. You could also look at some log monitoring plugins, because those essentially search for a string in a file. OR, depending on your comfort level with scripting, all you'd have to do is write a simple script that reads the file, looking for the string, and returns an exit code (0-3) and a simple message depending on what it found. Once you have that all you have to do is add it as a check command and set it up as a service.

Re: Parsing Incoming Mail

Posted: Thu Dec 09, 2010 10:54 am
by tonyyarusso
I haven't found any pre-built ones for doing this with Exchange, and dealing with something sent directly to the Nagios server would depend on mailbox format chosen, etc. So, I'll offer this general guidance and hopefully that gets you pointed in the right direction. You would need to write a "check plugin" to do the actual parsing based on what you know about the format you expect, in the language of your choice, and then tell Nagios to use it. You can find general information about how plugins work on http://nagios.sourceforge.net/docs/3_0/pluginapi.html, and detailed plugin "best practices" on http://nagiosplug.sourceforge.net/devel ... lines.html.