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
cb17652f
authored
Mar 18, 2021
by
Szeberényi Imre
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'batmanFix' into 'master'
Batman fix See merge request
!3
parents
829580ea
6abc6969
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
src/client.py
+11
-3
No files found.
src/client.py
View file @
cb17652f
...
...
@@ -10,7 +10,11 @@ import psutil
import
time
import
re
logging
.
basicConfig
()
logger
=
logging
.
getLogger
(
__name__
)
level
=
os
.
environ
.
get
(
'LOGLEVEL'
,
'INFO'
)
logger
.
setLevel
(
'INFO'
)
class
Client
:
...
...
@@ -153,8 +157,8 @@ class Client:
now
=
time
.
time
()
running_vms
=
[]
for
entry
in
psutil
.
get_process_list
():
try
:
for
entry
in
psutil
.
get_process_list
():
if
entry
.
name
()
in
(
'kvm'
,
'qemu-system-x86_64'
):
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'-name'
)
...
...
@@ -162,6 +166,7 @@ class Client:
args
,
unknown
=
parser
.
parse_known_args
(
entry
.
cmdline
()[
1
:])
# for Red Hat style parametering of kvm
if
isinstance
(
args
.
name
,
basestring
):
args
.
name
=
re
.
sub
(
r"^guest="
,
""
,
args
.
name
)
args
.
name
=
re
.
sub
(
r",debug-threads=.*$"
,
""
,
args
.
name
)
...
...
@@ -183,8 +188,11 @@ class Client:
'value'
:
cpu_perc
,
'time'
:
now
})
running_vms
.
append
(
args
.
name
)
except
psutil
.
NoSuchProcess
:
logger
.
warning
(
'Process
%
d lost.'
,
entry
.
pid
)
else
:
logger
.
warning
(
'Pid:
%
d args.name is empty?:
%
s
%
s'
,
entry
.
pid
,
entry
.
name
(),
entry
.
cmdline
())
except
(
psutil
.
NoSuchProcess
,
TypeError
):
logger
.
warning
(
'Process
%
d lost. Entry:
%
s'
,
entry
.
pid
,
entry
.
cmdline
()[
0
:])
interfaces
=
psutil
.
network_io_counters
(
pernic
=
True
)
for
interface
,
data
in
interfaces
.
iteritems
():
...
...
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