Interface Description Parsing not populating under Ports => Customer

Good day

We trying to use the Interface Description Parsing to populate the ports.
Followed all the steps on the documentation and they 100% in place.

The descriptions has been tested with both Cap “Cust” and small “cust” with no luck. It’s almost as if there is some setting or database or something that is stuck somewhere to not pull the information to populate the ports-customers.

Run this in a mysql client:

select `port_descr_descr` from `ports` left join `devices` on `ports`.`device_id` = `devices`.`device_id` where `port_descr_type` in ('cust') group by `port_descr_descr`;

I performed the script in Mysql. Did a test afterwards and no luck on getting data through on the web page under ports=>customers

our some letters for security

±----------------------+
| port_descr_descr |
±----------------------+
| ######oklyn |
| ######o |
| ######er Forbes |
| ######ray |
| ######ray-A |
| ######a Ministries |
| ###### |
| ######ne |
| ######lson Tower |
| ###### Law |
| ######el - Telsys 1 |
| ######quare |
| ######-AEP-SO118698 |
| ######Pacific |
| ######ccess |
| ######cess |
| ######es |
| ###### |
| ###### |
| ######s |
| ######n Capital |
| ######ffice |
| ######range |
| ###### |
| ######do |
| ###### |
| ######sp-Fibre |
| ######ellan-SO033798 |
| ###### |
| ###### |
| ######s |
| ######t |
| ######Germiston |
| ######Nigel |
| ###### |
| ######nnwood |
| ######d Villages |
| ######r - Hofsanger |
| ######works |
| ######c |
| ######ec |
| ###### |
| ###### |
| ###### |
| ######ima |
| ###### Electric |
| ######rica |
| ######Holdings |
| ######rook Node |
| ######Main Trillogy |
| ######Main Trilogy |
| ######ts |
| ######ts-A |
| ######ts-B |
| ###### |
| ######d |
| ######t POP |
| ######ta Node |
| ###### |
| ######t/PVT Wealth |
| ######SP-DFA |
| ######te node |
| ######ed |
| ###### |
| ######ve |
| ######k |
| ######ne West Node |
| ######e |
| ######r |
| ###### |
| ######2 |
| ###### |
| ###### |
| ###### |
| ######nvestments |
| ###### |
| ###### |
| ######neVIP |
| ######2 |
| ######our Bakery |
| ######ls |
| ######ect |
| ######ark |
| ######rk Afrihost |
| ###### |
| ###### |
| ###### |
| ######i |
| ###### Mews |
| ###### Mews |
±----------------------+
90 rows in set (0.008 sec)

I found something but not sure if this might be related to the problem or to isolate the problem. Might just be grasping in the air to try and find the problem. When inspecting the page I find one error and have no idea how to find and isolate.

Customers - LibreNMS — Mozilla Firefox 2022-03-01

Definitely won’t help, check the librenms.log in the logs folder.

Had a look on the logs and found the following each time I refresh the page under ports=>customer

[2022-03-03T09:04:01.215777+02:00] production.ERROR: Trying to get property ‘os’ of non-object {“userId”:7,“exception”:"[object] (ErrorException(code: 0): Trying to get property ‘os’ of non-object at /opt/librenms/app/Models/Port.php:64)"}
[2022-03-03T09:04:31.662923+02:00] production.ERROR: Trying to get property ‘os’ of non-object {“userId”:7,“exception”:"[object] (ErrorException(code: 0): Trying to get property ‘os’ of non-object at /opt/librenms/app/Models/Port.php:64)"}

Think I might have found something causing the problem.

There is ports on the database that is not linked to a device ID. The device ID is devices that was removed and the port purge is not removing the ports.

Not sure how to manually purge the ports from the database to test if it was the problem or not.

MariaDB [librenms]> select device_id from ports where device_id not in (select device_id from devices);
±----------+
| device_id |
±----------+
| 89 |
| 89 |
| 89 |
| 103 |
| 103 |
| 103 |

Changed the parsing on Libre from cust to client and it seems to work for a fix. Would wish to be able to remove the stuck ports on deleted devices that does not want to purge to not be able to redo all the devices itself from cust to client

Hi, I had the exact same message in the librenms.log when going to the LibreNMS ‘Ports’ - ‘Customers’ page.
2022-03-17T12:53:43.028767+00:00] production.ERROR: Trying to get property ‘os’ of non-object {“userId”:4,“exception”:“[object] (ErrorException(code: 0): Trying to get property ‘os’ of non-object at /opt/librenms/app/Models/Port.php:64)”}

With the suspected cause being a deleted device’s ports still present in the ports table.
In my case device id 3 has been deleted and I assume because the os is NULL the exception is caused.

MariaDB [librenms]> select `port_descr_descr`, port_id, ports.device_id, ifAlias, devices.os from `ports` left join `devices` on `ports`.`device_id` = `devices`.`device_id` where `port_descr_type` in ('cust') order by `port_descr_descr`;
+-----------------------------------------+---------+-----------+------------+
| port_descr_descr      | port_id | device_id | ifAlias         | os         
+-----------------------------------------+---------+-----------+------------
| Acme                  |    1539 |         6 | Cust: Acme      | iosxr      
| Acme                  |     776 |         3 | Cust: Acme      | NULL <-----------

I think I have fixed the problem by deleting the ports associated with the deleted devices.

I identified the port id’s with deleted devices with the following query
MariaDB [librenms]> select port_id from ports where device_id not in (select device_id from devices);

±--------+
| port_id |
±--------+
| 101 |
| 776 |
etc

Then added the port id’s to a file then bulk deleted with the purge-ports.php script.

./scripts/purge-port.php -f purge-ports.txt

The LibreNMS ‘Ports’ - ‘Customers’ page now loads as expected, with no further exceptions in the librenms.log

I am not aware of any other problems these actions might cause and I am not sure how I got into this state. Also what the process is to remove these ports in an automated way so this does not happen in the future.
The cleanup ‘Ports older than (days)’ is set to 10 days.

1 Like

Their used to be a purge deleted ports option in the webui under the Deleted ports link.

Thanks, you where able to guide me in the correct direction.
The script did not want to run and gave an error to open the file file containing the list of port ID’s. Did it a bit different but worked like a charm.

Here is what I did hope it helps anyone else that have the same problem.

Log on to mysql

mysql -u root

Navigate to DB

use librenms;

Run script to find the ports that is stuck

select port_id from ports where device_id not in (select device_id from devices);

Copy the list of port to Notepad++ and add the a string before the port ID and remove anything else after the port ID
Example :

./purge-port.php -p 5788
./purge-port.php -p 5604

Navigate to the script directory (for some the directory might be different)

cd /opt/librenms/scripts/

Copy and past the content on the Notepad++

./purge-port.php -p 5788
./purge-port.php -p 5604

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.