Warning: Use of undefined constant data - assumed 'data'

I have a Linux NTP server which I would like to monitor, with Apps → NTP Server. All graphs a re showing up empty with ‘-nan’ reported for values. Apparently the data comes back from the query but does not get inserted into the RRD file (see step 4). The rest of the graphs for this server look OK.

I have in this order

  1. deleted the device and re-added it
  2. git pull and ./daily.sh
  3. php validate.php then gives me

-bash-4.2$ php validate.php

Component Version
LibreNMS 1.60-48-g6a897b5
DB Schema 2020_02_10_223323_create_alert_location_map_table (159)
PHP 7.2.24
MySQL 5.5.64-MariaDB
RRDTool 1.4.8
SNMP NET-SNMP 5.7.2
====================================

[OK] Composer Version: 1.9.3
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
-bash-4.2$

  1. output from command (hostname obfuscated)

-bash-4.2$ ./poller.php -d -h time1-location.example.com -m applications 2>&1

[…]

Load poller module applications

SQL[ESC[1;33mSELECT * FROM applications WHERE device_id = ? ESC[0;33m[27]ESC[0m 0.5ms]

ntp-serverSNMP[ESC[0;36m’/usr/bin/snmpget’ ‘-v2c’ ‘-c’ ‘COMMUNITY’ ‘-Oqv’ ‘-m’ ‘NET-SNMP-EXTEND-MIB’ ‘-M’ ‘/opt/librenms/mibs:/opt/librenms/mibs/supermicro:/opt/librenms/mibs/dell’ ‘udp:HOSTNAME:161’ 'nsExtendOutputFull.10.110.116.112.45.115.101.114.118.101.114’ESC[0m]
ntpd 4.2.6p5
{"data":{"offset":"47.235","frequency":"0.037","sys_jitter":"0.052","clk_jitter":"0.004","clk_wander":"37","stratum":"2","time_since_reset":"5247241","receive_buffers":"10","free_receive_buffers":"9","used_receive_buffers":"0","low_water_refills":"1","dropped_packets":"1773024","ignored_packets":"3522","received_packets":"2405239734","packets_sent":"2404915754","packet_send_failures":"0","input_wakeups":"0","useful_input_wakeups":"2301365889"},"error":"0","errorString":"","version":"1"}

Warning: Use of undefined constant data - assumed ‘data’ (this will throw an Error in a future version of PHP) in /opt/librenms/includes/polling/applications/ntp-server.inc.php on line 19
RRD[ESC[0;32mupdate /opt/librenms/rrd/time1-location.example.com/app-ntp-server-4.rrd N:U:U:U:U:U:U:U:U:U:U:U:U:U:UESC[0m]
SQL[ESC[1;33mUPDATE applications set app_state=?,app_status=?,timestamp=NOW() WHERE app_id = ? ESC[0;33m[“OK”,“”,4]ESC[0m 7.03ms]

SQL[ESC[1;33mSELECT * FROM application_metrics WHERE app_id=? ESC[0;33m[4]ESC[0m 0.48ms]

: …

Runtime for poller module ‘applications’: 0.1100 seconds with 22328 bytes
SNMP: [1/0.10s] MySQL: [3/0.01s] RRD: [2/0.00s]

Unload poller module applications

[…]

I can locally modify the offending line 19 in the script /opt/librenms/includes/polling/applications/ntp-server.inc.php to read ‘data’ or $data to clear the error when running poller.php, but that leads to errors on next run of 'php validate.php complaining that local code is modified compared to the git repo.

I can make additional debug output available here.

Any advice how to proceed from here and make NTP Server monitoring work?

Try running manually the snmpget command

And check the output

The output of that command was already part of my original problem description submission, but here it is again. To me it looks the values are correctly retrieved from the NTP server, but when you look at the RRD line it inserts no values into the rrd file, possibly due to the fact that the data variable structure isn’t holding the data in between when they are retrieved and when they need to be handed to RRD.

-bash-4.2$ /usr/bin/snmpget -v2c -c REDACTED -Oqv -m NET-SNMP-EXTEND-MIB -M ‘/opt/librenms/mibs:/opt/librenms/mibs/supermicro:/opt/librenms/mibs/dell’ udp:time1-location.example.com:161 nsExtendOutputFull.10.110.116.112.45.115.101.114.118.101.114

ntpd 4.2.6p5

{“data”:{“offset”:“47.223”,“frequency”:“0.037”,“sys_jitter”:“0.043”,“clk_jitter”:“0.003”,“clk_wander”:“37”,“stratum”:“2”,“time_since_reset”:“5324914”,“receive_buffers”:“10”,“free_receive_buffers”:“9”,“used_receive_buffers”:“0”,“low_water_refills”:“1”,“dropped_packets”:“1931783”,“ignored_packets”:“3522”,“received_packets”:“2444782524”,“packets_sent”:“2444456425”,“packet_send_failures”:“0”,“input_wakeups”:“0”,“useful_input_wakeups”:“2338363898”},“error”:“0”,“errorString”:"",“version”:“1”}

-bash-4.2$