SNMP - LibreNMS Monitor Temperature Option (NET-SNMP)
-
Hi All,
Just thought I would give back to the community to monitor your pfSense for temperature through SNMP. Find this useful please leave a comment.
Prerequisites:
NET-SNMP package from pfSense
LibreNMS
SSH access to pfSense with basic VI editing skills
Linux skillsLog into pfSense to Shell (8):
Create a file called gettemps.sh through VI:
vi /root/gettemps.shFile content:
#!/bin/sh
/sbin/sysctl dev.cpu | /usr/bin/awk '/temperature/ {print $2;}' | sed 's/[F]//g'Save and quit the file.
Make it executable:
chmod the file to make it executable
chmod +x /root/gettemps.shGo to pfSense > Services > NET-SNMP > Host Information
Add into the Extended Commands
Name: gettemps
Program: /root/gettemps.sh
Save
(note: the Name in the screenshot has been chopped off - it is gettemps)Go to pfSense SSH
If running SNMP v3 use (replace variables):
snmpget -v 3 -l authPriv -a SHA -A [password] -u snmp -x AES -X [password] [fw-hostip] nsExtendOutputFull."gettemps"If running SNMP v2c use (replace variables):
snmpwalk -c public -v 2c [fw-hostip] nsExtendOutLine."gettemps"
Output should look like this below:
NET-SNMP-EXTEND-MIB::nsExtendOutputFull."gettemps" = STRING:
44.0C
48.0C
44.0C
47.0CTake the MIB after the two colons(::) nsExtendOutputFull."gettemps" that you get (my example is above) and add it to the LibreNMS Custom OID field. Set limits etc. Save it off.
Wait about 15 minutes and there will be a chart drawn up.
To view the data now go to:
You can now monitor your temperature of the pfSense through LibreNMS.Any issues let me know. Thanks.
M.References:
https://forum.netgate.com/topic/107545/reading-out-the-temperature/4
https://www.reddit.com/r/PFSENSE/comments/cnjddc/howto_retrieve_cpu_temp_and_other_data_over_snmp/