aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscan.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/scan.py b/scan.py
index b53de68..b55526c 100755
--- a/scan.py
+++ b/scan.py
@@ -25,9 +25,14 @@ class Prom:
for field in fields:
output = output + "# HELP therm_{0} {0}\n# TYPE therm_{0} gauge\n".format(field)
for mac in self.collected:
- output = output + "therm_{0}{{mac=\"{1}\"}} {2:f}\n".format(
- field, mac, self.collected[mac][field][0]
- )
+ try:
+ output = output + "therm_{0}{{mac=\"{1}\"}} {2:f}\n".format(
+ field, mac, self.collected[mac][field][0]
+ )
+ except E:
+ output = output + "# therm_{0}{{mac=\"{1}\"}} {2}\n".format(
+ field, mac, E
+ )
headers = HttpHeaders()
headers.set('Content-type', 'text/plain; version=0.0.4; charset=utf-8; escaping=values')