2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Patched with Olaf Kolkman advice. Can now be referenced from global Munin configuration.

This commit is contained in:
twilliam 2010-09-27 09:55:59 +02:00 committed by Steve Schnepp
parent 84e763dc45
commit 1054c80fbd

View File

@ -1,5 +1,6 @@
#!/usr/bin/python
import os
import re
import sys
import urllib
@ -10,7 +11,8 @@ re_tmp = re.compile('realTemp: "(\d+)"')
re_hum = re.compile('relativeHumidity: "(\d+)"')
re_loc = re.compile('locName: "([\w ]+)"')
code = sys.argv[0][(sys.argv[0].rfind('_') + 1):]
#code = sys.argv[0][(sys.argv[0].rfind('_') + 1):]
code = os.environ.get('code', sys.argv[0][(sys.argv[0].rfind('_') + 1):])
if code == None: sys.exit(1)
@ -47,13 +49,13 @@ else:
if len(HUM_list):
HUM = HUM_list[0]
else:
HUM = 0
sys.exit(1)
if len(TMP_F_list):
TMP_F = TMP_F_list[0]
TMP_C = (int(TMP_F) - 32) * 5/9
else:
TMP_C = 0
sys.exit(1)
print 'temperature.value %s' % TMP_C
print 'humidity.value %s' % HUM