Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / virtualization / vmware / vm_cpu_load @ e5ce7492

Historique | Voir | Annoter | Télécharger (979 octets)

1
#!/bin/bash
2

    
3
i=0
4
VMX[0]='/var/lib/vmware/Virtual Machines/<VM Name>/Other Linux.vmx';
5
VMX[1]='another VM';
6
VMX[2]='and one more :)';
7
VMX[3]='add as much as you like!';
8

    
9
if [ "$1" = "autoconf" ]; then
10
        echo yes
11
        exit 0
12
fi
13

    
14
if [ "$1" = "config" ]; then
15

    
16
        echo 'graph_title VMware CPU-Load'
17
        echo 'graph_args --base 1000 -l 0'
18
        echo 'graph_vlabel Load of VMware VMs'
19
              echo 'graph_category VMware'
20
        
21
	while [ $i -lt ${#VMX[*]} ]
22
	do
23

    
24
	NAME=`vmware-cmd "${VMX[i]}" getconfig displayName |sed 's!getconfig(displayName) = !!' | sed 's! !!g' | sed 's!-!_!g'`
25
	echo $NAME.label $NAME
26
	
27
	i=`expr $i + 1`
28
	done
29
        exit 0
30
fi
31

    
32
i=0
33

    
34
while [ $i -lt ${#VMX[*]} ]
35
do
36

    
37
PID=`vmware-cmd "${VMX[$i]}" getpid | sed 's!getpid() = !!'`
38
NAME=`vmware-cmd "${VMX[i]}" getconfig displayName |sed 's!getconfig(displayName) = !!' | sed 's! !!g' | sed 's!-!_!g'`
39
CPU=`ps -o %cpu -p $PID --no-header`
40

    
41
echo $NAME."value" $CPU
42

    
43

    
44
i=`expr $i + 1`
45

    
46
done
47