monitoring.py/monitors/cpu.py

15 lines
322 B
Python
Raw Normal View History

2019-12-30 15:18:42 +00:00
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)