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

Plugin weather_press_: fix style issues

This commit is contained in:
Lars Kruse 2018-03-27 04:50:21 +02:00
parent e8dd273047
commit 417bebc316

View File

@ -18,33 +18,27 @@ import re
url = 'http://tgftp.nws.noaa.gov/data/observations/metar/decoded/%s.TXT' url = 'http://tgftp.nws.noaa.gov/data/observations/metar/decoded/%s.TXT'
re_hPa = re.compile('Pressure.*\((\d+) hPa\)') re_hpa = re.compile('Pressure.*\((\d+) hPa\)')
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 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":
print('graph_title Atmospheric pressure at code %s' % code)
print('graph_vlabel Pressure in hPa')
print('graph_category sensors')
print 'graph_title Atmospheric pressure at code %s' % code print('pressure.label Pressure')
print 'graph_vlabel Pressure in hPa' print('pressure.type GAUGE')
print 'graph_category sensors' print('graph_args --base 1000 -l 850 -u 1050 --rigid')
print('graph_scale no')
print 'pressure.label Pressure'
print 'pressure.type GAUGE'
print 'graph_args --base 1000 -l 850 -u 1050 --rigid'
print 'graph_scale no'
else: else:
u = urllib.urlopen(url % code) u = urllib.urlopen(url % code)
txt = u.read() txt = u.read()
u.close() u.close()
hPa = re_hPa.findall(txt)[0] hpa = re_hpa.findall(txt)[0]
print('pressure.value %s' % hpa)
print 'pressure.value %s' % hPa