Passive Service Checks from E-mail?

Stanley Hopcroft Stanley.Hopcroft at IPAustralia.Gov.AU
Sat Mar 8 01:10:35 CET 2003


Dear Sir,

I am writing to thank you for your letter and say I think you facre two
probelms in having an email produce a passive service check result,

On Fri, Mar 07, 2003 at 02:09:15PM -0800, Hiatt, William wrote:
> I need to monitor some backup jobs from Veritas BackupEXEC.
> Unfortunately, BackupEXEC doesn't send SNMP traps when a job is
> successful (Figure that out!). But, it can send an e-mail out when a job
> has failed or is successful. Does anyone know the best way to parse this
> e-mail, or is anybody doing something like this already? Just thought
> I'd check-in before I spent the time to write one myself.

1 Having your MTA recognise that the letter (from Veritas) needs special
handling ie programmatic handling

If you are using Sendmail this requires some customisation (local rule
0) to recognise the letter and a 'mailer' to invoke the program that
parses the letter and formats the passive service check result
(appending it to the command queue)

2 Writing the program that slurps the letter, spits out the headers, and
extracts the backup status from what's left, and submitting the properly
formatted check result.

Here's what I use for an SMS email gateway (same concept) to have
letters addressed to <account>.page delivered via an SMS gateway
implemented in mail2sms.pl.

LOCAL_RULE_0
R$+.page                                $#sms $: $1
R$+.page<@$=w>$*                        $#sms $: $1
R$+.page<@$=w.>$*                       $#sms $: $1

and here is the mailer (sms.m4)

ifdef(`SMS_MAILER_ARGS',,
        `define(`SMS_MAILER_ARGS', mail2sms.pl $u )')
ifdef(`SMS_MAILER_PATH',,
        `define(`SMS_MAILER_PATH', /usr/local/sms/bin/mail2sms.pl)')
ifdef(`SMS_MAILER_MAX',,
        `define(`SMS_MAILER_MAX', 1000)')
POPDIVERT
####################################
###   SMS Mailer specification   ###
####################################

VERSIONID(`@(#)sms.m4   1.00 (Berkeley) 6/15/2000')

Msms,           P=SMS_MAILER_PATH, F=lms, M=SMS_MAILER_MAX,
A=SMS_MAILER_ARGS

This is simply standard Sendmail (m4) stuff. Nothing fancy. The Sendmail
cognoscenti will probably do it a lot more simply.

Both items 1 and 2 (vi) I think are quite managable and tractable

Anyone experienced in Sendmail could do 1 in 0.5 - 1 hour (maybe two
with testing)

Item 2 is pretty straight forward in Perl (<= 50 lines unless you want
to process the headers to check for forgeries etc).

> 
> Thanks
> william
>

This is a _good_ idea. I was suprised to see that some backup products
don't generate traps that one might expect. 

In fact, you could allow email from anything to submit Nag service check
results if you wanted.

Yours sincerely.

-- 
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------

'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'

from Meditation 17, J Donne.


-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
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