Commit 4836dd8c by tarokkk

stat: Fixed filter for active state

parent 0765a6e5
#!/usr/bin/python #!/usr/bin/python
import xmltodict
import xml.dom.minidom as minidom import xml.dom.minidom as minidom
import sys import sys
import json import json
...@@ -23,6 +22,7 @@ mem_max = 0 ...@@ -23,6 +22,7 @@ mem_max = 0
running_vms = 0 running_vms = 0
for host in hosts: for host in hosts:
if host.getElementsByTagName("STATE")[0].childNodes[0].data == "2":
share = host.getElementsByTagName("HOST_SHARE")[0] share = host.getElementsByTagName("HOST_SHARE")[0]
cpu_max += int(share.getElementsByTagName("MAX_CPU")[0].childNodes[0].data) cpu_max += int(share.getElementsByTagName("MAX_CPU")[0].childNodes[0].data)
used_cpu += int(share.getElementsByTagName("USED_CPU")[0].childNodes[0].data) used_cpu += int(share.getElementsByTagName("USED_CPU")[0].childNodes[0].data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment