mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 22:25:23 +00:00
Update ntp_packets
With Debian 10 the command "ntpq -c iostats -c sysstats" produces one empty line. The additional if condition tackles this. Traceback (most recent call last): File "/etc/munin/plugins/ntp_packets", line 91, in <module> stats[line.split(':')[0]] = int(line.split(':')[1]) IndexError: list index out of range
This commit is contained in:
parent
ee68a404b5
commit
d0139a588d
1 changed files with 2 additions and 1 deletions
|
@ -87,7 +87,8 @@ stats_output = subprocess.check_output([cmd, '-c', 'iostats', '-c', 'sysstats'],
|
||||||
universal_newlines=True).splitlines()
|
universal_newlines=True).splitlines()
|
||||||
|
|
||||||
for line in stats_output:
|
for line in stats_output:
|
||||||
stats[line.split(':')[0]] = int(line.split(':')[1])
|
if len(line.split(':')) == 2:
|
||||||
|
stats[line.split(':')[0]] = int(line.split(':')[1])
|
||||||
|
|
||||||
print('received.value ' + str(stats['received packets']))
|
print('received.value ' + str(stats['received packets']))
|
||||||
print('sent.value ' + str(stats['packets sent']))
|
print('sent.value ' + str(stats['packets sent']))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue