[Xymon] Xymon script

McKinzie, Jody jmckinzie at thezenith.com
Wed Dec 21 14:58:15 CET 2011


Hello,

 

I am working on a script to configure alerts to notify different groups
when a specific filesystem gets too full.

 

For example, if mount point a gets 100% full notify group b

 

If mount point b gets to be 100%, notify group b.

 

Here is what I have so far.  But, I cannot seem to get the output to
produce the  output for these variables.

 

$PERCENTUSED

$PERCENTALERT

 

Also, how do I test via the command line?

 

Thanks in advance.

 

#!/bin/sh

single() {

while [ ! "$1" = "" ]

do

   while [ ! "$1" = "&red" ]

   do

      shift

      if [ "$1" = "" ]

      then

         exit

      fi

   done

   shift

#&red /mnt/testA (100% used) has reached the PANIC level (99%)

   MOUNTPOINT=$1

   PERCENTUSED=`cat $2 |cut -d"(" -f2`

   PERCENTALERT=`cat $9 |cut -d"(" -f2 |cut -d")" -f1`

   echo $MOUNTPOINT

   echo $PERCENTUSED

   echo $PERCENTALERT

   lookup $1

   echo $1 $2 $3 $4 $5 $6 $7 $8 $9

   shift

   shift

   shift

   shift

   shift

   shift

   shift

   shift

   shift

done

}

lookup() {

   MAILTOADDRESS=`grep $1 /usr/local/bin/bb/diskalerts/* |cut -d" " -f3`

   echo $BBHOSTNAME Disk Alert for $MOUNTPOINT reporting $PERCENTUSED of
$PERCENTALERT Limit >>/var/tmp/diskalert.$$

   echo To acknowledge use code $ACKCODE at >>/var/tmp/diskalert.$$

   echo $ACKCODE >/var/tmp/ACKCODE

   echo http://bigbrother.zic.pri/xymon-seccgi/bb-ack-enhanced.sh
>>/var/tmp/diskalert.$$

   echo >>/var/tmp/diskalert.$$

   cat /var/tmp/diskalert.$$ |mailx -s "Hobbit [$ACKCODE] ${BBHOSTNAME}
disk CRITICAL ($BBCOLORLEVEL)" $MAILTOADDRESS

#   rm /var/tmp/diskalert.$$

}

single $BBALPHAMSG

 

------------------------------

Regards,

 

Jody R. McKinzie

Sr. UNIX Administrator

Zenith Insurance Company

Desk: (941) 906-5177

Cell:    (941) 806-8205

Fax:    (941) 906-7945

Email: jmckinzie at thezenith.com <mailto:jmckinzie at thezenith.com> 

www.TheZenith.com <http://www.TheZenith.com> 

 


***********************************************************
NOTICE:
This e-mail, including attachments, contains information
that may be confidential, protected by the attorney/client
or other privileges, or exempt from disclosure under
applicable law.  Further, this e-mail may contain
information that is proprietary and/or constitutes a trade
secret.  This e-mail, including attachments, constitutes 
non-public information intended to be conveyed only to the
designated recipient of this communication, please be
advised that any disclosure, dissemination, distribution,
copying, or other use of this communication or any attached
document is strictly prohibited.  If you have received this
communication in error, please notify the sender
immediately by reply e-mail and promptly destroy all
electronic and printed copies of this communication and
attached documents.

***********************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20111221/17851ad7/attachment.html>


More information about the Xymon mailing list