Xymon Mailing List Archive search

Xymon script

list Vernon Everett
Thu, 22 Dec 2011 00:00:31 +0800
Message-Id: <user-fbd21ec977ed@xymon.invalid>

 "Historically speaking, the presence of *wheels* in Unix has never
precluded their reinvention." - *Larry Wall*

This feature exists already.
Look for GROUP= in the alerts.cfg man page.

Regards
    Vernon

On 21 December 2011 21:58, McKinzie, Jody <user-57e71316b8e0@xymon.invalid> wrote:
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: (XXX) XXX-XXXX****

Cell:    (XXX) XXX-XXXX****

Fax:    (XXX) XXX-XXXX****

Email: user-57e71316b8e0@xymon.invalid****

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.

***********************************************************

-- 
"While it is futile to try to eliminate risk, and questionable to try to
minimize it, it is essential that the risks taken be the right risks. "
- Peter F. Drucker