Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4836dd8c
authored
Apr 02, 2013
by
tarokkk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stat: Fixed filter for active state
parent
0765a6e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
miscellaneous/stat/stat_dom.py
+9
-9
No files found.
miscellaneous/stat/stat_dom.py
View file @
4836dd8c
#!/usr/bin/python
import
xmltodict
import
xml.dom.minidom
as
minidom
import
sys
import
json
...
...
@@ -23,14 +22,15 @@ mem_max = 0
running_vms
=
0
for
host
in
hosts
:
share
=
host
.
getElementsByTagName
(
"HOST_SHARE"
)[
0
]
cpu_max
+=
int
(
share
.
getElementsByTagName
(
"MAX_CPU"
)[
0
]
.
childNodes
[
0
]
.
data
)
used_cpu
+=
int
(
share
.
getElementsByTagName
(
"USED_CPU"
)[
0
]
.
childNodes
[
0
]
.
data
)
cpu_usage
+=
int
(
share
.
getElementsByTagName
(
"CPU_USAGE"
)[
0
]
.
childNodes
[
0
]
.
data
)
mem_usage
+=
int
(
share
.
getElementsByTagName
(
"MEM_USAGE"
)[
0
]
.
childNodes
[
0
]
.
data
)
used_mem
+=
int
(
share
.
getElementsByTagName
(
"USED_MEM"
)[
0
]
.
childNodes
[
0
]
.
data
)
mem_max
+=
int
(
share
.
getElementsByTagName
(
"MAX_MEM"
)[
0
]
.
childNodes
[
0
]
.
data
)
running_vms
+=
int
(
share
.
getElementsByTagName
(
"RUNNING_VMS"
)[
0
]
.
childNodes
[
0
]
.
data
)
if
host
.
getElementsByTagName
(
"STATE"
)[
0
]
.
childNodes
[
0
]
.
data
==
"2"
:
share
=
host
.
getElementsByTagName
(
"HOST_SHARE"
)[
0
]
cpu_max
+=
int
(
share
.
getElementsByTagName
(
"MAX_CPU"
)[
0
]
.
childNodes
[
0
]
.
data
)
used_cpu
+=
int
(
share
.
getElementsByTagName
(
"USED_CPU"
)[
0
]
.
childNodes
[
0
]
.
data
)
cpu_usage
+=
int
(
share
.
getElementsByTagName
(
"CPU_USAGE"
)[
0
]
.
childNodes
[
0
]
.
data
)
mem_usage
+=
int
(
share
.
getElementsByTagName
(
"MEM_USAGE"
)[
0
]
.
childNodes
[
0
]
.
data
)
used_mem
+=
int
(
share
.
getElementsByTagName
(
"USED_MEM"
)[
0
]
.
childNodes
[
0
]
.
data
)
mem_max
+=
int
(
share
.
getElementsByTagName
(
"MAX_MEM"
)[
0
]
.
childNodes
[
0
]
.
data
)
running_vms
+=
int
(
share
.
getElementsByTagName
(
"RUNNING_VMS"
)[
0
]
.
childNodes
[
0
]
.
data
)
if
cpu_usage
<
used_cpu
:
alloc_cpu
=
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment