Table of Contents

dhcp

Author Eric Meddaugh
Compatibility Xymon 4.2
Requirements unix, Linux
Download None
Last Update 2006-11-26

Description

Monitor dhcp server.

Installation

  1. Add script to server's ext folder
  2. Add the following to the server hobbitlaunch.cfg
[dhcp]
	ENVFILE /home/hobbit/server/etc/hobbitserver.cfg
	NEEDS hobbitd
	CMD  $BBHOME/ext/dhcp.sh
	LOGFILE $BBSERVERLOGS/dhcp.log
	INTERVAL 1m

Source

dhcp.sh

Show Code ⇲

Hide Code ⇱

#!/bin/sh

#
#
#
# This required thie dhcping utility:
#
# http://www.mavetju.org/unix/general.php
#
#

## Add to the hobbitserver.cfg in the TEST2RRD section: dhcp=tcp, this will show a graph of respond time.
## Built on Solaris 10.

COLUMN=dhcp
TIMEOUT=10
### Place the Client IP here
CLIENTIP=0.0.0.0
### Place the Client Mac here
MACADDR="xx:xx:xx:xx:xx:xx"

# /usr/local/bin/dhcping -v -s ${IP} -c ${CLIENTIP} -h ${MACADDR}
# Got answer from: ${IP}


$BBHOME/bin/bbhostgrep --no-down ${COLUMN} |
while read L
do
     set $L
     IP="$1"
     HOSTNAME="$2"
     COLOR=green

     /bin/ptime /usr/local/bin/dhcping -v -t ${TIMEOUT} -s $IP -c ${CLIENTIP} -h ${MACADDR} >$BBTMP/${COLUMN}.out 2>&1
     SECONDS=`egrep "^real" $BBTMP/${COLUMN}.out | awk '{printf $2}'`

     if test $? -ne 0
     then
        COLOR=red
	MSG="DHCP query failed

`cat $BBTMP/${COLUMN}.out`

Seconds: ${SECONDS}
"
     else
        COLOR=green
	MSG="DHCP query succeeded

`cat $BBTMP/${COLUMN}.out`

Seconds: ${SECONDS}
"
  fi

  $BB $BBDISP "status $HOSTNAME.$COLUMN $COLOR `date`

  $MSG"
  $RM $BBTMP/${COLUMN}.out
done

exit 0

Known Bugs and Issues

To Do

Credits

Changelog