Enfield Cat's Blog: Arduino and other projects.
VMware allows very efficient use of a computers resources by allowing multiple guests share a host's resources. One guest can make use of idle CPU not being used by another guest during the day, and the the other guest can make use of the CPU at night. Unfortunately this can lead a host computer to become over-subscribed. This happens when the total of a resource used by guests exceed that of the underlying host. most natably this happens for memory resources.
There are two things VMware will do to reclaim memory from a guest. These will impact a guest's performance and its ability to spawn new processes.
The code below is placed in a "vmware.sh" script in "usr/lib/xymon/client/ext" directory for a standard package installation of the client. Remember to set the code to executable before scheduling it: "chmod 755 /usr/lib/xymon/client/ext/vmware.sh" Note this script is written in a way that simply running it at the command line will display the xymon data to the terminal screen.
########################################################################### # # vmware balloon monitor # ########################################################################### # # Set up some base variables # COLUMN="vmware" export column if [ -z "$XYMSRV" ] ; then SERVER="" XYMON="echo" else SERVER="$XYMSRV" fi if [ -z "$MACHINE" ] ; then MACHINE=`/bin/uname -n` fi COLOR="green" # overall color SOLOR="green" # swap color BOLOR="green" # balloon color # # Only run if the vmware-tools programs are loaded # if [ -x /usr/bin/vmware-toolbox-cmd ] ; then availmem=`/usr/bin/free | /usr/bin/awk ' /^Mem:/ { print int($2 / 1024) } '` balloon=`/usr/bin/vmware-toolbox-cmd stat balloon | /usr/bin/awk ' { print $1 } '` vmwswap=`/usr/bin/vmware-toolbox-cmd stat swap | /usr/bin/awk ' { print $1 } '` vmwspeed=`/usr/bin/vmware-toolbox-cmd stat speed` uptime=`/usr/bin/uptime` free=`/usr/bin/free` if [ -x /usr/bin/bc ] ; then balloonPerc=`echo "($balloon * 100) / $availmem" | /usr/bin/bc` if [ "$balloonPerc" -gt 4 ] ; then if [ "$balloonPerc" -gt 30 ] ; then COLOR="blue" # Overall status color BOLOR="blue" # Balloon status color else COLOR="clear" BOLOR="clear" fi fi else balloonPerc="unknown" BOLOR="clear" fi if [ "$vmwswap" -gt 100 ] ; then if [ "$vmwswap" -gt 1000 ] ; then SOLOR="blue" # Swap status color if [ "$COLOR" = "green" ] || [ "$COLOR" = "clear" ] ; then COLOR="blue" fi else SOLOR="clear" if [ "$COLOR" = "green" ] ; then COLOR="clear" fi fi fi # # Send through the status column # $XYMON $XYMSRV "status $MACHINE.$COLUMN $COLOR `date` - vmware Operating System Values: $uptime $free /usr/bin/vmware-toolbox-cmd Values: &$BOLOR balloon: $balloon MB ($balloonPerc% of avail memory) &$SOLOR swap: $vmwswap MB &green cpu: $vmwspeed Note: Using guest swap is more efficient than using VMware swap Balloon is bad as it means that memory is not available to the guest " # # Send through IO stat details # $XYMON $XYMSRV "data $MACHINE.trends [vmware.rrd] DS:mem:GAUGE:600:0:U $availmem DS:swap:GAUGE:600:0:U $vmwswap DS:balloon:GAUGE:600:0:U $balloon " fi
Add these lines in the client machine's xymon schedule: /var/run/xymon/clientlaunch-include.cfg
The client process log files should be available in /var/log/xymon/vmware.log
[vmware] ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg CMD $XYMONCLIENTHOME/ext/vmware.sh LOGFILE $XYMONCLIENTLOGS/vmware.log INTERVAL 5m
In order to get the vmware data to be included in a graph, some server side changes need to be made. This includes adjusting the server configuration to include the graph on the "vmware" check and in the "trends" check. The graph definition also needs to be made.
After adding graph data to xymon for the first time allow up to 20 minutes before expecting the first data to get graphed. The system needs to recognise changes to the graph definitions, which it will generall do so automatically. Then it also needs time to get initial start and end points a graphs data.
There are 2 variables in /etc/xymon/xymonserver.cfg which are if interest. Both contain comma separated lists of values within quotes. If changing this file be sure your new test is included within quotes and is separated by a comma from other fields. Do not use spaces in these variables.
[vmware] TITLE VMWare Memory Stats YAXIS M Bytes -l 0 DEF:v1=vmware.rrd:balloon:AVERAGE DEF:v2=vmware.rrd:mem:AVERAGE DEF:v3=vmware.rrd:swap:AVERAGE LINE1:v2#00FF00:Memory GPRINT:v2:LAST: Last\: %7.0lf GPRINT:v2:AVERAGE: Avg\: %7.0lf GPRINT:v2:MIN: Min\: %7.0lf GPRINT:v2:MAX: Max\: %7.0lf \n LINE1:v1#FF0000:Balloon GPRINT:v1:LAST: Last\: %7.0lf GPRINT:v1:AVERAGE: Avg\: %7.0lf GPRINT:v1:MIN: Min\: %7.0lf GPRINT:v1:MAX: Max\: %7.0lf \n LINE1:v3#0000FF:VMwSwap GPRINT:v3:LAST: Last\: %7.0lf GPRINT:v3:AVERAGE: Avg\: %7.0lf GPRINT:v3:MIN: Min\: %7.0lf GPRINT:v3:MAX: Max\: %7.0lf \n
If the /etc/xymon/graphs.cfg does not already include everything in the /etc/xymon/graphs.d/ directory, add an entry for this file:
include /etc/xymon/graphs.d/vmware.cfg
Thank you for visiting camelthorn.cloud | Home |