4

You can monitor lots of different data points about a Linux system using SNMP, if you pick the correct MIB numbers (e.g. like .1.3.6.1.4.1.2021.9.1.2.1 on http://www.debianhelp.co.uk/linuxoids.htm).

Where is the code for each MIB test stored on a Linux machine?

Is it possible to add your own custom tests? (e.g. when a custom MIB is queried, run a python script and return the response)?

Skippy29
  • 43
  • 1
  • 3

2 Answers2

2

The location is probably dependent on your distribution; on Debian they live under /usr/share/snmp/mibs. In addition to Antoine's answer on simple exec plugins for net-snmpd, you can also write more complicated plugins for net-snmpd that integrate more seamlessly; I've also written my own Ruby SNMP agent which is designed to make it trivial to handle custom SNMP data (it's the whole reason for it's existence).

Aaron
  • 2,968
  • 1
  • 23
  • 36
womble
  • 96,255
  • 29
  • 175
  • 230
1

I don't know where the MIB is stored on a Linux machine but you can add the result of scripts in the default MIB by using the following syntax :

exec railsversion "/bin/bash /etc/snmp/railsversion.sh"

It will show up in your MIB which you can test by using the following command.

snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.8

This is pretty well documented in the snmpd.conf file found in Debian and probably other distros.

I find this option very useful as it eliminates the need for a specific monitoring agent.

Antoine Benkemoun
  • 7,314
  • 3
  • 42
  • 60