Commit 34d2ee59 by root

Fixed collectables error: list hash and scheduler

parent 34f94315
[Client]
Debug = True
Debug = False
[Metrics]
cpuUsage = True
memoryUsage = True
userCount = True
swapUsage = True
systemBootTime = True
packageTraffic = True
dataTraffic = True
cpuUsage = 5
memoryUsage = 5
userCount = 60
swapUsage = 30
systemBootTime = 120
packageTraffic = 10
dataTraffic = 10
......@@ -60,7 +60,7 @@ class Client:
"""
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))
def __collectFromNode(self, metricCollectors):
......@@ -96,9 +96,9 @@ class Client:
% (self.server_address + ":" + str(self.server_port)))
else:
print("Connection established to %s on port %s. \
Report frequency is %d sec. Clientname: %s"
Clientname: %s"
% (self.server_address, self.server_port,
self.delay, self.name))
self.name))
try:
maxFrequency = self.getMaxFrequency(metricCollectors)
while True:
......
......@@ -21,7 +21,7 @@ def importConf(path_to_file):
except configparser.ParsingError:
print("Config file contains error! Reason: Cannot parse.")
raise
except configparser.MissingSectionHeader:
except configparser.MissingSectionHeaderError:
print("Config file contains error! Reason: Missing section-header.")
raise
......
......@@ -32,15 +32,15 @@ class collectables:
@staticmethod
def provide(requests=[]):
#valid_keys = collectables.listKeys()
reqs = [request for request, value in requests.items()
if value > 0]
reqs = []
for requests, value in requests.items():
if value>0:
reqs.append([requests, value])
collectors = []
for request in reqs:
for item in collectables.__collectables[request]:
collectors.append([item.harvest, value])
seen = set()
seen_add = seen.add
return [x for x in collectors if x not in seen and not seen_add(x)]
for item in collectables.__collectables[request[0]]:
collectors.append([item.harvest, request[1]])
return collectors
@staticmethod
def provideAll():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment