From 32a065ed570db02f5fb205c92b5058b98ff3ea62 Mon Sep 17 00:00:00 2001 From: Kekskurse Date: Mon, 30 Dec 2019 18:30:26 +0100 Subject: [PATCH] UFW --- monitors/ufw.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 monitors/ufw.py diff --git a/monitors/ufw.py b/monitors/ufw.py new file mode 100644 index 0000000..381db6c --- /dev/null +++ b/monitors/ufw.py @@ -0,0 +1,16 @@ + +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))