1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

chrony_status: add a serverstats graph

This graph shows packet rates for the chronyd server.
This commit is contained in:
Kenyon Ralph 2021-11-14 14:37:29 -08:00 committed by Lars Kruse
parent 02630d318c
commit 357c358669

View file

@ -12,14 +12,19 @@ Systems with chrony installed.
=head1 CONFIGURATION =head1 CONFIGURATION
No configuration is required for this plugin. Needs to be run as the user running chronyd (or root) in order to access the
Unix domain socket which chronyc uses to communicate with chronyd. Example
/etc/munin/plugin-conf.d/chrony_status.conf:
[chrony_status]
user _chrony
=head1 INTERPRETATION =head1 INTERPRETATION
Monitor Chrony's stratum value (with warning), time offset, network delay Monitor Chrony's stratum value (with warning), time offset, network delay, clock
and clock frequency. It would be very easy to monitor all Chrony's values, but frequency, packets received, and packets dropped. It would be very easy to
IMHO they aren't needed. The most important information in stratum, giving monitor all of Chrony's values, but IMHO they aren't needed. The most important
"synced" / "not synced" value. information is stratum, giving "synced" / "not synced" value.
=head1 AUTHOR =head1 AUTHOR
@ -47,16 +52,21 @@ FIELDS = {
'systime': 'System time', 'systime': 'System time',
'delay': 'Root delay', 'delay': 'Root delay',
'frequency': 'Frequency', 'frequency': 'Frequency',
'received': 'NTP packets received',
'dropped': 'NTP packets dropped',
'command_received': 'Command packets received',
'command_dropped': 'Command packets dropped',
'client_log_records_dropped': 'Client log records dropped',
} }
def get_values(): def get_values():
"""Run "chronyc tracking" and parse it's output. """Run `chronyc tracking` and `chronyc serverstats` and parse their output.
Return: list of (label, value, description) Return: list of (label, value, description)
""" """
try: try:
output = subprocess.run(['chronyc', 'tracking'], output = subprocess.run(['chronyc', '-m', 'tracking', 'serverstats'],
stdout=subprocess.PIPE, check=False, stdout=subprocess.PIPE, check=False,
encoding='utf-8', errors='ignore') encoding='utf-8', errors='ignore')
except FileNotFoundError: except FileNotFoundError:
@ -107,6 +117,27 @@ def config():
print('graph_args --base 1000') print('graph_args --base 1000')
print('frequency.label Local clock frequency error') print('frequency.label Local clock frequency error')
print('multigraph chrony_serverstats')
print('graph_title Chrony server statistics')
print('graph_vlabel Packets/${graph_period}')
print('graph_category time')
print('graph_args --base 1000')
print('received.label Packets received')
print('received.type DERIVE')
print('received.min 0')
print('dropped.label Packets dropped')
print('dropped.type DERIVE')
print('dropped.min 0')
print('command_received.label Command packets received')
print('command_received.type DERIVE')
print('command_received.min 0')
print('command_dropped.label Command packets dropped')
print('command_dropped.type DERIVE')
print('command_dropped.min 0')
print('client_log_records_dropped.label Client log records dropped')
print('client_log_records_dropped.type DERIVE')
print('client_log_records_dropped.min 0')
if os.environ.get('MUNIN_CAP_DIRTYCONFIG') == '1': if os.environ.get('MUNIN_CAP_DIRTYCONFIG') == '1':
fetch() fetch()