]> git.ipfire.org Git - oddments/collecty.git/blobdiff - src/collecty/plugins/base.py
processors: Collect usage for all individual cores
[oddments/collecty.git] / src / collecty / plugins / base.py
index 8f9cb7893ed6e3f617ee3123768d01fc365e8550..6045a4545f365125b79b9aa8b1e3b026609f81a5 100644 (file)
@@ -497,6 +497,22 @@ class Object(object):
                except ValueError:
                        return None
 
+       def read_proc_stat(self):
+               """
+                       Reads /proc/stat and returns it as a dictionary
+               """
+               ret = {}
+
+               with open("/proc/stat") as f:
+                       for line in f:
+                               # Split the key from the rest of the line
+                               key, line = line.split(" ", 1)
+
+                               # Remove any line breaks
+                               ret[key] = line.rstrip()
+
+               return ret
+
 
 class GraphTemplate(object):
        # A unique name to identify this graph template.