monitoring.py/monitors/cpu.py
2019-12-30 16:18:42 +01:00

14 lines
322 B
Python

import psutil
class CPU:
interval = 10;
loopCount = 0
def __init__(self, exporter):
self.exporter = exporter
def run(self):
cpus = psutil.cpu_percent(interval=1, percpu=True)
i = 0
for cpu in cpus:
i = i + 1
self.exporter.gauge("cpu."+str(i), cpu)