Change chart resolution for ntpd plugin

Problem/Question

I have a server where I need to monitor the ntpd statistics. However, for example the offset graph is displaying milliseconds, and seems to default to one decimal which gives a scale where all lables have the same value because they are all rounded to the .1 millisecond.

What I expected to happen

I would prefer to have the data in microseconds instead. Is this possible to accomplish with some configuration setting somewhere? Or if the plugin can be modified to request another resolution? The data seems to be stored in micro or nano seconds because the actual graph look ok. Just the labels and value when I hover a data-point are displaying the same .1 millisecond.

I appreciate any help!

You can’t configure precision, but you can change PRECISION = 1000000 (this is a divisor) and all occurences of milliseconds in /usr/libexec/netdata/python.d/ntpd.chart.py.

Thanks!

You got me on the right track. However, if any one else reads this. It is not enough to change PRECISION to 1000 instead since PRECISION is also used when scaling up the value read from ntpd. But when only changing the PRECISION value on the charts I got the expected behavior.

Added this as a RUN command to my netdata Dockerfile so pretty neat “hack” I think.

2 Likes

Ok, while the above hack did work Netdata actullay include a way to override this using config options.

just putting

[ntpd_local.sys_offset]
dim offset divisor = 1000
units = microseconds

in my /etc/netdata/netdata.conf file does the trick. Much more clean then hacking the code of the plugin.

2 Likes

Yeah, configuration change is much better than fiddling with the source code!

For anyone interested, you can find the docs for this collector here: