Docker deleted ports

When polling information about ports, LibreNMS will keep historical information about removed ports (and the corresponding RRD files), filling up the disk space.

This is of course expected behavior, but some software like Docker will aggressively try to restart its containers, creating hundreds or thousands of interfaces in the process. I’ve found around 50k deleted ports on the LibreNMS instances I manage, almost all of them because of Docker.

At this point automating its purging is a bit complicated and not something I’d like doing, so I’m wondering:

  • Is there an auto-purge method anywhere?
  • Can the purge-deleted function be exposed in the API?
  • Any other way to automate this? SNMP exception maybe?

As far as I can see, deleted-ports.inc.php removes database entries, but I can’t find the function that removes the RRD files.

Are you saying you are constantly having new ports created but this is the same port so the old one gets marked as deleted? If so, sounds like ifIndex is changing so switch to using ifName or ifDescr for port association - it’s in the docs afaik.

Thanks for the reply.

Ideally, I’d like to call the purge-deleted function from a cron or API call. Is that possible?

Not at this time, you should really just use the correct config to deal with this though.

Another thing: the purge function deletes the files, but does it also remove any database entries or anything else?

Yes it will remove the ports from the db as well.