From 3a737bf6fa0f7f69ef159fde8a9850fcac0dcfa9 Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Fri, 7 Jan 2022 13:18:24 +0100 Subject: [PATCH] updated zabbix state --- states/zabbix/scripts/pcsensor.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 states/zabbix/scripts/pcsensor.py diff --git a/states/zabbix/scripts/pcsensor.py b/states/zabbix/scripts/pcsensor.py new file mode 100644 index 0000000..5b3d380 --- /dev/null +++ b/states/zabbix/scripts/pcsensor.py @@ -0,0 +1,15 @@ +#!/usr/bin/python3 + +import re +import subprocess + +tempre = re.compile(r" *(\d*\.\d*) C.*") + +def temp_c(): + res = subprocess.run("pcsensor", shell=True, capture_output=True) + line = res.stdout.decode().strip() + results = tempre.findall(line) + return float(results[0]) + +if __name__ == "__main__": + print(temp_c())