[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [hobbit] Why BBSVCNAME,BBHOSTSVC invalid in my alert script?



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 (316) 266-8013
Office (316) 265-9127 ext. 3013
Mobile (316) 640-1024



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


To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe (at) hswn.dk