MIBs

Add a MIB

Example :

# cd /usr/share/snmp/mibs
# cp /tmp/squid.txt .
# head -n1 squid.txt
-- SQUID-MIB  { iso org(3) dod(6) internet(1) private(4) enterprises(1) 3495 }
# echo "SQUID-MIB squid.txt" >> .index
# echo "mibs +SQUID-MIB" >> /etc/snmp/snmp.conf

Extend Net-SNMP with scripts

Read

snmpd.conf

exec .1.3.6.1.4.1.15243.10.1 helloworld /root/bin/snmp-get.sh                                                                   

snmp-get.sh

#!/bin/bash

echo "hello world !"

exit  42
# snmpwalk -v2c -c public localhost .1.3.6.1.4.1.15243.10.1
SNMPv2-SMI::enterprises.15243.10.1.1.1 = INTEGER: 1
SNMPv2-SMI::enterprises.15243.10.1.2.1 = STRING: "helloworld"
SNMPv2-SMI::enterprises.15243.10.1.3.1 = STRING: "/root/bin/snmp-get.sh"
SNMPv2-SMI::enterprises.15243.10.1.100.1 = INTEGER: 42
SNMPv2-SMI::enterprises.15243.10.1.101.1 = STRING: "hello world !"
SNMPv2-SMI::enterprises.15243.10.1.102.1 = INTEGER: 0
SNMPv2-SMI::enterprises.15243.10.1.103.1 = ""

Write

FIXME