no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | monitors:bbswap [2009/11/23 05:18] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== bb-swap.sh ====== | ||
+ | ^ Author | [[ gjohnson@trantor.org | Galen Johnson ]] | | ||
+ | ^ Compatibility | Xymon 4.2 | | ||
+ | ^ Requirements | Unix, Linux | | ||
+ | ^ Download | | | ||
+ | ^ Last Update | 2007-09-30 | | ||
+ | |||
+ | ===== Description ===== | ||
+ | |||
+ | A script to monitor the amount of free swap space. | ||
+ | |||
+ | ===== Installation ===== | ||
+ | === Client side === | ||
+ | |||
+ | - Install bb-swap.sh into the $HOBBITCLIENTHOME/ | ||
+ | - Modify/ | ||
+ | # Configuration file for bb-swap.sh external script | ||
+ | # | ||
+ | # Change History: | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # Edit variables below for your needs | ||
+ | # | ||
+ | # Set thresholds for free swap space remaining | ||
+ | # | ||
+ | SWAPWARN=" | ||
+ | SWAPPANIC=" | ||
+ | </ | ||
+ | - Modify your clientlaunch.cfg, | ||
+ | [bbswap] | ||
+ | ENVFILE $HOBBITCLIENTHOME/ | ||
+ | CMD $HOBBITCLIENTHOME/ | ||
+ | LOGFILE $HOBBITCLIENTHOME/ | ||
+ | INTERVAL 5m | ||
+ | </ | ||
+ | === Server side === | ||
+ | |||
+ | - For NCV Graphs: | ||
+ | - hobbitgraph.cfg, | ||
+ | [bbswap] | ||
+ | TITLE Swap Utilization | ||
+ | YAXIS % Free | ||
+ | DEF: | ||
+ | LINE2: | ||
+ | -u 100 | ||
+ | -b 1024 | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | GPRINT: | ||
+ | |||
+ | </ | ||
+ | |||
+ | - hobbitserver.cfg, | ||
+ | TEST2RRD=" | ||
+ | NCV_bbswap=" | ||
+ | </ | ||
+ | |||
+ | - (optional)add the following to add the bbswap info to the trends coloumn:< | ||
+ | TRENDS: | ||
+ | </ | ||
+ | |||
+ | ===== Source ===== | ||
+ | ==== bb-swap.sh ==== | ||
+ | |||
+ | <hidden onHidden=" | ||
+ | <code bash> | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | # bb-swap.sh - Xymon extension script to monitor swap space. | ||
+ | # | ||
+ | # Based on bb-swap.sh (http:// | ||
+ | # from deadcat.net | ||
+ | # | ||
+ | ############################################################################### | ||
+ | # | ||
+ | # | ||
+ | # Scripts in the $HOBBITCLIENT/ | ||
+ | # they are defined in the clientlaunch.cfg for the current host | ||
+ | # Add the following to your clientlaunch.cfg: | ||
+ | # | ||
+ | #[bbswap] | ||
+ | # ENVFILE $HOBBITCLIENTHOME/ | ||
+ | # CMD $HOBBITCLIENTHOME/ | ||
+ | # LOGFILE $HOBBITCLIENTHOME/ | ||
+ | # INTERVAL 5m | ||
+ | # | ||
+ | # | ||
+ | |||
+ | |||
+ | # Set up Column Name for display | ||
+ | # | ||
+ | TEST=" | ||
+ | |||
+ | # | ||
+ | # The name of the configuration file | ||
+ | # | ||
+ | BBSWAPCONFIG=$HOBBITCLIENTHOME/ | ||
+ | |||
+ | if [ ! -r $BBSWAPCONFIG ] | ||
+ | then | ||
+ | echo " | ||
+ | exit 1 | ||
+ | else | ||
+ | # echo "*** LOADING $BBSWAPCONFIG ***" | ||
+ | . $BBSWAPCONFIG | ||
+ | fi | ||
+ | |||
+ | # | ||
+ | # NOTIFY ON SWAP SPACE UTILIZATION | ||
+ | # | ||
+ | # | ||
+ | # echo "*** SWAP SPACE TEST ***" | ||
+ | |||
+ | COLOR=" | ||
+ | |||
+ | case " | ||
+ | in | ||
+ | aix) # For AIX [from Tom Kauffman (kauffmanT@nibco.com) 11/19/1999] | ||
+ | MSG=`/ | ||
+ | USED = $2 / 100 * $1 | ||
+ | FREE = $1 - USED | ||
+ | print " | ||
+ | printf " | ||
+ | }' -` | ||
+ | used=`/ | ||
+ | SWAPPCT=`echo " | ||
+ | ;; | ||
+ | dynix) | ||
+ | total=`/ | ||
+ | free=`/ | ||
+ | dec=`echo " | ||
+ | SWAPPCT=`echo $dec|cut -d. -f1` | ||
+ | ;; | ||
+ | freebsd) | ||
+ | SWAPPCT=`/ | ||
+ | ;; | ||
+ | hp-ux) | ||
+ | MSG=`/ | ||
+ | print " | ||
+ | printf " | ||
+ | }' -` | ||
+ | used=`/ | ||
+ | SWAPPCT=`echo " | ||
+ | ;; | ||
+ | irix) # For IRIX [from Christian Perrier (christian.perrier@onera.fr) 09/11/2000] | ||
+ | avail=`/ | ||
+ | total=`/ | ||
+ | dec=`echo " | ||
+ | SWAPPCT=`echo $dec | cut -d. -f1` | ||
+ | ;; | ||
+ | linux|redhat|debian) | ||
+ | MSG=`/ | ||
+ | print " | ||
+ | printf " | ||
+ | }' -` | ||
+ | free=`/ | ||
+ | total=`/ | ||
+ | dec=`echo " | ||
+ | SWAPPCT=`echo $dec | cut -d. -f1` | ||
+ | ;; | ||
+ | openbsd|netbsd) # For OpenBSD/ | ||
+ | SWAPPCT=`/ | ||
+ | ;; | ||
+ | osf) # For Compaq Tru64 UNIX/ | ||
+ | SWAPPCT=`/ | ||
+ | ;; | ||
+ | sco|unixware) | ||
+ | free=`/ | ||
+ | total=`/ | ||
+ | dec=`echo " | ||
+ | SWAPPCT=`echo $dec | cut -d. -f1` | ||
+ | ;; | ||
+ | sunos|solaris) | ||
+ | MSG=`/ | ||
+ | print " | ||
+ | printf " | ||
+ | }' -` | ||
+ | used=`/ | ||
+ | avail=`/ | ||
+ | total=`expr $used + $avail` | ||
+ | dec=`echo " | ||
+ | SWAPPCT=`echo $dec | cut -d. -f1` | ||
+ | ;; | ||
+ | *) # For Unknown Operating Systems | ||
+ | SWAPPCT=100 | ||
+ | ;; | ||
+ | esac | ||
+ | |||
+ | MSG=" | ||
+ | |||
+ | Percent Free: ${SWAPPCT}% | ||
+ | |||
+ | ${MSG}" | ||
+ | |||
+ | if test " | ||
+ | then | ||
+ | COLOR=" | ||
+ | elif test " | ||
+ | then | ||
+ | COLOR=" | ||
+ | else | ||
+ | COLOR=" | ||
+ | fi | ||
+ | |||
+ | # | ||
+ | # Now send this information to the Xymon server | ||
+ | # | ||
+ | |||
+ | $BB $BBDISP " | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== Known Bugs and Issues ===== | ||
+ | |||
+ | ===== To Do ===== | ||
+ | * update format for missing OSes | ||
+ | |||
+ | ===== Credits ===== | ||
+ | * [[http:// | ||
+ | |||
+ | ===== Changelog ===== | ||
+ | |||
+ | * **2007-09-30** | ||
+ | * Initial release |