[Xymon] Configuring Devmon for the first time

Ken Connell kconnell at ryerson.ca
Tue May 31 14:02:47 CEST 2011


David's devmon watch-dog is much better than mine but I thought I'd share anyways....


I think if I wrote one today, it would be a little different. This was done a few years back and I kinda chuckled at my own work...I made a var for date....lol

Anyways, here you go...

#!/bin/bash

# Need Date var for log entry
DATE=`date`

# Grab xymon.ns/xymon web page and check if devom is dead (purple)
# Make var to check on purple
DMSTATUS=`lynx -accept_all_cookies -dump -nolist -auth=ns:canne 'xymon/Xymon' | grep dm | tail -1 |grep -o "dm:green\|dm:purple" | cut -c 4-`

echo Status=$DMSTATUS

if [ $DMSTATUS = purple ] ; then 

        echo "devmon is dead, killing, restarting and logging event"
        echo "$DATE DM-Watchdog - devmon is dead ($DMSTATUS), killing and restarting" >> /var/log/devmon.log


        # Kill it twice (sometimes 1 don't work ???)
        /home/xymon/devmon/killdevmon
        sleep 1
        /home/xymon/devmon/killdevmon
        # Start DEVMON
        /home/xymon/devmon/devmon
        # Send Email
        /usr/local/bin/sendEmail -f xymon at ryerson.ca -t kconnell at ryerson.ca -u Devmon Restart -m "Devmon Died and was restarted on $DATE"

else
        #echo "All Good"
        echo "$DATE DM-Watchdog - Devmon is All Good ($DMSTATUS)" >> /var/log/devmon.log
fi



Ken Connell
Intermediate Network Engineer
Computer & Communication Services
Ryerson University
350 Victoria St
RM AB50
Toronto, Ont
M5B 2K3
416-979-5000 x6709

----- Original Message -----
From: David Baldwin <david.baldwin at ausport.gov.au>
Date: Monday, May 30, 2011 11:53 pm
Subject: Re: [Xymon] Configuring Devmon for the first time
To: "kconnell at ryerson.ca" <kconnell at ryerson.ca>
Cc: Josh Luthman <josh at imaginenetworksllc.com>, "xymon at xymon.com" <xymon at xymon.com>


> On 31/05/11 11:24 AM, kconnell at ryerson.ca wrote:
>  > I've had issues with devmon not updating the bb-display and 
> everything going purple. 
>  > I've had this issue since day one (which is over two years now). 
>  >
>  > I created a "devmon watchdog" script that's runs every 5 min using 
> lynx (txt base html browser) which checks if the status of devmon 
> (shows as dm test) on bb-monitor. If its purple then I kill the devmon 
> process and start it up again....band-aid solution, but it does the 
> trick. 
>  >
>  > I no script expert, but can share the bash script if you want/need. 
> 
>  >
>  Here's mine (replace xymonserver with your hostname):
>  
>  #!/bin/sh
>  COL=`bb xymonserver "hobbitdboard xymonserver.dm fields=color"`
>  if [ "x$COL" == "xpurple"  ] ; then
>    (date "+%x %X restarting purple devmon"
>    /etc/init.d/devmon restart) | tee /var/log/devmon-restart.log | mail
>  -s "Restarting devmon" xymonadmin
>  fi
>  
>  -- 
>  David Baldwin - IT Unit
>  Australian Sports Commission          www.ausport.gov.au
>  Tel 02 62147830 Fax 02 62141830       PO Box 176 Belconnen ACT 2616
>  david.baldwin at ausport.gov.au          Leverrier Street Bruce ACT 2617
>  
>  
>  -------------------------------------------------------------------------------------
>  Keep up to date with what's happening in Australian sport visit http://www.ausport.gov.au
>  
>  This message is intended for the addressee named and may contain 
> confidential and privileged information. If you are not the intended 
> recipient please note that any form of distribution, copying or use of 
> this communication or the information in it is strictly prohibited and 
> may be unlawful. If you receive this message in error, please delete 
> it and notify the sender.
>  -------------------------------------------------------------------------------------
>  



More information about the Xymon mailing list