带有 RRDTool 的 MRTG 没有任何显示

问题描述

我用我的 raspi 构建了 NTP 服务器,然后我使用 MRTG 来监控偏移和抖动,它工作正常。 在负值出现之前,我只是 +1000 的偏移值。 现在我想更改可以绘制负值的图形,因此我决定将 MRTG 与 RRDTool 一起使用并按照指南 https://weberblog.net/basic-ntp-server-monitoring/?fbclid=IwAR3iV_rdwQK95axV8JWSmtBub9bhHtGbn9SGtLHSfSotsRXEVkO8YLuqZFM 进行操作,但它不起作用。 这是我的 mrtg.cfg

workdir: /var/www/html/mrtg 
LogFormat: rrdtool
Target[ntp2-gps-offset-us]: `ntpq -c rv ip | grep offset | sed s/.*$
MaxBytes[ntp2-gps-offset-us]: 100000
Title[ntp2-gps-offset-us]: Offset µs -- ntp2-gps
Options[ntp2-gps-offset-us]: gauge
Colours[ntp2-gps-offset-us]: DARKPURPLE#7608AA,Blue#0000FF,BLACK#000000,Purple#FF00FF
YLegend[ntp2-gps-offset-us]: Offset in microseconds (µs)
Legend1[ntp2-gps-offset-us]: Offset
Legend3[ntp2-gps-offset-us]: Peak Offset
LegendI[ntp2-gps-offset-us]: Offset:
ShortLegend[ntp2-gps-offset-us]: µs
Pagetop[ntp2-gps-offset-us]: OFFSET MONITOR
routers.cgi*Options[ntp2-gps-offset-us]: fixunit nototal noo
routers.cgi*ShortDesc[ntp2-gps-offset-us]: Offset µs ntp2-gps
routers.cgi*Icon[ntp2-gps-offset-us]: graph-sm.gif


Target[ntp2-gps-jitter-us]: `ntpq -c rv ip | grep sys_jitter | sed $
MaxBytes[ntp2-gps-jitter-us]: 100000
Title[ntp2-gps-jitter-us]: Jitter µs -- ntp2-gps
Options[ntp2-gps-jitter-us]: gauge
Colours[ntp2-gps-jitter-us]: TURQUOISE#00CCCC,DARKTURQUOISE#377D77,Purple#FF00FF
YLegend[ntp2-gps-jitter-us]: Jitter in microseconds (µs)
Legend1[ntp2-gps-jitter-us]: Jitter
Legend3[ntp2-gps-jitter-us]: Peak Jitter
LegendI[ntp2-gps-jitter-us]: Jitter:
Pagetop[ntp2-gps-jitter-us]: <H1>JITTER MONITOR</H1>
ShortLegend[ntp2-gps-jitter-us]: µs
routers.cgi*Options[ntp2-gps-jitter-us]: fixunit nototal noo
routers.cgi*ShortDesc[ntp2-gps-jitter-us]: Jitter µs ntp2-gps
routers.cgi*Icon[ntp2-gps-jitter-us]: link-sm.gif

这是我的结果。enter image description here

解决方法

当 MRTG 创建 RRD 文件时,DS 的最大/最小范围设置为从 0 到 MaxBytes。因此,为了允许存储负值(例如偏移量),您需要随后调整 RRD 文件以允许这样做。不幸的是,Tobi 从未添加过 MinBytes 设置!

这将设置 targetname.rrd 上的“in”值以允许最小值为 -1000000

rrdtool tune targetname.rrd --minimum ds0:-1000000

完成此操作后,它应该能够存储负值。