Révision c10eaf60
Plugin timesync_status: Fix KeyError when time is not synced
| plugins/systemd/timesync_status | ||
|---|---|---|
| 95 | 95 |
output = result.stdout.decode('utf-8')
|
| 96 | 96 |
values = parse_response(output) |
| 97 | 97 |
|
| 98 |
print('offset.value', parse_time(values['Offset']))
|
|
| 99 |
print('delay.value', parse_time(values['Delay']))
|
|
| 100 |
print('delay.extinfo', 'Server', values['Server'])
|
|
| 101 |
print('jitter.value', parse_time(values['Jitter']))
|
|
| 102 |
print('poll.value', parse_time(values['Poll interval'].split('(')[0]))
|
|
| 98 |
# If NTP server is not responding, timesync-status will not return all |
|
| 99 |
# fields, we mark these as "U" |
|
| 100 |
|
|
| 101 |
if 'Offset' in values: |
|
| 102 |
print('offset.value', parse_time(values['Offset']))
|
|
| 103 |
else: |
|
| 104 |
print('offset.value U')
|
|
| 105 |
|
|
| 106 |
if 'Delay' in values: |
|
| 107 |
print('delay.value', parse_time(values['Delay']))
|
|
| 108 |
print('delay.extinfo', 'Server', values['Server'])
|
|
| 109 |
else: |
|
| 110 |
print('delay.value U')
|
|
| 111 |
|
|
| 112 |
if 'Jitter' in values: |
|
| 113 |
print('jitter.value', parse_time(values['Jitter']))
|
|
| 114 |
else: |
|
| 115 |
print('jitter.value U')
|
|
| 116 |
|
|
| 117 |
if 'Poll interval' in values: |
|
| 118 |
print('poll.value', parse_time(values['Poll interval'].split('(')[0]))
|
|
| 119 |
else: |
|
| 120 |
print('poll.value U')
|
|
| 103 | 121 |
|
| 104 | 122 |
|
| 105 | 123 |
def autoconf(): |
Formats disponibles : Unified diff