monitoring.py/monitors/ufw.py

17 lines
472 B
Python

import os
import psutil
class UFW:
interval = 60;
loopCount = 100
def __init__(self, exporter):
self.exporter = exporter
def run(self):
stream = os.popen('ufw status | grep "Status: active" | wc -l')
output = stream.read()
self.exporter.gauge("ufw.status", int(output))
stream = os.popen("ufw status | grep -E '^[0-9]' | wc -l")
output = stream.read()
self.exporter.gauge("ufw.rules", int(output))