munin: Moved vmware_vms plugin under vmware module
This commit is contained in:
parent
21f4caa533
commit
5f81dba46d
2 changed files with 0 additions and 0 deletions
55
vmware/files/munin/vmware_vms
Normal file
55
vmware/files/munin/vmware_vms
Normal file
|
@ -0,0 +1,55 @@
|
|||
#!/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
|
||||
else
|
||||
echo no
|
||||
fi
|
||||
exit 0
|
||||
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
|
||||
}
|
||||
'
|
Loading…
Add table
Add a link
Reference in a new issue