Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Update raspberrypi sensor discovery to check for sensor existance #5114
I recently added a RaspberryPi to my network to convert a USB UPS into a Network UPS. As part of that I added snmp to the Pi and added it to my librenms install. What I found is that the existing discovery code for the Pi just assumes that the snmp extend for raspberry.sh is enabled. It discovers sensors which on my install, had no data and it made for a messy page. So I offer this patch for consideration.
It looks like 2 of the 4 sensors have code to validate the data before discovering the sensor, but only one of those works (temperature). So these patches add if code to confirm we get something good back before
My main use for this is that is allows me to run my own raspberry.sh snmp extend which only provides temperature data and doesn't require root/sudo. I didn't want to give those permissions to the script/ run
The attached screenshot shows the existing behavior with a snmp extend only providing temperature data, then the same situation after this patch (the unused sensors disappear). Finally the bottom screenshot is after this patch is applied with a "stock" snmp extend showing the sensors still polled and working.
This code should only run on raspberry pi discovery since it's already in an