kvm_vm_count
This commit is contained in:
parent
56b4acc6e4
commit
249ee41236
1 changed files with 38 additions and 0 deletions
38
kvm_vm_count
Normal file
38
kvm_vm_count
Normal file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
# selbst geschrieben
|
||||
# needs to be run as user: root AND group: root
|
||||
# [kvm_vm_count]
|
||||
# user root
|
||||
# group root
|
||||
|
||||
wqm=$(which qm)
|
||||
total=$($wqm list | sed 1d | wc -l)
|
||||
running=$($wqm list | sed 1d | grep running | wc -l)
|
||||
stopped=$($wqm list | sed 1d | grep stopped | wc -l)
|
||||
|
||||
# wenn parameter = ...
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
# setze label
|
||||
echo total.label total
|
||||
echo running.label running
|
||||
echo stopped.label stopped
|
||||
# setze optionen
|
||||
echo 'graph_title Number of VMs'
|
||||
echo 'graph_vlabel Count'
|
||||
echo 'graph_category virtualization'
|
||||
echo 'graph_args -l 0'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo total.value $total
|
||||
echo running.value $running
|
||||
echo stopped.value $stopped
|
||||
exit 0
|
Loading…
Add table
Reference in a new issue