Commit 7b410839 by root

Voila

parent c9e70b85
...@@ -16,13 +16,12 @@ class Collection (object): ...@@ -16,13 +16,12 @@ class Collection (object):
@classmethod @classmethod
def harvest(cls): def harvest(cls):
print(cls.collector_function_arguments) query = cls.collector_function.im_func(**cls.collector_function_arguments)
query = cls.collector_function(**cls.collector_function_arguments)
if ((isinstance(query, list)) or (isinstance(query, dict))): if ((isinstance(query, list)) or (isinstance(query, dict))):
return Metrics(name, return Metrics(cls.name,
query[cls.collector_function_result_attr]) query[cls.collector_function_result_attr])
elif (isinstance(query,tuple)): elif (isinstance(query,tuple)):
return Metrics(name, return Metrics(cls.name,
query.__getattribute__(cls.collector_function_result_attr)) query.__getattribute__(cls.collector_function_result_attr))
else: else:
return Metrics(cls.name, return Metrics(cls.name,
...@@ -35,11 +34,11 @@ class std (Collection): ...@@ -35,11 +34,11 @@ class std (Collection):
class cpu (Collection.Group): class cpu (Collection.Group):
class usage (Collection.Group.Metric): class usage (Collection.Group.Metric):
name = "cpu.usage"
collector_function = ps.cpu_percent collector_function = ps.cpu_percent
collector_function_arguments = { collector_function_arguments = {
'interval': 0.0, 'interval': 0.0,
} }
name = "cpu.usage"
class memory (Collection.Group): class memory (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