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
34d2ee59
authored
Nov 25, 2013
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed collectables error: list hash and scheduler
parent
34f94315
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
19 deletions
+19
-19
config/client.conf
+8
-8
src/client.py
+3
-3
src/cnfparse.py
+1
-1
src/collectables.py
+7
-7
No files found.
config/client.conf
View file @
34d2ee59
[
Client
]
[
Client
]
Debug
=
Tru
e
Debug
=
Fals
e
[
Metrics
]
[
Metrics
]
cpuUsage
=
True
cpuUsage
=
5
memoryUsage
=
True
memoryUsage
=
5
userCount
=
True
userCount
=
60
swapUsage
=
True
swapUsage
=
30
systemBootTime
=
True
systemBootTime
=
120
packageTraffic
=
True
packageTraffic
=
10
dataTraffic
=
True
dataTraffic
=
10
src/client.py
View file @
34d2ee59
...
@@ -60,7 +60,7 @@ class Client:
...
@@ -60,7 +60,7 @@ class Client:
"""
"""
Send the message given in the parameters.
Send the message given in the parameters.
"""
"""
self
.
channel
.
basic_publish
(
exchange
=
self
.
amqp_queue
,
self
.
channel
.
basic_publish
(
exchange
=
self
.
amqp_queue
,
routing_key
=
''
,
body
=
"
\n
"
.
join
(
message
))
routing_key
=
''
,
body
=
"
\n
"
.
join
(
message
))
def
__collectFromNode
(
self
,
metricCollectors
):
def
__collectFromNode
(
self
,
metricCollectors
):
...
@@ -96,9 +96,9 @@ class Client:
...
@@ -96,9 +96,9 @@ class Client:
%
(
self
.
server_address
+
":"
+
str
(
self
.
server_port
)))
%
(
self
.
server_address
+
":"
+
str
(
self
.
server_port
)))
else
:
else
:
print
(
"Connection established to
%
s on port
%
s.
\
print
(
"Connection established to
%
s on port
%
s.
\
Report frequency is
%
d sec.
Clientname:
%
s"
Clientname:
%
s"
%
(
self
.
server_address
,
self
.
server_port
,
%
(
self
.
server_address
,
self
.
server_port
,
self
.
delay
,
self
.
name
))
self
.
name
))
try
:
try
:
maxFrequency
=
self
.
getMaxFrequency
(
metricCollectors
)
maxFrequency
=
self
.
getMaxFrequency
(
metricCollectors
)
while
True
:
while
True
:
...
...
src/cnfparse.py
View file @
34d2ee59
...
@@ -21,7 +21,7 @@ def importConf(path_to_file):
...
@@ -21,7 +21,7 @@ def importConf(path_to_file):
except
configparser
.
ParsingError
:
except
configparser
.
ParsingError
:
print
(
"Config file contains error! Reason: Cannot parse."
)
print
(
"Config file contains error! Reason: Cannot parse."
)
raise
raise
except
configparser
.
MissingSectionHeader
:
except
configparser
.
MissingSectionHeader
Error
:
print
(
"Config file contains error! Reason: Missing section-header."
)
print
(
"Config file contains error! Reason: Missing section-header."
)
raise
raise
...
...
src/collectables.py
View file @
34d2ee59
...
@@ -32,15 +32,15 @@ class collectables:
...
@@ -32,15 +32,15 @@ class collectables:
@staticmethod
@staticmethod
def
provide
(
requests
=
[]):
def
provide
(
requests
=
[]):
#valid_keys = collectables.listKeys()
#valid_keys = collectables.listKeys()
reqs
=
[
request
for
request
,
value
in
requests
.
items
()
reqs
=
[]
if
value
>
0
]
for
requests
,
value
in
requests
.
items
():
if
value
>
0
:
reqs
.
append
([
requests
,
value
])
collectors
=
[]
collectors
=
[]
for
request
in
reqs
:
for
request
in
reqs
:
for
item
in
collectables
.
__collectables
[
request
]:
for
item
in
collectables
.
__collectables
[
request
[
0
]]:
collectors
.
append
([
item
.
harvest
,
value
])
collectors
.
append
([
item
.
harvest
,
request
[
1
]])
seen
=
set
()
return
collectors
seen_add
=
seen
.
add
return
[
x
for
x
in
collectors
if
x
not
in
seen
and
not
seen_add
(
x
)]
@staticmethod
@staticmethod
def
provideAll
():
def
provideAll
():
...
...
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