Снятие ipfw счетчиков по snmp
Простой пример для снятия по snmp счетчиков с ipfw (snmpd демон от net-snmp):
В /usr/local/etc/snmp/snmpd.conf добавляем строчку вида
pass_persist .1.3.6.1.4.200 /usr/local/etc/snmp/getfw
Файл /usr/local/etc/snmp/getfw :
#!/usr/bin/awk -f
/PING/ {
print "PONG"
fflush
next
}
/get/ {
getline
oid = $0
split(oid, s, "\.")
rule = s[8] + 0
cmd = "ipfw show " rule
if( ( cmd | getline) > 0 ){
print oid
print "Counter64"
print $3 % 4294967296
close( cmd );
fflush
next
}
print "NONE"
close( cmd );
fflush
next
}
/getnext/ {
getline
print "NONE"
fflush
next
}
{print "NONE" }
Соответственно опрашивать по OID .1.3.6.1.4.200.rulenum