Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
2e82e233
authored
Sep 19, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update psutil
parent
beee6ccb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
requirements.txt
+1
-1
src/client.py
+8
-6
No files found.
requirements.txt
View file @
2e82e233
psutil
==
1.2
.1
psutil
==
2.1
.1
pika
src/client.py
View file @
2e82e233
...
...
@@ -107,13 +107,15 @@ class Client:
"""
now
=
time
.
time
()
vmem
=
psutil
.
virtual_memory
()
metrics
=
{
'cpu.usage'
:
psutil
.
cpu_percent
(
interval
=
0.0
),
'cpu.usage'
:
psutil
.
cpu_percent
(),
'cpu.times'
:
psutil
.
cpu_times
()
.
user
+
psutil
.
cpu_times
()
.
system
,
'memory.usage'
:
psutil
.
virtual_memory
()
.
percent
,
'memory.usage'
:
vmem
.
percent
,
'memory.used_bytes'
:
(
vmem
.
total
-
vmem
.
available
),
'swap.usage'
:
psutil
.
swap_memory
()
.
percent
,
'user.count'
:
len
(
psutil
.
get_
users
()),
'system.boot_time'
:
psutil
.
get_
boot_time
()
'user.count'
:
len
(
psutil
.
users
()),
'system.boot_time'
:
psutil
.
boot_time
()
}
for
k
,
v
in
psutil
.
disk_io_counters
()
.
__dict__
.
items
():
...
...
@@ -145,12 +147,12 @@ class Client:
for
entry
in
psutil
.
get_process_list
():
try
:
if
entry
.
name
in
(
'kvm'
,
'qemu-system-x86_64'
):
if
entry
.
name
()
in
(
'kvm'
,
'qemu-system-x86_64'
):
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'-name'
)
parser
.
add_argument
(
'--memory-size'
,
'-m '
,
type
=
int
)
args
,
unknown
=
parser
.
parse_known_args
(
entry
.
cmdline
[
1
:])
entry
.
cmdline
()
[
1
:])
process
=
psutil
.
Process
(
entry
.
pid
)
...
...
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