Le blog du petit geek malin ;-)

OIDs SNMP intéressants pour OpenWrt

SNMP OIDs for OpenWrt



SNMP native sensors
SNMP called scripts
Cacti templates


SNMP native sensors



SNMPv2-SMI = iso.org.dod.internet = 1.3.6.1
SNMPv2-MIB = iso.org.dod.internet.mgmt.mib-2 = 1.3.6.1.2.1
IF-MIB = iso.org.dod.internet.mgmt.mib-2.interfaces = 1.3.6.1.2.1.2
ICMP-MIB = iso.org.dod.internet.mgmt.mib-2.icmp = 1.3.6.1.2.1.5
TCP-MIB = iso.org.dod.internet.mgmt.mib-2.tcp = 1.3.6.1.2.1.6
UDP-MIB = iso.org.dod.internet.mgmt.mib-2.udp = 1.3.6.1.2.1.7
HOST-RESOURCES-MIB = iso.org.dod.internet.mgmt.mib-2.host = 1.3.6.1.2.1.25
UCD-SNMP-MIB = iso.org.dod.internet.private.enterprises.ucdavis = 1.3.6.1.4.1.2021


CPU load (1 min average)

UCD-SNMP-MIB::laLoadInt.1 = INTEGER
1.3.6.1.4.1.2021.10.1.5.1

CPU > user

UCD-SNMP-MIB::ssCpuRawUser.0 = Counter32
1.3.6.1.4.1.2021.11.50.0

CPU > nice

UCD-SNMP-MIB::ssCpuRawNice.0 = Counter32
1.3.6.1.4.1.2021.11.51.0

CPU > system

UCD-SNMP-MIB::ssCpuRawSystem.0 = Counter32
1.3.6.1.4.1.2021.11.52.0

CPU interrupts

UCD-SNMP-MIB::ssRawInterrupts.0 = Counter32
1.3.6.1.4.1.2021.11.59.0

RAM

HOST-RESOURCES-MIB::hrStorageSize.2 = INTEGER
1.3.6.1.2.1.25.2.3.1.5.2
HOST-RESOURCES-MIB::hrStorageUsed.2 = INTEGER
1.3.6.1.2.1.25.2.3.1.6.2

Swap space

HOST-RESOURCES-MIB::hrStorageSize.3 = INTEGER
1.3.6.1.2.1.25.2.3.1.5.3
HOST-RESOURCES-MIB::hrStorageUsed.3 = INTEGER
1.3.6.1.2.1.25.2.3.1.6.3

ROM

HOST-RESOURCES-MIB::hrStorageSize.5 = INTEGER
1.3.6.1.2.1.25.2.3.1.5.5

jffs partition

HOST-RESOURCES-MIB::hrStorageSize.6 = INTEGER
1.3.6.1.2.1.25.2.3.1.5.6
HOST-RESOURCES-MIB::hrStorageUsed.6 = INTEGER
1.3.6.1.2.1.25.2.3.1.6.6

eth0 (switch)

IF-MIB::ifInOctets.2 = Counter32
1.3.6.1.2.1.2.2.1.10.2
IF-MIB::ifOutOctets.2 = Counter32
1.3.6.1.2.1.2.2.1.16.2
IF-MIB::ifInUcastPkts.2 = Counter32
1.3.6.1.2.1.2.2.1.11.2
IF-MIB::ifOutUcastPkts.2 = Counter32
1.3.6.1.2.1.2.2.1.17.2

eth0.0 (lan)

IF-MIB::ifInOctets.3 = Counter32
1.3.6.1.2.1.2.2.1.10.3
IF-MIB::ifOutOctets.3 = Counter32
1.3.6.1.2.1.2.2.1.16.3
IF-MIB::ifInUcastPkts.3 = Counter32
1.3.6.1.2.1.2.2.1.11.3
IF-MIB::ifOutUcastPkts.3 = Counter32
1.3.6.1.2.1.2.2.1.17.3

eth0.1 (wan)

IF-MIB::ifInOctets.4 = Counter32
1.3.6.1.2.1.2.2.1.10.4
IF-MIB::ifOutOctets.4 = Counter32
1.3.6.1.2.1.2.2.1.16.4
IF-MIB::ifInUcastPkts.4 = Counter32
1.3.6.1.2.1.2.2.1.11.4
IF-MIB::ifOutUcastPkts.4 = Counter32
1.3.6.1.2.1.2.2.1.17.4

br-lan (bridge)

IF-MIB::ifInOctets.5 = Counter32
1.3.6.1.2.1.2.2.1.10.5
IF-MIB::ifOutOctets.5 = Counter32
1.3.6.1.2.1.2.2.1.16.5
IF-MIB::ifInUcastPkts.5 = Counter32
1.3.6.1.2.1.2.2.1.11.5
IF-MIB::ifOutUcastPkts.5 = Counter32
1.3.6.1.2.1.2.2.1.17.5

wl0 (wlan)

IF-MIB::ifInOctets.6 = Counter32
1.3.6.1.2.1.2.2.1.10.6
IF-MIB::ifOutOctets.6 = Counter32
1.3.6.1.2.1.2.2.1.16.6
IF-MIB::ifInUcastPkts.6 = Counter32
1.3.6.1.2.1.2.2.1.11.6
IF-MIB::ifOutUcastPkts.6 = Counter32
1.3.6.1.2.1.2.2.1.17.6

tun0 (vpn)

IF-MIB::ifInOctets.7 = Counter32
1.3.6.1.2.1.2.2.1.10.7
IF-MIB::ifOutOctets.7 = Counter32
1.3.6.1.2.1.2.2.1.16.7
IF-MIB::ifInUcastPkts.7 = Counter32
1.3.6.1.2.1.2.2.1.11.7
IF-MIB::ifOutUcastPkts.7 = Counter32
1.3.6.1.2.1.2.2.1.17.7

TCP established connections

TCP-MIB::tcpCurrEstab.0 = Gauge32
1.3.6.1.2.1.6.9.0

TCP segments

TCP-MIB::tcpInSegs.0 = Counter32
1.3.6.1.2.1.6.10.0
TCP-MIB::tcpOutSegs.0 = Counter32
1.3.6.1.2.1.6.11.0

UDP datagrams

UDP-MIB::udpInDatagrams.0 = Counter32
1.3.6.1.2.1.7.1.0
UDP-MIB::udpOutDatagrams.0 = Counter32
1.3.6.1.2.1.7.4.0

ICMP messages

ICMP-MIB::icmpInMsgs.0 = Counter32
1.3.6.1.2.1.5.1.0
ICMP-MIB::icmpOutMsgs.0 = Counter32
1.3.6.1.2.1.5.14.0

SNMP packets

SNMPv2-MIB::snmpInPkts.0 = Counter32
1.3.6.1.2.1.11.1.0
SNMPv2-MIB::snmpOutPkts.0 = Counter32
1.3.6.1.2.1.11.2.0


SNMP called scripts



added in /etc/snmp/snmpd.conf :

exec 1.3.6.1.3.19811018.10 cpu /etc/snmp/cpu
exec 1.3.6.1.3.19811018.30 conntrack-count /etc/snmp/conntrack-count
exec 1.3.6.1.3.19811018.31 tcp-ctrk-states /etc/snmp/tcp-ctrk-states
exec 1.3.6.1.3.19811018.32 udp-ctrk-states /etc/snmp/udp-ctrk-states
exec 1.3.6.1.3.19811018.40 uptime /etc/snmp/uptime
exec 1.3.6.1.3.19811018.80 wl-assoc-count /etc/snmp/wl-assoc-count
exec 1.3.6.1.3.19811018.81 wl-txpwr /etc/snmp/wl-txpwr
exec 1.3.6.1.3.19811018.82 wl-rate /etc/snmp/wl-rate
exec 1.3.6.1.3.19811018.83 wl-noise /etc/snmp/wl-noise
exec 1.3.6.1.3.19811018.84 wl-scan /etc/snmp/wl-scan
exec 1.3.6.1.3.19811018.85 wl-neigh-ap /etc/snmp/wl-neigh-ap
exec 1.3.6.1.3.19811018.88 wl-tx-retries /etc/snmp/wl-tx-retries

#exec 1.3.6.1.3.19811018.84 wlscan /etc/snmp/wlscan [<SSID>]
#exec 1.3.6.1.3.19811018.91 wl-assoc-sta /etc/snmp/wl-assoc-sta <MAC>

dlmod iptables /usr/lib/iptables-snmp.so


CPU usage


cpu user
cpu nice
cpu system
cpu idle
cpu total
SNMPv2-SMI::experimental.19811018.10.101.1 = STRING
SNMPv2-SMI::experimental.19811018.10.101.2 = STRING
SNMPv2-SMI::experimental.19811018.10.101.3 = STRING
SNMPv2-SMI::experimental.19811018.10.101.4 = STRING
SNMPv2-SMI::experimental.19811018.10.101.5 = STRING
1.3.6.1.3.19811018.10.101.1
1.3.6.1.3.19811018.10.101.2
1.3.6.1.3.19811018.10.101.3
1.3.6.1.3.19811018.10.101.4
1.3.6.1.3.19811018.10.101.5

cat /etc/snmp/cpu
#!/bin/sh
USER=$(cat /proc/stat | grep cpu\ | cut -f3 -d\ )
NICE=$(cat /proc/stat | grep cpu\ | cut -f4 -d\ )
SYST=$(cat /proc/stat | grep cpu\ | cut -f5 -d\ )
IDLE=$(cat /proc/stat | grep cpu\ | cut -f6 -d\ )
echo $USER
echo $NICE
echo $SYST
echo $IDLE
echo $(echo $USER + $NICE + $SYST | bc)


Conntrack count


SNMPv2-SMI::experimental.19811018.30.100.1 = INTEGER
1.3.6.1.3.19811018.30.100.1

cat /etc/snmp/conntrack-count
#!/bin/sh
exit `cat /proc/net/ip_conntrack | wc -l`


TCP conntrack states


SNMPv2-SMI::experimental.19811018.31.100.1 = INTEGER
1.3.6.1.3.19811018.31.100.1

cat /etc/snmp/tcp-ctrk-states
#!/bin/sh
exit `cat /proc/net/ip_conntrack | grep tcp | wc -l`


UDP conntrack states


SNMPv2-SMI::experimental.19811018.32.100.1 = INTEGER
1.3.6.1.3.19811018.32.100.1

cat /etc/snmp/udp-ctrk-states
#!/bin/sh
exit `cat /proc/net/ip_conntrack | grep udp | wc -l`


Uptime


SNMPv2-SMI::experimental.19811018.40.101.1 = STRING
1.3.6.1.3.19811018.40.101.1

cat /etc/snmp/uptime
#!/bin/sh
echo `cut -d' ' -f1 /proc/uptime | cut -d'.' -f1`


Wireless associated stations count


SNMPv2-SMI::experimental.19811018.80.101.1 = STRING
1.3.6.1.3.19811018.80.101.1

cat /etc/snmp/wl-assoc-count
#!/bin/sh
wl assoclist | wc -l


Wireless Tx power


TxPower in qdbm
TxPower in dbm
TxPower in mW
SNMPv2-SMI::experimental.19811018.81.101.1 = STRING
SNMPv2-SMI::experimental.19811018.81.101.2 = STRING
SNMPv2-SMI::experimental.19811018.81.101.3 = STRING
1.3.6.1.3.19811018.81.101.1
1.3.6.1.3.19811018.81.101.2
1.3.6.1.3.19811018.81.101.3

cat /etc/snmp/wl-txpwr
#!/bin/sh
txpwr=$(wl txpwr1)
# TxPwr in qdbm
echo $txpwr | cut -f3 -d\
# TxPwr in dbm
echo $txpwr | cut -f5 -d\
# TxPwr in mW
echo $txpwr | cut -f7 -d\


Wireless bitrate


SNMPv2-SMI::experimental.19811018.82.100.1 = INTEGER
1.3.6.1.3.19811018.82.100.1

cat /etc/snmp/wl-rate
#!/bin/sh
exit `wl rate | cut -f1 -d\ `


Wireless noise


Noise in dBm
Noise in dBm + 100
SNMPv2-SMI::experimental.19811018.83.101.1 = STRING
SNMPv2-SMI::experimental.19811018.83.101.2 = STRING
1.3.6.1.3.19811018.83.101.1
1.3.6.1.3.19811018.83.101.2

cat /etc/snmp/wl-noise
#!/bin/sh
NOISE=$(wl noise)
echo $NOISE
echo $NOISE + 100 | bc


Wireless neighbour AP scan


SNMPv2-SMI::experimental.19811018.84.100.1 = INTEGER
1.3.6.1.3.19811018.84.100.1

cat /etc/snmp/wl-scan
#!/bin/sh

# if there are some associated stations, don't scan :
if [ $(wl assoclist | wc -l) -gt 0 ]
then
 exit
fi

# if an AP is specified, scan only it :
if [ $# -ne 0 ]
then
 wl scan -s $1
else
 wl scan
fi


Wireless neighbour AP signals


SNMPv2-SMI::experimental.19811018.85.101.1 = STRING
1.3.6.1.3.19811018.85.101.1

cat /etc/snmp/wl-neigh-ap
#!/bin/sh

# Returns for each neighbour AP found in wl scanresults :
# signal level + 100 in dBm
# noise level + 100 in dBm
# snr (or margin) in dBm
# channel
# The neighbour APs are sorted per signal level (highest first)

wl scanresults | sort | awk '/RSSI/ { printf "%i\n%i\n%i\n%i\n", $4+100, $7+100, $4-$7, $10 }'


Wireless interface Tx retries


SNMPv2-SMI::experimental.19811018.88.101.1 = STRING
1.3.6.1.3.19811018.88.101.1

cat /etc/snmp/wl-tx-retries
#!/bin/sh
iwconfig wl0 | grep "Tx excessive retries" | cut -f2 -d':' | cut -f1 -d' '


Wireless <MAC> associated station signal


Wireless associated station signal
Wireless associated station signal + 100
Wireless associated station noise
Wireless associated station noise + 100
Wireless associated station margin
SNMPv2-SMI::experimental.19811018.91.101.1 = STRING
SNMPv2-SMI::experimental.19811018.91.101.2 = STRING
SNMPv2-SMI::experimental.19811018.91.101.3 = STRING
SNMPv2-SMI::experimental.19811018.91.101.4 = STRING
SNMPv2-SMI::experimental.19811018.91.101.5 = STRING
1.3.6.1.3.19811018.91.101.1
1.3.6.1.3.19811018.91.101.2
1.3.6.1.3.19811018.91.101.3
1.3.6.1.3.19811018.91.101.4
1.3.6.1.3.19811018.91.101.5

cat /etc/snmp/wl-assoc-sta
#!/bin/sh
if [ $# -ne 0 ]
then
 RSSI=$(wl rssi $1)
 if [ -z $RSSI ]
 then
  printf "0\n0\n0\n0\n"
 else
  echo $RSSI
  echo $RSSI + 100 | bc
  NOISE=$(wl noise)
  echo $NOISE
  echo $NOISE + 100 | bc
  echo $RSSI - $NOISE | bc
 fi
else
 printf "0\n0\n0\n0\n0\n"
fi


Cacti templates


Cacti templates for OpenWrt