15 lines
322 B
Python
15 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)
|