mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Plugin weather_: fixes style issues
This commit is contained in:
parent
a4a9e755b5
commit
34840ad9db
@ -11,13 +11,13 @@ re_tmp = re.compile('realTemp: "(\d+)"')
|
|||||||
re_hum = re.compile('relativeHumidity: "(\d+)"')
|
re_hum = re.compile('relativeHumidity: "(\d+)"')
|
||||||
re_loc = re.compile('locName: "([\w ]+)"')
|
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):])
|
code = os.environ.get('code', sys.argv[0][(sys.argv[0].rfind('_') + 1):])
|
||||||
|
|
||||||
if code == None: sys.exit(1)
|
if not code:
|
||||||
|
sys.exit(1)
|
||||||
if len(sys.argv) == 2 and sys.argv[1] == "autoconf":
|
elif len(sys.argv) == 2 and sys.argv[1] == "autoconf":
|
||||||
print "yes"
|
print("yes")
|
||||||
elif len(sys.argv) == 2 and sys.argv[1] == "config":
|
elif len(sys.argv) == 2 and sys.argv[1] == "config":
|
||||||
u = urllib.urlopen(url % code)
|
u = urllib.urlopen(url % code)
|
||||||
txt = u.read()
|
txt = u.read()
|
||||||
@ -30,14 +30,14 @@ elif len(sys.argv) == 2 and sys.argv[1] == "config":
|
|||||||
else:
|
else:
|
||||||
LOC = "Unknown"
|
LOC = "Unknown"
|
||||||
|
|
||||||
print 'graph_title Weather in %s' % LOC
|
print('graph_title Weather in %s' % LOC)
|
||||||
print 'graph_vlabel Temperature and Humidity'
|
print('graph_vlabel Temperature and Humidity')
|
||||||
print 'graph_category sensors'
|
print('graph_category sensors')
|
||||||
|
|
||||||
print 'temperature.label Temperature'
|
print('temperature.label Temperature')
|
||||||
print 'humidity.label Humidity'
|
print('humidity.label Humidity')
|
||||||
|
|
||||||
print 'graph_args --base 1000 -l 0'
|
print('graph_args --base 1000 -l 0')
|
||||||
else:
|
else:
|
||||||
u = urllib.urlopen(url % code)
|
u = urllib.urlopen(url % code)
|
||||||
txt = u.read()
|
txt = u.read()
|
||||||
@ -57,5 +57,5 @@ else:
|
|||||||
else:
|
else:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
print 'temperature.value %s' % TMP_C
|
print('temperature.value %s' % TMP_C)
|
||||||
print 'humidity.value %s' % HUM
|
print('humidity.value %s' % HUM)
|
||||||
|
Loading…
Reference in New Issue
Block a user