I have two ports showing in the list of down ports that appear to be attached to a deleted device. The link is like /device/device=139/tab=port/port=11685/ and I’ve confirmed both in the web UI and manually with a mysql query that no such device ID exists. (404 on /device/139 in the web, “Empty set (0.001 sec)” on query “SELECT device_id FROM devices WHERE device_id=139”).
Is it safe to do a “DELETE FROM ports WHERE device_id=139” and should I be cleaning up any other tables? It does appear there’s data by port_id in ports_statistics as well. Is there an easier/safer way to clean this up?
I do run validate.php every few days by hand. I have distributed polling setup. This is the mysql host:
librenms@nms:~$ ./validate.php
===========================================
Component | Version
--------- | -------
LibreNMS | 25.4.0-17-geea4b297b (2025-04-21T15:59:22-06:00)
DB Schema | 2025_03_19_205700_fix_ospfv3_ports_table (331)
PHP | 8.3.6
Python | 3.12.3
Database | MariaDB 10.11.11-MariaDB-0ubuntu0.24.04.2
RRDTool | 1.7.2
SNMP | 5.9.4.pre2
===========================================
[OK] Composer Version: 2.8.8
[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
[OK] Database schema correct
[OK] MySQL and PHP time match
[OK] Distributed Polling setting is enabled globally
[OK] Connected to rrdcached
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[OK] Redis is functional
[OK] rrdtool version ok
[OK] Connected to rrdcached
librenms@nms:~$