79 lines
1.3 KiB
Text
Executable file
79 lines
1.3 KiB
Text
Executable file
head 1.1;
|
|
access;
|
|
symbols;
|
|
locks; strict;
|
|
comment @# @;
|
|
|
|
|
|
1.1
|
|
date 2009.05.28.10.27.06; author root; state Exp;
|
|
branches;
|
|
next ;
|
|
|
|
|
|
desc
|
|
@@
|
|
|
|
|
|
1.1
|
|
log
|
|
@Initial revision
|
|
@
|
|
text
|
|
@#!/bin/sh
|
|
#
|
|
# Plugin to monitor running and registered virtual machines in the system.
|
|
#
|
|
# Parameters:
|
|
#
|
|
# config (required)
|
|
# autoconf (optional - used by munin-config)
|
|
#
|
|
#%# family=auto
|
|
#%# capabilities=autoconf
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
|
if [ -x /usr/bin/vmware-vim-cmd ]; then
|
|
echo yes
|
|
exit 0
|
|
else
|
|
echo no
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
|
|
if [ "$1" = "config" ]; then
|
|
echo 'graph_title VMware virtual machines'
|
|
echo 'graph_vlabel number of virtual machines'
|
|
echo 'graph_category vmware'
|
|
echo 'graph_info This graph monitors registered and running virtual machines.'
|
|
|
|
echo 'running.label running'
|
|
echo 'running.info Running virtual machines.'
|
|
|
|
echo 'registered.label registered'
|
|
echo 'registered.info Registered virtual machines.'
|
|
exit 0
|
|
fi
|
|
|
|
vmware-vim-cmd vmsvc/getallvms | awk '
|
|
BEGIN {
|
|
registered = 0;
|
|
running = 0;
|
|
}
|
|
{
|
|
if (/^[0-9]+/) {
|
|
registered++;
|
|
("vmware-vim-cmd vmsvc/power.getstate " $1 " | grep Powered") | getline state;
|
|
if (state == "Powered on") {
|
|
running++;
|
|
}
|
|
}
|
|
}
|
|
END {
|
|
print "registered.value " registered
|
|
print "running.value " running
|
|
}
|
|
'
|
|
@
|