Xymon Mailing List Archive search

Hobbit [85409] itlab02.metsi.com:svcs CRITICAL (RED)

list Dave Haertig
Mon, 10 Sep 2007 11:16:15 -0600
Message-Id: <user-239345daf7d5@xymon.invalid>

You can write your own custom script and call it via SCRIPT instead of MAIL in the hobbit-alerts.cfg file.  Or use my script cut/pasted below.  I have lots of custom Hobbit tests that produce quite verbose webpages, but I don't want all that verbosity in the email alerts.  The email recipients know to go to the website to view the details if needed.

/hobbit/server/ext/brief_alert script below.  You can just change the $Subject and $Body variables to say what you'd like (or even delete $Body totally).

--- cut here ---
#!/bin/perl
use strict;
my $Subject = "Hobbit Alert! \u$ENV{BBCOLORLEVEL} light : $ENV{BBSVCNAME} : $ENV{BBHOSTNAME}";
my $Body = "Hobbit Monitoring Alert!\n\nA \u$ENV{BBCOLORLEVEL} light condition has been detected for SERVICE=$ENV{BBSVCNAME} on HOST=$ENV{BBHOSTNAME}";
SendMail($Subject, $Body);
sub SendMail {
        my($Subject, $Body) = @_;
        open( MAIL, '| /usr/lib/sendmail -F "Hobbit" -t');
        print MAIL  "To: $ENV{RCPT}\n";
        print MAIL  "Subject: $Subject\n\n" if defined $Subject;
        print MAIL  "$Body\n" if defined $Body;
        close(MAIL);
}
--- cut here ---

And here's how I invoke it in the alerts file (/hobbit/server/etc/hobbit-alerts.cfg):

--- cut here ---
$BRIEF_ALERT=/hobbit/server/ext/brief_alert
$TERMINAL_SERVERS_US=(ts1|ts2|ts3)
$IT_TEAM=user-9d8dc1b9e890@xymon.invalid,user-44dc73cb12e3@xymon.invalid
HOST=%$TERMINAL_SERVERS_US SERVICE=conn COLOR=red DURATION>10m
        SCRIPT $BRIEF_ALERT $IT_TEAM REPEAT=2h
--- cut here ---


-----Original Message-----
From: pkc_mls [mailto:user-06f34394900f@xymon.invalid] 
Sent: Monday, September 10, 2007 8:47 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] FW: Hobbit [85409] itlab02.metsi.com:svcs CRITICAL (RED)

Nikesh Maharaj a écrit :
HI,

My alerts send me the following. Is there any way I can change this 
just to send me the "service" that is not ok?

  
hello,

this is the standard format.
the code is available, so you can have hobbit send you exactly the message you wish.
sure for the first time you think you have too much informations in this mail, but in the future perhaps you'll be happy all those infos are in the mail.

if you simply need to know which service is not ok, just browse to the hobbit "non green view" in your browser.
-----Original Message-----
From: user-bc0ec3b11ab4@xymon.invalid [mailto:user-bc0ec3b11ab4@xymon.invalid]
Sent: 10 September 2007 04:16 PM
To: IT Support
Subject: Hobbit [85409] itlab02.metsi.com:svcs CRITICAL (RED)

red Mon Sep 10 16:15:54 SAST 2007  Services Not OK

&red Print Spooler - Stopped
&green Big Brother SNM Client 1.08d - Running