Hello all,
I’m relatively new to LibreNMS (and SNMP).
I’m trying to inject/extend/add/pass a custom OID into SNMP and have it show in LibreNMS.
The device is a Raspberry Pi with a temperature probe. I already have this working and I can get the temperature value no problem.
In my /etc/snmp/snmpd.conf
I have the following line:
extend .1.3.6.1.2.1.5.26.1 temp_hi_in /bin/sh /home/tempmonitor/gettemp.sh
Where gettemp.sh
contains the following:
#!/bin/bash
SENSOR=$1
SLAVE="/sys/bus/w1/devices/28-666a741f64ff/w1_slave"
OUTPUT=$(/usr/bin/cat $SLAVE | /usr/bin/awk -F 't=' ' { printf $2 } ')
echo .1.3.6.1.2.1.5.26.1
echo guage
echo $OUTPUT
If I run /bin/sh /home/tempmonitor/gettemp.sh
I get the following output:
root@tempmonitor:~# /bin/sh /home/tempmonitor/gettemp.sh
.1.3.6.1.2.1.5.26.1
guage
14562
If I run this command snmpwalk -v3 -l auth -u {user} -a MD5 -A {MD5pass} localhost .1.3.6.1.2.1.5.26.1
I get the output below:
root@tempmonitor:~# snmpwalk -v3 -l auth -u {user} -a MD5 -A {MD5pass} localhost .1.3.6.1.2.1.5.26.1 IP-MIB::icmpOutAddrMaskReps.1.1.0 = Wrong Type (should be Counter32): INTEGER: 1 IP-MIB::icmpOutAddrMaskReps.1.2.1.2.10.116.101.109.112.95.104.105.95.105.110 = Wrong Type (should be Counter32): STRING: "/bin/sh" IP-MIB::icmpOutAddrMaskReps.1.2.1.3.10.116.101.109.112.95.104.105.95.105.110 = Wrong Type (should be Counter32): STRING: "/home/tempmonitor/gettemp.sh" IP-MIB::icmpOutAddrMaskReps.1.2.1.4.10.116.101.109.112.95.104.105.95.105.110 = Wrong Type (should be Counter32): "" IP-MIB::icmpOutAddrMaskReps.1.2.1.5.10.116.101.109.112.95.104.105.95.105.110 = Wrong Type (should be Counter32): INTEGER: 5 IP-MIB::icmpOutAddrMaskReps.1.2.1.6.10.116.101.109.112.95.104.105.95.105.110 = Wrong Type (should be Counter32): INTEGER: 1 IP-MIB::icmpOutAddrMaskReps.1.2.1.7.10.116.101.109.112.95.104.105.95.105.110 = Wrong Type (should be Counter32): INTEGER: 1 IP-MIB::icmpOutAddrMaskReps.1.2.1.20.10.116.101.109.112.95.104.105.95.105.110 = Wrong Type (should be Counter32): INTEGER: 4 IP-MIB::icmpOutAddrMaskReps.1.2.1.21.10.116.101.109.112.95.104.105.95.105.110 = Wrong Type (should be Counter32): INTEGER: 1 IP-MIB::icmpOutAddrMaskReps.1.3.1.1.10.116.101.109.112.95.104.105.95.105.110 = Wrong Type (should be Counter32): STRING: ".1.3.6.1.2.1.5.26.1" IP-MIB::icmpOutAddrMaskReps.1.3.1.2.10.116.101.109.112.95.104.105.95.105.110 = Wrong Type (should be Counter32): STRING: ".1.3.6.1.2.1.5.26.1 guage 14500" IP-MIB::icmpOutAddrMaskReps.1.3.1.3.10.116.101.109.112.95.104.105.95.105.110 = Wrong Type (should be Counter32): INTEGER: 3 IP-MIB::icmpOutAddrMaskReps.1.3.1.4.10.116.101.109.112.95.104.105.95.105.110 = Wrong Type (should be Counter32): INTEGER: 0 IP-MIB::icmpOutAddrMaskReps.1.4.1.2.10.116.101.109.112.95.104.105.95.105.110.1 = Wrong Type (should be Counter32): STRING: ".1.3.6.1.2.1.5.26.1" IP-MIB::icmpOutAddrMaskReps.1.4.1.2.10.116.101.109.112.95.104.105.95.105.110.2 = Wrong Type (should be Counter32): STRING: "guage" IP-MIB::icmpOutAddrMaskReps.1.4.1.2.10.116.101.109.112.95.104.105.95.105.110.3 = Wrong Type (should be Counter32): STRING: "14500"
Obviously I can see above a few errors but not sure if they are relevant nor how to fix them.
Finally in LibreNMS I have created a Custom OID with a type ‘Gauge’ using the OID .1.3.6.1.2.1.5.26.1 but it either displays nothing as the value or 0 as the value returned. I’ve tried deleting, re-adding and re-discovering but nothing.
Would appreciate if someone could lend a hand.
Alternatively, is there a way that I can ‘send’ a value to LibreNMS or have Libre NMS ‘get’ a value from a remote file (text or .json)?
Thanks in advance!