Commit dd5f6fc0 by Gregory Nagy

flake8 and synchronized memory reporter function (celery collector)

parent 0a10962e
...@@ -208,6 +208,7 @@ class Client: ...@@ -208,6 +208,7 @@ class Client:
"." + "network.packages_sent" + "." + "network.packages_sent" +
" %d" % interfaces_list[ " %d" % interfaces_list[
iname].packets_sent iname].packets_sent
+ "." + iname
+ " %d" % (time.time()) + " %d" % (time.time())
)) ))
metrics.append(("vm." + metrics.append(("vm." +
...@@ -215,6 +216,7 @@ class Client: ...@@ -215,6 +216,7 @@ class Client:
"." + "network.packages_recv" + "." + "network.packages_recv" +
" %d" % interfaces_list[ " %d" % interfaces_list[
iname].packets_recv iname].packets_recv
+ "." + iname
+ " %d" % (time.time()) + " %d" % (time.time())
)) ))
metrics.append(("vm." + metrics.append(("vm." +
...@@ -222,6 +224,7 @@ class Client: ...@@ -222,6 +224,7 @@ class Client:
".bytes_sent" + ".bytes_sent" +
" %d" % interfaces_list[ " %d" % interfaces_list[
iname].bytes_sent iname].bytes_sent
+ "." + iname
+ " %d" % (time.time()) + " %d" % (time.time())
)) ))
metrics.append(("vm." + metrics.append(("vm." +
...@@ -229,6 +232,7 @@ class Client: ...@@ -229,6 +232,7 @@ class Client:
".bytes_recv" + ".bytes_recv" +
" %d" % interfaces_list[ " %d" % interfaces_list[
iname].bytes_recv iname].bytes_recv
+ "." + iname
+ " %d" % (time.time()) + " %d" % (time.time())
)) ))
return metrics return metrics
......
...@@ -9,7 +9,9 @@ Metrics = collections.namedtuple("Metrics", ["name", "value"]) ...@@ -9,7 +9,9 @@ Metrics = collections.namedtuple("Metrics", ["name", "value"])
class Collection(object): class Collection(object):
class Group(object): class Group(object):
class Metric(object): class Metric(object):
name = "unknown" name = "unknown"
collector_function = 0 collector_function = 0
...@@ -34,7 +36,9 @@ class Collection(object): ...@@ -34,7 +36,9 @@ class Collection(object):
class std(Collection): class std(Collection):
class cpu(Collection.Group): class cpu(Collection.Group):
class usage(Collection.Group.Metric): class usage(Collection.Group.Metric):
name = "cpu.usage" name = "cpu.usage"
collector_function = ps.cpu_percent collector_function = ps.cpu_percent
...@@ -43,9 +47,10 @@ class std(Collection): ...@@ -43,9 +47,10 @@ class std(Collection):
} }
class memory(Collection.Group): class memory(Collection.Group):
class usage(Collection.Group.Metric): class usage(Collection.Group.Metric):
name = "memory.usage" name = "memory.usage"
collector_function = ps.virtmem_usage collector_function = ps.virtual_memory
collector_function_result_attr = "percent" collector_function_result_attr = "percent"
class swap(Collection.Group): class swap(Collection.Group):
......
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