librenms / librenms-agent

LibreNMS Agent & Scripts
GNU General Public License v2.0
116 stars 186 forks source link

Using check_mk dmi agent conflicts with discovery (causing flapping Hardware/Serial Numbers in logs) #487

Open bnerickson opened 9 months ago

bnerickson commented 9 months ago

Issue: If you use the dmi check_mk agent, discovery will revert the changes that the agent make to the device's Serial Number and Hardware type. Once the dmi agent is re-executed, the Serial Number and Hardware type revert back to their "correct" values. LibreNMS logs are constantly updated with the flapping values as a result:

2023-09-15 06:35:25 | system | multi | Hardware: Generic x86 64-bit -> Xen HVM domU | System
2023-09-15 06:35:25 | system | multi | Serial: 4046632a-32d4-6ffa-7b8b-e0cfd30a3ed9 | System
2023-09-15 06:35:11 | system | multi | Hardware: Xen HVM domU -> Generic x86 64-bit | System
2023-09-15 06:35:11 | system | multi | Serial: 4046632a-32d4-6ffa-7b8b-e0cfd30a3ed9 -> | System

In the log entries above, the actions at 06:35:11 are taken during discovery of the device, and the actions at 06:35:25 are taken by polling the unix-agent dmi.

I'm not really familiar with the discovery process (LibreNMS/Modules/Core.php) and whether the unix-agent (the if (isset($agent_data['dmi'])) section in includes/polling/unix-agent.inc.php ) can be inherited to poll dmi data during discovery, but that would be the preferred method of discovery to prevent these values from flapping.

murrant commented 9 months ago

Seems like you are on the right track.