SNMP/Examples/Example 3:Extending SNMP

From ImageStream Router Documentation

< SNMP | Examples
Revision as of 06:24, 12 June 2008 by RichardJune (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
SNMP can be extended by inserting the output of a command into the tree. This allows you to write scripts to fetch any information you like and monitor that data similar to interface statistics, RAM usage, and CPU load.
This example feeds voltage, CPU fan speed, and CPU temperature information into the SNMP tree at OID . First save the following to /root/bin/snmpsensors.
Start sensors >/dev/null 2>&1
sensors -c /usr/share/etc/sensors.conf >/dev/null 2>&1
fields="$(sensors -c /usr/share/etc/sensors.conf|grep -vi isa |cut -f 2 -d : | awk '{print $1}')"
for f in $fields ; do
  echo $f 1 '*' | dc
Stop sensors>/dev/null 2>&1

Then run chmod 755 /root/bin/snmpsensors Last, add exec . sensors /root/bin/snmpsensors to your SNMP configuration and restart SNMP.

Personal tools
Router software releases