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

various plugins: fixed small style issues

This commit is contained in:
Lars Kruse 2018-03-27 04:31:43 +02:00
parent 47a97d56fa
commit 585f6f1539

View File

@ -34,7 +34,8 @@ import sys
if len(sys.argv) == 2 and sys.argv[1] == 'config':
print('graph_title NTP traffic')
print('graph_vlabel Packets/${graph_period} received(-)/sent(+)')
print('graph_info This graph shows the packet rates of this ntpd. Bad means packets received with bad length or format. Authfailed means packets for which authentication failed.')
print('graph_info This graph shows the packet rates of this ntpd. Bad means packets received '
'with bad length or format. Authfailed means packets for which authentication failed.')
print('graph_category time')
print('received.label Received')
print('received.type DERIVE')
@ -72,7 +73,8 @@ os.environ['PATH'] = '/usr/local/sbin:/usr/local/bin:' + os.environ['PATH']
# Assuming that the ntpd version is the same as the ntpq or ntpdc
# version. This is how a proper install should be.
version = subprocess.check_output(['ntpq', '-c', 'version'], universal_newlines=True).split()[1][0:5].replace('.', '')
version = subprocess.check_output(['ntpq', '-c', 'version'],
universal_newlines=True).split()[1][0:5].replace('.', '')
if int(version) >= 427:
cmd = 'ntpq'
@ -81,9 +83,11 @@ else:
stats = dict()
stats_output = subprocess.check_output([cmd, '-c', 'iostats', '-c', 'sysstats'], universal_newlines=True).splitlines()
stats_output = subprocess.check_output([cmd, '-c', 'iostats', '-c', 'sysstats'],
universal_newlines=True).splitlines()
for line in stats_output: stats[line.split(':')[0]] = int(line.split(':')[1])
for line in stats_output:
stats[line.split(':')[0]] = int(line.split(':')[1])
print('received.value ' + str(stats['received packets']))
print('sent.value ' + str(stats['packets sent']))