diff options
author | dakkar <dakkar@thenautilus.net> | 2024-08-30 11:55:50 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2024-08-30 11:55:50 +0000 |
commit | a58d9dd1721fd0740720c80e2c587b9dfb3a6be3 (patch) | |
tree | e9a8a01d68c8d7f132acf391fc633ebb0ec0572f | |
parent | silence log noise (diff) | |
download | ats-therm-a58d9dd1721fd0740720c80e2c587b9dfb3a6be3.tar.gz ats-therm-a58d9dd1721fd0740720c80e2c587b9dfb3a6be3.tar.bz2 ats-therm-a58d9dd1721fd0740720c80e2c587b9dfb3a6be3.zip |
try to trap errors
-rwxr-xr-x | scan.py | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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') |