Thanks, Wyatt, for a great presentation last night! It provided a great overview and demo of monitoring I2C sensors on a Raspberry Pi, via GPIO pins. You mentioned that some of the sensors visible to libsensors/lm-sensors are made available to net-snmp via particular MIB OID's, but not all of them.
If you want to monitor any sensors that aren't directly available in net-snmp (e.g. in LibreNMS), there is a way around that, using net-snmp's "extend" mechanism, and a helper script, such as this one...
https://docs.librenms.org/Extensions/Applications/Raspberry%20Pi%20GPIO%20Mo...
You would download the rpigpiomonitor.php file as recommended, as well as the provided sample rpigpiomonitor.ini file, which you would then edit as needed for your particular sensor(s). For example, this is my INI file for monitoring temperature and humidity from a DHT22/AM2302 sensor (not I2C based, but there is a kernel dtoverlay module for it):
; Example configuration which reads a temperature sensor [sensortemp] type = temperature description = AM2302 Room Temperature lowlimit = 0 lowwarnlimit = 15 warnlimit = 32 highlimit = 40 external_gpio_reader = /etc/snmp/Get_DHT_fp_temp.sh
; Example configuration which reads a humidity sensor [sensorhum] type = humidity description = AM2302 Relative Humidity lowlimit = 0 lowwarnlimit = 4 warnlimit = 65 highlimit = 90 external_gpio_reader = /etc/snmp/Get_DHT_fp_hum.sh
The "external_gpio_reader" variable is set to a program or script file (it has to be a file, as the PHP code tests to see if the file exists before trying to run it) which would provide a single numerical value as output, corresponding to a specific sensor. Since you can't pass arguments to the program/script, you would typically need a separate wrapper script for each sensor. (Of course, you can use multiple links to the same script, and use the script name as an implicit argument to the shared script.)
Hope this helps!
Gilbert
-- Gilbert E. Detillieux E-mail: gedetil@muug.ca Manitoba UNIX User Group Web: http://muug.ca/ _______________________________________________ Roundtable mailing list -- roundtable@muug.ca To unsubscribe send an email to roundtable-leave@muug.ca