Commit c9e70b85 by root

3.2 python

parent dc85b3c1
......@@ -14,8 +14,8 @@ Pass = guest
[Metrics]
cpuUsage = True
memoryUsage = True
userCount = True
swapUsage = True
userCount = False
swapUsage = False
systemBootTime = False
packageTraffic = False
dataTraffic = False
No preview for this file type
......@@ -95,5 +95,3 @@ class Client:
print("Reporting has stopped by the user. Exiting...")
finally:
self.__disconnect()
No preview for this file type
import ConfigParser as configparser
import configparser
def importConf(path_to_file):
config = configparser.RawConfigParser(allow_no_value = False)
......
No preview for this file type
No preview for this file type
......@@ -16,12 +16,13 @@ class Collection (object):
@classmethod
def harvest(cls):
print(cls.collector_function_arguments)
query = cls.collector_function(**cls.collector_function_arguments)
if ((isinstance(query, list)) or (isinstance(query, dict))):
return Metrics(cls.name,
return Metrics(name,
query[cls.collector_function_result_attr])
elif (isinstance(query,tuple)):
return Metrics(cls.name,
return Metrics(name,
query.__getattribute__(cls.collector_function_result_attr))
else:
return Metrics(cls.name,
......@@ -36,7 +37,7 @@ class std (Collection):
class usage (Collection.Group.Metric):
collector_function = ps.cpu_percent
collector_function_arguments = {
'interval': 0,
'interval': 0.0,
}
name = "cpu.usage"
......@@ -52,9 +53,9 @@ class std (Collection):
class count (Collection.Group.Metric):
name = "user.count"
@staticmethod
def harvest():
return Metrics(std.user.count.name, len(ps.get_users()))
@classmethod
def harvest(cls):
return Metrics(cls.name, len(ps.get_users()))
class network (Collection.Group):
......
No preview for this file type
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