Xymon Mailing List Archive search

Why BBSVCNAME,BBHOSTSVC invalid in my alert script?

list Daniel Bourque
Thu, 21 Jun 2007 09:50:57 -0500
Message-Id: <user-2ddce71d143d@xymon.invalid>

Note that lots of network check ( the ones defined in bb-services ) will not report statuses on a line starting with &color, they start with "Service..." . The following perl snippet is what I use to pick out statuses in my custom notification script.


        $subject="$ENV{BBHOSTSVC}: $ENV{BBCOLORLEVEL} ";

        foreach( split('\n',$ENV{BBALPHAMSG}) ) {
                if ( /^\&(yellow|red|purple)/ ){
                        $message .= $_;
                }
                if ( /^Service.* not OK/ ){
                        $message = $_;
                }
        }


Then use smtp mail to send out an email, you can concatenate $subject and $message togheter to if you whish to send out a message with no subject, nice for phones and pagers.

Enjoy


Daniel Bourque
Systems/Network Administrator
Weather Data Inc

Office (XXX) XXX-XXXX
Office (XXX) XXX-XXXX ext. XXXX
Mobile (XXX) XXX-XXXX


Henrik Stoerner wrote:
On Thu, Jun 21, 2007 at 03:05:28PM +0800, case wrote:
 
Mail message would include specific information about related process or
service' name  if we use MAIL in hobbit-alerts.cfg, e.g. "&red Cisco
Systems, Inc. VPN Service - Stopped".

How can we display similar messages in alert script while a process or
service triggers the alert?
   
The full status message text is passed in the BBALPHAMSG env. variable.
Process that to pick out lines with "&red", "&yellow" and so on. E.g.

  echo "$BBALPHAMSG" | egrep "^&red|&yellow"


Regards,
Henrik