mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Plugin: weather_temp_: fix style issues
This commit is contained in:
parent
34840ad9db
commit
e216f1be01
@ -22,32 +22,25 @@ re_C = re.compile('Temperature:.*\((-?\d+\.?\d?) C\)')
|
|||||||
re_DewC = re.compile('Dew.*\((-?\d+\.?\d?) C\)')
|
re_DewC = re.compile('Dew.*\((-?\d+\.?\d?) C\)')
|
||||||
|
|
||||||
code = sys.argv[0][(sys.argv[0].rfind('_')+1):]
|
code = sys.argv[0][(sys.argv[0].rfind('_')+1):]
|
||||||
if code == None: sys.exit(1)
|
|
||||||
|
|
||||||
if len(sys.argv) == 2 and sys.argv[1] == "autoconf":
|
|
||||||
|
|
||||||
print "yes"
|
|
||||||
|
|
||||||
|
if not code:
|
||||||
|
sys.exit(1)
|
||||||
|
elif len(sys.argv) == 2 and sys.argv[1] == "autoconf":
|
||||||
|
print("yes")
|
||||||
elif len(sys.argv) == 2 and sys.argv[1] == "config":
|
elif len(sys.argv) == 2 and sys.argv[1] == "config":
|
||||||
|
print('graph_title Temperature and Dew Point at code %s' % code)
|
||||||
print 'graph_title Temperature and Dew Point at code %s' % code
|
print('graph_vlabel Temperature and Dew Point in C')
|
||||||
print 'graph_vlabel Temperature and Dew Point in C'
|
print('graph_category sensors')
|
||||||
print 'graph_category sensors'
|
print('temperature.label Temperature')
|
||||||
|
print('dewpoint.label Dew Point')
|
||||||
print 'temperature.label Temperature'
|
print('graph_args --base 1000 -l 0')
|
||||||
print 'dewpoint.label Dew Point'
|
|
||||||
|
|
||||||
print 'graph_args --base 1000 -l 0'
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
u = urllib.urlopen(url % code)
|
||||||
|
txt = u.read()
|
||||||
|
u.close()
|
||||||
|
|
||||||
u = urllib.urlopen(url % code)
|
C = re_C.findall(txt)[0]
|
||||||
txt = u.read()
|
DewC = re_DewC.findall(txt)[0]
|
||||||
u.close()
|
print('temperature.value %s' % C)
|
||||||
|
print('dewpoint.value %s' % DewC)
|
||||||
C = re_C.findall(txt)[0]
|
|
||||||
DewC = re_DewC.findall(txt)[0]
|
|
||||||
|
|
||||||
print 'temperature.value %s' % C
|
|
||||||
print 'dewpoint.value %s' % DewC
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user