mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 10:39:53 +00:00
Plugin timesync_status: Fix KeyError when time is not synced
This commit is contained in:
parent
3e01588570
commit
c10eaf60d2
1 changed files with 23 additions and 5 deletions
|
@ -95,11 +95,29 @@ def retrieve():
|
|||
output = result.stdout.decode('utf-8')
|
||||
values = parse_response(output)
|
||||
|
||||
# If NTP server is not responding, timesync-status will not return all
|
||||
# fields, we mark these as "U"
|
||||
|
||||
if 'Offset' in values:
|
||||
print('offset.value', parse_time(values['Offset']))
|
||||
else:
|
||||
print('offset.value U')
|
||||
|
||||
if 'Delay' in values:
|
||||
print('delay.value', parse_time(values['Delay']))
|
||||
print('delay.extinfo', 'Server', values['Server'])
|
||||
else:
|
||||
print('delay.value U')
|
||||
|
||||
if 'Jitter' in values:
|
||||
print('jitter.value', parse_time(values['Jitter']))
|
||||
else:
|
||||
print('jitter.value U')
|
||||
|
||||
if 'Poll interval' in values:
|
||||
print('poll.value', parse_time(values['Poll interval'].split('(')[0]))
|
||||
else:
|
||||
print('poll.value U')
|
||||
|
||||
|
||||
def autoconf():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue