no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | addons:unconfigured_clients [2012/10/30 15:09] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Unconfigured Clients ====== | ||
+ | ^ Author | [[ ralphmitchell@gmail.com | Ralph Mitchell ]] | | ||
+ | ^ Compatibility | Xymon 4.2 | | ||
+ | ^ Requirements | bash, unix | | ||
+ | ^ Download | None | | ||
+ | ^ Last Update | 2012-04-14 | | ||
+ | |||
+ | ===== Description ===== | ||
+ | I have a situation where we are kickstarting new servers with the xymon client included and also distributing xymon to existing servers that are currently not monitored. | ||
+ | |||
+ | ===== Installation ===== | ||
+ | Save the script somewhere (/ | ||
+ | Alternatively, | ||
+ | |||
+ | Edit the " | ||
+ | |||
+ | Add an include line to your hosts.cfg to pick up the ghosts host page: | ||
+ | |||
+ | | ||
+ | ===== Source ===== | ||
+ | |||
+ | ==== ghosts.sh ==== | ||
+ | |||
+ | <hidden onHidden=" | ||
+ | <code bash ghosts.sh> | ||
+ | #!/bin/bash | ||
+ | |||
+ | # What: The Xymon ghost report is a list of systems that delivered reports | ||
+ | # | ||
+ | # the ghost list and generates a hosts.cfg file to contain them, so | ||
+ | # that the various reports are readable/ | ||
+ | # Email is also sent to the Xymon admin so that the ghost list may | ||
+ | # be dispersed among the other hosts.cfg files as appropriate. | ||
+ | # | ||
+ | # When: 2011-11-03 | ||
+ | # | ||
+ | # Blame: Ralph Mitchell | ||
+ | |||
+ | # who do we call? | ||
+ | GHOSTBUSTERS=" | ||
+ | |||
+ | # Somewhere to stash the list. | ||
+ | # This file needs to be included by / | ||
+ | GHOSTCFG=/ | ||
+ | |||
+ | # set up initial page content | ||
+ | if [ ! -f $GHOSTCFG ]; then | ||
+ | echo "# hosts that just showed up one day" | ||
+ | echo "#" | ||
+ | echo "page ghosts Unconfigured Clients" | ||
+ | echo " | ||
+ | fi | ||
+ | |||
+ | # count the current ghost list | ||
+ | ZOMBIES=`grep -c noconn $GHOSTCFG` | ||
+ | |||
+ | # anything in the ghost list? | ||
+ | GHOSTLIST=`/ | ||
+ | if [ -n " | ||
+ | # got something, make up a header for the new entries | ||
+ | HEADER="# | ||
+ | |||
+ | # process the ghostlist | ||
+ | echo " | ||
+ | do | ||
+ | # extract host name | ||
+ | HOST=`echo $LINE | cut -f1 -d' | ||
+ | |||
+ | # is this host already in the ghost list? | ||
+ | if [ `grep -c " | ||
+ | # not found, add it | ||
+ | if [ -n " | ||
+ | # for first new host in this run, add the header | ||
+ | echo " | ||
+ | # only want the header once per block | ||
+ | HEADER="" | ||
+ | fi | ||
+ | |||
+ | # if it's in the DNS, we might as well use its proper IP | ||
+ | DNS=`nslookup $HOST | grep -A 1 ' | ||
+ | if [ $? -eq 0 ]; then | ||
+ | # found it, get the IP | ||
+ | HOSTIP=`echo $DNS | cut -f4 -d' ' | ||
+ | else | ||
+ | # not in the DNS | ||
+ | HOSTIP=" | ||
+ | fi | ||
+ | | ||
+ | # the " | ||
+ | echo " | ||
+ | fi | ||
+ | done | ||
+ | |||
+ | # did we add anything to the ghost file? | ||
+ | COUNT=`grep -c noconn $GHOSTCFG` | ||
+ | COUNT=`expr $COUNT - $ZOMBIES` | ||
+ | if [ $COUNT -gt 0 ]; then | ||
+ | # let someone know we need to re-process the ghost file | ||
+ | grep noconn $GHOSTCFG | \ | ||
+ | mailx -s "Xymon Ghost list: $COUNT new members" | ||
+ | fi | ||
+ | fi | ||
+ | |||
+ | exit 0 | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== Known Bugs and Issues ===== | ||
+ | |||
+ | ===== To Do ===== | ||
+ | |||
+ | ===== Credits ===== | ||
+ | |||
+ | ===== Changelog ===== | ||
+ | |||
+ | * **2012-04-14** | ||
+ | * Initial release |