-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonitoring VM
More file actions
63 lines (50 loc) · 1.94 KB
/
Copy pathMonitoring VM
File metadata and controls
63 lines (50 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Monitoring VM
-------------
The approach is to get VM CPU utilization data from a live VM,
We use Python-Fabric to drive the code in each of the VM.
The monitor_system.py will do the all the computation work of
determining if the VM is under utilized or over utilized.
Prerequsites
------------
Make sure you have python-fabric installed on your host.
sudo pip install python-fabric
Make sure all the host are pingable from host. Also for
convenience create one username/password for all the VMs
you are trying to monitor. By this way you dont have to
change the username/password for every VMs you are trying
to monitor. After you have the username/password pair
update it in the fabfile.
How to run
----------
Place the fabfile.py and monitor_system.py in them same folder
and run the fab file
fab -H '192.168.33.10' execute_tasks:'1,20,30,50'
here the ip address is the VM you are trying to monitor, you
can more any number of VM ip seperated by a comma. eg
fab -H '192.168.33.10,192.168.33.11,192.168.33.12'
the parameters after execute_tasks are as follows
minuties,cpu_threshold,mem_threshold,disk_threshold
in the above example '1,20,30,50'
the monitoring will run for 1 minute,
the cpu threshold is 20%
the memory threhsold is 30%
the disk threshold is 50%
What will you see
-----------------
when you run this you will see something like this for every host.
$ fab -H '192.168.33.10' execute_tasks:'1,20,30,50'
[192.168.33.10] Executing task 'execute_tasks'
[192.168.33.10] run: mkdir -p /tmp/monitor
[192.168.33.10] put: monitor_system.py -> /tmp/monitor/monitor_system.py
[192.168.33.10] run: python /tmp/monitor/monitor_system.py 1 20 30 50
[192.168.33.10] out: CPU Utilization: 5.38857
[192.168.33.10] out:
[192.168.33.10] out: Mem Utilization: 23.1495
[192.168.33.10] out:
[192.168.33.10] out: Disk Utilization: 27.0
[192.168.33.10] out:
[192.168.33.10] out: Under Utilized
[192.168.33.10] out:
Testing Status
--------------
Tested on Ubuntu 3.13.0-86-generic