summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin/ntpd
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--collectors/python.d.plugin/ntpd/Makefile.inc13
-rw-r--r--collectors/python.d.plugin/ntpd/README.md71
-rw-r--r--collectors/python.d.plugin/ntpd/ntpd.chart.py (renamed from python.d/ntpd.chart.py)80
-rw-r--r--collectors/python.d.plugin/ntpd/ntpd.conf (renamed from conf.d/python.d/ntpd.conf)0
4 files changed, 129 insertions, 35 deletions
diff --git a/collectors/python.d.plugin/ntpd/Makefile.inc b/collectors/python.d.plugin/ntpd/Makefile.inc
new file mode 100644
index 000000000..81210ebab
--- /dev/null
+++ b/collectors/python.d.plugin/ntpd/Makefile.inc
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+# THIS IS NOT A COMPLETE Makefile
+# IT IS INCLUDED BY ITS PARENT'S Makefile.am
+# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
+
+# install these files
+dist_python_DATA += ntpd/ntpd.chart.py
+dist_pythonconfig_DATA += ntpd/ntpd.conf
+
+# do not install these files, but include them in the distribution
+dist_noinst_DATA += ntpd/README.md ntpd/Makefile.inc
+
diff --git a/collectors/python.d.plugin/ntpd/README.md b/collectors/python.d.plugin/ntpd/README.md
new file mode 100644
index 000000000..b0fa17fde
--- /dev/null
+++ b/collectors/python.d.plugin/ntpd/README.md
@@ -0,0 +1,71 @@
+# ntpd
+
+Module monitors the system variables of the local `ntpd` daemon (optional incl. variables of the polled peers) using the NTP Control Message Protocol via UDP socket, similar to `ntpq`, the [standard NTP query program](http://doc.ntp.org/current-stable/ntpq.html).
+
+**Requirements:**
+ * Version: `NTPv4`
+ * Local interrogation allowed in `/etc/ntp.conf` (default):
+
+```
+# Local users may interrogate the ntp server more closely.
+restrict 127.0.0.1
+restrict ::1
+```
+
+It produces:
+
+1. system
+ * offset
+ * jitter
+ * frequency
+ * delay
+ * dispersion
+ * stratum
+ * tc
+ * precision
+
+2. peers
+ * offset
+ * delay
+ * dispersion
+ * jitter
+ * rootdelay
+ * rootdispersion
+ * stratum
+ * hmode
+ * pmode
+ * hpoll
+ * ppoll
+ * precision
+
+**configuration**
+
+Sample:
+
+```yaml
+update_every: 10
+
+host: 'localhost'
+port: '123'
+show_peers: yes
+# hide peers with source address in ranges 127.0.0.0/8 and 192.168.0.0/16
+peer_filter: '(127\..*)|(192\.168\..*)'
+# check for new/changed peers every 60 updates
+peer_rescan: 60
+```
+
+Sample (multiple jobs):
+
+Note: `ntp.conf` on the host `otherhost` must be configured to allow queries from our local host by including a line like `restrict <IP> nomodify notrap nopeer`.
+
+```yaml
+local:
+ host: 'localhost'
+
+otherhost:
+ host: 'otherhost'
+```
+
+If no configuration is given, module will attempt to connect to `ntpd` on `::1:123` or `127.0.0.1:123` and show charts for the systemvars. Use `show_peers: yes` to also show the charts for configured peers. Local peers in the range `127.0.0.0/8` are hidden by default, use `peer_filter: ''` to show all peers.
+
+---
diff --git a/python.d/ntpd.chart.py b/collectors/python.d.plugin/ntpd/ntpd.chart.py
index 05209da87..79d557c80 100644
--- a/python.d/ntpd.chart.py
+++ b/collectors/python.d.plugin/ntpd/ntpd.chart.py
@@ -2,6 +2,7 @@
# Description: ntpd netdata python.d module
# Author: Sven Mäder (rda0)
# Author: Ilya Mashchenko (l2isbad)
+# SPDX-License-Identifier: GPL-3.0-or-later
import struct
import re
@@ -56,108 +57,117 @@ CHARTS = {
'options': [None, 'Combined offset of server relative to this host', 'ms', 'system', 'ntpd.sys_offset', 'area'],
'lines': [
['offset', 'offset', 'absolute', 1, PRECISION]
- ]},
+ ]
+ },
'sys_jitter': {
'options': [None, 'Combined system jitter and clock jitter', 'ms', 'system', 'ntpd.sys_jitter', 'line'],
'lines': [
['sys_jitter', 'system', 'absolute', 1, PRECISION],
['clk_jitter', 'clock', 'absolute', 1, PRECISION]
- ]},
+ ]
+ },
'sys_frequency': {
'options': [None, 'Frequency offset relative to hardware clock', 'ppm', 'system', 'ntpd.sys_frequency', 'area'],
'lines': [
['frequency', 'frequency', 'absolute', 1, PRECISION]
- ]},
+ ]
+ },
'sys_wander': {
'options': [None, 'Clock frequency wander', 'ppm', 'system', 'ntpd.sys_wander', 'area'],
'lines': [
['clk_wander', 'clock', 'absolute', 1, PRECISION]
- ]},
+ ]
+ },
'sys_rootdelay': {
'options': [None, 'Total roundtrip delay to the primary reference clock', 'ms', 'system',
'ntpd.sys_rootdelay', 'area'],
'lines': [
['rootdelay', 'delay', 'absolute', 1, PRECISION]
- ]},
+ ]
+ },
'sys_rootdisp': {
'options': [None, 'Total root dispersion to the primary reference clock', 'ms', 'system',
'ntpd.sys_rootdisp', 'area'],
'lines': [
['rootdisp', 'dispersion', 'absolute', 1, PRECISION]
- ]},
+ ]
+ },
'sys_stratum': {
'options': [None, 'Stratum (1-15)', 'stratum', 'system', 'ntpd.sys_stratum', 'line'],
'lines': [
['stratum', 'stratum', 'absolute', 1, PRECISION]
- ]},
+ ]
+ },
'sys_tc': {
'options': [None, 'Time constant and poll exponent (3-17)', 'log2 s', 'system', 'ntpd.sys_tc', 'line'],
'lines': [
['tc', 'current', 'absolute', 1, PRECISION],
['mintc', 'minimum', 'absolute', 1, PRECISION]
- ]},
+ ]
+ },
'sys_precision': {
'options': [None, 'Precision', 'log2 s', 'system', 'ntpd.sys_precision', 'line'],
'lines': [
['precision', 'precision', 'absolute', 1, PRECISION]
- ]}
+ ]
+ }
}
PEER_CHARTS = {
'peer_offset': {
'options': [None, 'Filter offset', 'ms', 'peers', 'ntpd.peer_offset', 'line'],
- 'lines': [
- ]},
+ 'lines': []
+ },
'peer_delay': {
'options': [None, 'Filter delay', 'ms', 'peers', 'ntpd.peer_delay', 'line'],
- 'lines': [
- ]},
+ 'lines': []
+ },
'peer_dispersion': {
'options': [None, 'Filter dispersion', 'ms', 'peers', 'ntpd.peer_dispersion', 'line'],
- 'lines': [
- ]},
+ 'lines': []
+ },
'peer_jitter': {
'options': [None, 'Filter jitter', 'ms', 'peers', 'ntpd.peer_jitter', 'line'],
- 'lines': [
- ]},
+ 'lines': []
+ },
'peer_xleave': {
'options': [None, 'Interleave delay', 'ms', 'peers', 'ntpd.peer_xleave', 'line'],
- 'lines': [
- ]},
+ 'lines': []
+ },
'peer_rootdelay': {
'options': [None, 'Total roundtrip delay to the primary reference clock', 'ms', 'peers',
'ntpd.peer_rootdelay', 'line'],
- 'lines': [
- ]},
+ 'lines': []
+ },
'peer_rootdisp': {
'options': [None, 'Total root dispersion to the primary reference clock', 'ms', 'peers',
'ntpd.peer_rootdisp', 'line'],
- 'lines': [
- ]},
+ 'lines': []
+ },
'peer_stratum': {
'options': [None, 'Stratum (1-15)', 'stratum', 'peers', 'ntpd.peer_stratum', 'line'],
- 'lines': [
- ]},
+ 'lines': []
+ },
'peer_hmode': {
'options': [None, 'Host mode (1-6)', 'hmode', 'peers', 'ntpd.peer_hmode', 'line'],
- 'lines': [
- ]},
+ 'lines': []
+ },
'peer_pmode': {
'options': [None, 'Peer mode (1-5)', 'pmode', 'peers', 'ntpd.peer_pmode', 'line'],
- 'lines': [
- ]},
+ 'lines': []
+ },
'peer_hpoll': {
'options': [None, 'Host poll exponent', 'log2 s', 'peers', 'ntpd.peer_hpoll', 'line'],
- 'lines': [
- ]},
+ 'lines': []
+ },
'peer_ppoll': {
'options': [None, 'Peer poll exponent', 'log2 s', 'peers', 'ntpd.peer_ppoll', 'line'],
- 'lines': [
- ]},
+ 'lines': []
+ },
'peer_precision': {
'options': [None, 'Precision', 'log2 s', 'peers', 'ntpd.peer_precision', 'line'],
- 'lines': [
- ]}
+ 'lines': []
+ }
}
diff --git a/conf.d/python.d/ntpd.conf b/collectors/python.d.plugin/ntpd/ntpd.conf
index 7adc4074b..7adc4074b 100644
--- a/conf.d/python.d/ntpd.conf
+++ b/collectors/python.d.plugin/ntpd/ntpd.conf