Problem with schema warning for device_stats/ping_last_timestamp

Hi,

I ran into a strange issue. When I opened the LibreNMS web interface, all the graphs under “Top 20 interfaces polled within 15 minutes” had disappeared.

I ran ./validate.php to check what was going on, and it told me to run lnms migrate. I did that, the migration finished without errors, and now validate.php says the schema is up to date.
But even after that, I keep getting the same warning about this column:

device_stats/ping_last_timestamp

Here is the full output of validate:

===========================================

Component Version
LibreNMS 25.12.0-dev.21+e59be9a75 (2025-11-25T15:35:34+00:00)
DB Schema 2025_05_28_092148_create_device_stats (359)
PHP 8.4.15
Python 3.10.12
Database MariaDB 10.6.22-MariaDB-0ubuntu0.22.04.1
RRDTool 1.7.2
SNMP 5.9.1
===========================================

[OK] Composer Version: 2.9.2
[OK] Dependencies up-to-date.
[OK] Database Connected
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK] Database and column collations are correct
[FAIL] We have detected that your database schema may be wrong
Database: incorrect column (device_stats/ping_last_timestamp)
[FIX]:
Run the following SQL statements to fix it
SQL Statements:
ALTER TABLE device_stats CHANGE ping_last_timestamp ping_last_timestamp timestamp NOT NULL ;
Attempt to fix this issue (y or n)?:y
Attempted to apply fix.
[OK] MySQL and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[OK] Redis is unavailable
[OK] rrd_dir is writable
[OK] rrdtool version ok

I also checked the table:

SHOW CREATE TABLE device_stats\G

It shows:

ping_last_timestamp timestamp NOT NULL DEFAULT ‘0000-00-00 00:00:00’,

Running the suggested ALTER command doesn’t change anything. The warning always comes back.

The poller is working normally and it updates the timestamp without errors. Everything else seems fine.

Is this a false warning on the dev branch, or is something actually wrong?

Thanks.

2 Likes

Facing the same issue after the latest update graphs created for monitoring the traffic of my network now the traffic is empty in my graph. how to fix this.

Same issue. It’s seem bug

Did you run the ./validate.php and followed the suggested fixes (CLI)?
After that, the graphs came back, but that warning remains.

Seeing the same. Following the fixes seem to do nothing. All graphs stopped. and it just repeats that the schema is wrong. Have done a daily.sh as well.

1 Like

Same here on a couple of installs.
All poller runs fail with log lines like:

2025-11-26 06:45:07,553 :: ERROR :: Thread Thread-31 (poll_worker) exited with code 1
2025-11-26 06:45:07,553 :: ERROR :: 
2025-11-26 06:45:07,554 :: WARNING :: worker Thread-31 (poll_worker) finished device 33 in 2 seconds with exit code 1

Manual run of daily.sh gives:

Clearing caches                                    OK
Updating to latest codebase                        OK
Updating Composer packages                         OK
Updating SQL-Schema                                FAIL

   INFO  Running migrations.  

  2025_05_28_092148_create_device_stats ................................................................................................ 5.68ms FAIL

In Connection.php line 824:
                                                                                                                                                                                       
  SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'ping_last_timestamp' (Connection: mysql, SQL: create table `device_stats` (`id` bigint unsigned   
  not null auto_increment primary key, `created_at` timestamp null, `updated_at` timestamp null, `device_id` int unsigned not null, `ping_last_timestamp` timestamp not null, `ping_r  
  tt_last` float(53) unsigned null, `ping_rtt_prev` float(53) unsigned null, `ping_rtt_avg` float(53) unsigned null, `ping_rtt_diff_avg_last` float(53) as (ping_rtt_last - ping_rtt_  
  avg), `ping_rtt_diff_prev_last` float(53) as (ping_rtt_last - ping_rtt_prev), `ping_loss_last` float(53) unsigned null, `ping_loss_prev` float(53) unsigned null, `ping_loss_avg` f  
  loat(53) unsigned null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')                                                                                                  
                                                                                                                                                                                       

In Connection.php line 570:
                                                                                                           
  SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'ping_last_timestamp'  
                                                                                                           
Updating submodules                                OK
Cleaning up DB                                     OK
Fetching notifications                             OK
Caching PeeringDB data                             OK

Install info:
Standard Ubuntu 22.04 LTS

Version 25.12.0-dev.21+e59be9a75 - Tue Nov 25 2025 16:35:34 GMT+0100
Database Schema 2025_10_17_112553_bgp_peers_cbgp_bigint (358)
Web Server Apache
PHP 8.3.26
Python 3.10.12
Database MariaDB 10.6.22-MariaDB-0ubuntu0.22.04.1
Laravel 12.38.1
RRDtool 1.7.2

But did you run ./validate.php on the CLI (ssh) and followed the steps?
For example, the first time I ran ./validate.php, it suggested the ./lnms migrate

librenms@librenms:~$ ./validate.php

Component Version
LibreNMS 25.12.0-dev.21+e59be9a75 (2025-11-25T15:35:34+00:00)
DB Schema 2025_10_17_112553_bgp_peers_cbgp_bigint (358)
PHP 8.4.12
Python 3.10.12
Database MariaDB 10.6.22-MariaDB-0ubuntu0.22.04.1
RRDTool 1.7.2
SNMP 5.9.1
===========================================

[OK] Composer Version: 2.9.2
[OK] Dependencies up-to-date.
[OK] Database Connected
[FAIL] Your database is out of date!
[FIX]:
./lnms migrate
Attempt to fix this issue (y or n)?:y
Attempted to apply fix.
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK] MySQL and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[OK] Redis is unavailable
[OK] rrd_dir is writable
[OK] rrdtool version ok

After that, the graphs were being filled again, but, every time I validate, the incorrect column (device_stats/ping_last_timestamp) error always appears (I already checked the DB, and it’s OK):

librenms@librenms:~$ ./validate.php

Component Version
LibreNMS 25.12.0-dev.21+e59be9a75 (2025-11-25T15:35:34+00:00)
DB Schema 2025_05_28_092148_create_device_stats (359)
PHP 8.4.12
Python 3.10.12
Database MariaDB 10.6.22-MariaDB-0ubuntu0.22.04.1
RRDTool 1.7.2
SNMP 5.9.1
===========================================

[OK] Composer Version: 2.9.2
[OK] Dependencies up-to-date.
[OK] Database Connected
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK] Database and column collations are correct
[FAIL] We have detected that your database schema may be wrong
Database: incorrect column (device_stats/ping_last_timestamp)
[FIX]:
Run the following SQL statements to fix it
SQL Statements:
ALTER TABLE device_stats CHANGE ping_last_timestamp ping_last_timestamp timestamp NOT NULL ;
Attempt to fix this issue (y or n)?:y
Attempted to apply fix.
[OK] MySQL and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[OK] Redis is unavailable
[OK] rrd_dir is writable
[OK] rrdtool version ok

The graphs have a gap (the time between when the ./daily was executed and the ./lnms migrate):

2 Likes

We crossed each others post - thanks :slight_smile:

Partially fixed by manually running ./validate.php on console:
(Graphs and RRD are now updated and no errors in poller log)

Validate fix
$ ./validate.php 
...

[OK]    Composer Version: 2.9.1
[OK]    Dependencies up-to-date.
[OK]    Database Connected
[FAIL]  Your database is out of date!
	[FIX]: 
	./lnms migrate
Attempt to fix this issue (y or n)?:y
Attempted to apply fix.
[OK]    SQL Server meets minimum requirements
[OK]    lower_case_table_names is enabled
[OK]    MySQL engine is optimal
[OK]    MySQL and PHP time match
[OK]    Active pollers found
[OK]    Dispatcher Service not detected
[OK]    Locks are functional
[OK]    Python poller wrapper is polling
[OK]    Redis is unavailable
[OK]    rrd_dir is writable
[OK]    rrdtool version ok

But it still gives this error on validation that is not fixed:
(not sure what the impact is..)

Validate 2nd run
$ ./validate.php 
...
[OK]    Composer Version: 2.9.1
[OK]    Dependencies up-to-date.
[OK]    Database Connected
[OK]    Database Schema is current
[OK]    SQL Server meets minimum requirements
[OK]    lower_case_table_names is enabled
[OK]    MySQL engine is optimal
[OK]    Database and column collations are correct
[FAIL]  We have detected that your database schema may be wrong
Database: incorrect column (device_stats/ping_last_timestamp)
	[FIX]: 
	Run the following SQL statements to fix it
	SQL Statements:
	 ALTER TABLE `device_stats` CHANGE `ping_last_timestamp` `ping_last_timestamp` timestamp NOT NULL ;
Attempt to fix this issue (y or n)?:y
Attempted to apply fix.
[OK]    MySQL and PHP time match
[OK]    Active pollers found
[OK]    Dispatcher Service not detected
[OK]    Locks are functional
[OK]    Python poller wrapper is polling
[OK]    Redis is unavailable
[OK]    rrd_dir is writable
[OK]    rrdtool version ok

Running suggested DB fix does not update any records:

MariaDB [librenms]> ALTER TABLE `device_stats` CHANGE `ping_last_timestamp` `ping_last_timestamp` timestamp NOT NULL ;
**Query OK, 0 rows affected (0.016 sec)**
**Records: 0 Duplicates: 0 Warnings: 0**
1 Like

Facing the same issue
The fix given does not fixes it and validate.php gives the same error again

===========================================

Component Version
LibreNMS 25.12.0-dev.21+e59be9a75 (2025-11-25T15:35:34+00:00)
DB Schema 2025_05_28_092148_create_device_stats (359)
PHP 8.3.11
Python 3.10.12
Database MariaDB 10.6.22-MariaDB-0ubuntu0.22.04.1
RRDTool 1.7.2
SNMP 5.9.1
===========================================

[OK] Composer Version: 2.9.2
[OK] Dependencies up-to-date.
[OK] Database Connected
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK] Database and column collations are correct
[FAIL] We have detected that your database schema may be wrong
Database: incorrect column (device_stats/ping_last_timestamp)
[FIX]:
Run the following SQL statements to fix it
SQL Statements:
ALTER TABLE device_stats CHANGE ping_last_timestamp ping_last_timestamp timestamp NOT NULL ;
Attempt to fix this issue (y or n)?:y
Attempted to apply fix.
[OK] MySQL and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[OK] Redis is functional
[OK] rrd_dir is writable
[OK] rrdtool version ok

Yep, I’m seeing exactly the same behaviour.

Running ./validate.php on the CLI fixes the RRD/poller issue, and the graphs start updating again.
The only thing that stays is the schema warning for:

device_stats/ping_last_timestamp

When I run the suggested ALTER manually, I also get:

Query OK, 0 rows affected

I think that happens because the column is already timestamp NOT NULL, so MariaDB doesn’t actually change anything. It just keeps the default value (0000-00-00 00:00:00), and because of that the validator keeps reporting it on every run.

Poller is updating that field fine on my side, so I think this might be a validator false positive on the dev branch rather than a real schema issue.

Let’s see what the maintainers say.

Looks like a timezone issue of the default value… innocuous.

Same issue here. Do we simply follow the ./validate.php auto fixes? or will this make it worse?

[FAIL] Your database is out of date!
[FIX]:
./lnms migrate
Attempt to fix this issue (y or n)?:y
Attempted to apply fix.

Now:

[FAIL] We have detected that your database schema may be wrong
Database: incorrect column (device_stats/ping_last_timestamp)
[FIX]:
Run the following SQL statements to fix it
SQL Statements:
ALTER TABLE device_stats CHANGE ping_last_timestamp ping_last_timestamp timestamp NOT NULL ;
Attempt to fix this issue (y or n)?:

I’m seeing this exact issue as well. Same error about the database being out of date. The graphs stopped getting data at exactly midnight. Applying the fixes suggested by validate.php did not help.

I managed to fix the issue by applying pull request #18568 from github that I saw shared in the LibreNMS discord server: Update the device_stats migration to make the timestamp field nullable by eskyuu · Pull Request #18568 · librenms/librenms · GitHub

I’ve seen the same issue too. After running lnms migrate from the validate script, it prompts the same Database: incorrect column (device_stats/ping_last_timestamp) issue. I told the validate script to attempt the fix, and the pollers now seem to be working correctly, even though the validate script still flags the same issue.

Jus wanted to chime in and confirm this impacted us too. Please advise. Same results as others and manually applying the queries from ./validate.php did not help. Thanks!

Impacted me as well. I’ve disabled my daily.sh updates for now and recovered my VM from a snapshot. Presumably a bug?

Exact same issue, broke after last nights update. Waiting for a solid fix to be released.

Thanks

Fix was already released 4 hours ago, run ./daily.sh

2 Likes

AWESOME, THANK YOU for your help!

fixed it for me too, thank you :slight_smile: