Unused ports more than 30 days

Due to the fact that from time to time service technicians uncross ports that have not been operating for more than 30 days.

Can I get such a list from librnms??

1 Like

I guess It’s quite doable in a DB-query.

For WebUI, refer below screenshot

If you export to excel there is no this data

Can you create such a query

value is stored as “ifLastChange” in ports table in DB.but its value is long integer.
if we run a query on ports table, we just get long digits only.

some where librenms script is converting its value to years,months,days,hours,minutes and showing in webui

need to figure, how its calculating

There is an ajax call that is returning the last Status Change time in seconds from the below - by subtracting ifLastChange / 100 from the device uptime:

This is then being converted client-side with a javascript call from here:

As an example from browser inspect console:


With that knowledge you should be able to compare that to > 30 days of seconds in a query.

1 Like

Hello, have you found the solution to ports more than 30 days.
thank you

dirty way to get the required details

select devices.device_id, devices.sysName, devices.hostname, devices.uptime, ports.port_id, ports.ifDescr,ports.ifLastChange, ((devices.uptime-(ports.ifLastChange/100))/86400)/(365/12) as lastchange, ports.ifOperStatus from devices left join ports on devices.device_id=ports.device_id where ports.ifOperStatus=“Down” and ((devices.uptime-(ports.ifLastChange/100))/86400)/(365/12) between 1 and 2;

gives ports list which are down for 30-60 days