From d0139a588d3745409ef43991d083586c44ae5ae1 Mon Sep 17 00:00:00 2001 From: d0m84 Date: Fri, 26 Jul 2019 22:22:49 +0200 Subject: [PATCH] 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 stats[line.split(':')[0]] = int(line.split(':')[1]) IndexError: list index out of range --- plugins/ntp/ntp_packets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/ntp/ntp_packets b/plugins/ntp/ntp_packets index 1fb19b05..f452926c 100755 --- a/plugins/ntp/ntp_packets +++ b/plugins/ntp/ntp_packets @@ -87,7 +87,8 @@ 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]) + if len(line.split(':')) == 2: + stats[line.split(':')[0]] = int(line.split(':')[1]) print('received.value ' + str(stats['received packets'])) print('sent.value ' + str(stats['packets sent']))