librenms / librenms-agent

LibreNMS Agent & Scripts
GNU General Public License v2.0
117 stars 188 forks source link

improve FreeRADIUS stats efficiency #389

Closed thedaveking closed 2 years ago

thedaveking commented 2 years ago

Add some troubleshooting comments. Change the AGENT variable comparison to numeric to avoid "unexpected operator" fault on bash 5 / Debian 11. Verify the radcheck result is valid before parsing it. Parse result using a single call to sed with multiple commands to cut CPU time in half and syscalls by 90%.

Since the LibreNMS app module carefully extracts only the stats it needs, I experimented with just matching on FreeRADIUS-Total or FreeRADIUS-Queue, but found no significant improvement. At least this method explicitly declares what is being passed.

I canceled my prior similar PR which had dropped the .sh extension, since that could break existing configs.