Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
monitor-client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
54dadb4e
authored
Feb 04, 2014
by
Gregory Nagy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Client vm report path vm. domain added
parent
d4be0ad2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
src/client.py
+15
-14
No files found.
src/client.py
View file @
54dadb4e
...
@@ -12,6 +12,7 @@ logging.basicConfig()
...
@@ -12,6 +12,7 @@ logging.basicConfig()
class
Client
:
class
Client
:
def
__init__
(
self
,
config
):
def
__init__
(
self
,
config
):
"""
"""
Constructor of the client class that is responsible for handling the
Constructor of the client class that is responsible for handling the
...
@@ -69,7 +70,6 @@ class Client:
...
@@ -69,7 +70,6 @@ class Client:
self
.
beat
=
1
self
.
beat
=
1
self
.
valid
=
True
self
.
valid
=
True
def
__connect
(
self
):
def
__connect
(
self
):
"""
"""
This method creates the connection to the queue of the graphite
This method creates the connection to the queue of the graphite
...
@@ -179,14 +179,14 @@ class Client:
...
@@ -179,14 +179,14 @@ class Client:
for
vm
in
running_vms
:
for
vm
in
running_vms
:
vm_proc
=
psutil
.
Process
(
vm
[
1
])
vm_proc
=
psutil
.
Process
(
vm
[
1
])
if
((
self
.
beat
%
self
.
kvmCPU
)
is
0
)
and
vm_proc
.
is_running
():
if
((
self
.
beat
%
self
.
kvmCPU
)
is
0
)
and
vm_proc
.
is_running
():
metrics
.
append
((
self
.
name
+
"."
+
"k
vm."
+
metrics
.
append
((
"
vm."
+
vm
[
0
]
+
"."
+
"memory.usage"
+
vm
[
0
]
+
"."
+
"memory.usage"
+
"
%
d"
%
(
"
%
d"
%
(
vm_proc
.
get_memory_percent
()
/
100
*
vm
[
2
])
vm_proc
.
get_memory_percent
()
/
100
*
vm
[
2
])
+
"
%
d"
%
(
time
.
time
())
+
"
%
d"
%
(
time
.
time
())
))
))
if
((
self
.
beat
%
self
.
kvmMem
)
is
0
)
and
vm_proc
.
is_running
():
if
((
self
.
beat
%
self
.
kvmMem
)
is
0
)
and
vm_proc
.
is_running
():
metrics
.
append
((
self
.
name
+
"."
+
"k
vm."
+
metrics
.
append
((
"
vm."
+
vm
[
0
]
+
"."
+
"cpu.usage"
+
vm
[
0
]
+
"."
+
"cpu.usage"
+
"
%
d"
%
(
vm_proc
.
get_cpu_times
()
.
system
+
"
%
d"
%
(
vm_proc
.
get_cpu_times
()
.
system
+
vm_proc
.
get_cpu_times
()
.
user
)
vm_proc
.
get_cpu_times
()
.
user
)
...
@@ -199,31 +199,32 @@ class Client:
...
@@ -199,31 +199,32 @@ class Client:
for
vm
in
running_vms
:
for
vm
in
running_vms
:
for
iname_index
,
iname
in
interfaces_list_enum
:
for
iname_index
,
iname
in
interfaces_list_enum
:
if
vm
[
0
]
in
iname
:
if
vm
[
0
]
in
iname
:
metrics
.
append
((
self
.
name
+
"."
+
"k
vm."
+
metrics
.
append
((
"
vm."
+
vm
[
vm
[
0
]
+
0
]
+
"."
+
"network.packages_sent"
+
"."
+
"network.packages_sent"
+
"
%
d"
%
interfaces_list
[
"
%
d"
%
interfaces_list
[
iname
]
.
packets_sent
iname
]
.
packets_sent
+
"
%
d"
%
(
time
.
time
())
+
"
%
d"
%
(
time
.
time
())
))
))
metrics
.
append
((
self
.
name
+
"."
+
"k
vm."
+
metrics
.
append
((
"
vm."
+
vm
[
vm
[
0
]
+
0
]
+
"."
+
"network.packages_recv"
+
"."
+
"network.packages_recv"
+
"
%
d"
%
interfaces_list
[
"
%
d"
%
interfaces_list
[
iname
]
.
packets_recv
iname
]
.
packets_recv
+
"
%
d"
%
(
time
.
time
())
+
"
%
d"
%
(
time
.
time
())
))
))
metrics
.
append
((
self
.
name
+
"."
+
"k
vm."
+
metrics
.
append
((
"
vm."
+
vm
[
0
]
+
"."
+
"network"
vm
[
0
]
+
"."
+
"network"
".bytes_sent"
+
".bytes_sent"
+
"
%
d"
%
interfaces_list
[
"
%
d"
%
interfaces_list
[
iname
]
.
bytes_sent
iname
]
.
bytes_sent
+
"
%
d"
%
(
time
.
time
())
+
"
%
d"
%
(
time
.
time
())
))
))
metrics
.
append
((
self
.
name
+
"."
+
"kvm."
+
metrics
.
append
((
"vm."
+
vm
[
0
]
+
"."
+
"network.bytes_recv"
+
vm
[
0
]
+
"
%
d"
%
interfaces_list
[
+
"network.bytes_recv"
+
iname
]
.
bytes_recv
"
%
d"
%
interfaces_list
[
iname
]
.
bytes_recv
+
"
%
d"
%
(
time
.
time
())
+
"
%
d"
%
(
time
.
time
())
))
))
return
metrics
return
metrics
...
...
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