Re: snmp client (aka "walk")

2013-10-04 Thread Gabriel Guzman
On 10/01, Reyk Floeter wrote:
> Hi,
> 
> I just committed a simple SNMP client implementation to snmpctl/snmpd.
> You can use it as an in-tree alternative to net-snmp's
> snmpwalk/snmpget.
> 
> Examples:
> $ snmpctl walk 127.0.0.1
> $ snmpctl walk printer.my.domain version 1 oid printerWorkingGroup
> $ snmpctl -n walk 203.0.113.240 oid ifMIB community "blah"
> 
> Limitations:
> - no SNMPv3/USM support yet
> - no bulk support yet (bulkwalk)
> - not so many fancy options.
> 
> snmpd does not support loading of external MIB files, so you have to
> use net-snmp if you want to load additional MIBs for the symbolic name
> parsing.  snmpctl only shows symbolic names there are found in snmpd's
> mib.h.
> 
> Testing welcome, especially with non-snmpd(8) agents.

Seems to work fine... only thing I have that's snmp walkable and not
snmpd is an HP printer: 

gabe@desktop:~$ snmpctl walk printer.my.domain 
system.sysDescr.0="HP ETHERNET MULTI-ENVIRONMENT"
system.sysOID.0=iso.org.dod.internet.private.enterprises.hp.2.3.9.1
system.sysUpTime.0=4256
system.sysContact.0=" "
system.sysName.0="printer"
system.sysLocation.0=""
system.sysServices.0=72
system.sysORLastChange.0=0
system.sysORTable.sysOREntry.sysORID.1=iso.org.dod.internet.snmpV2.snmpModules.snmpMIB
system.sysORTable.sysOREntry.sysORID.2=iso.org.dod.internet.snmpV2.snmpModules.framework.3.1.1
system.sysORTable.sysOREntry.sysORID.3=iso.org.dod.internet.snmpV2.snmpModules.11.3.1.1
system.sysORTable.sysOREntry.sysORID.4=iso.org.dod.internet.snmpV2.snmpModules.usm.2.1.1
system.sysORTable.sysOREntry.sysORID.5=iso.org.dod.internet.snmpV2.snmpModules.16.2.1.1
system.sysORTable.sysOREntry.sysORDescr.1="The MIB Module from SNMPv2
entities"
system.sysORTable.sysOREntry.sysORDescr.2="SNMP Management Architecture
MIB"
system.sysORTable.sysOREntry.sysORDescr.3="Message Processing and
Dispatching MIB"
system.sysORTable.sysOREntry.sysORDescr.4="USM User MIB"
system.sysORTable.sysOREntry.sysORDescr.5="VACM MIB"
system.sysORTable.sysOREntry.sysORUpTime.1=0
system.sysORTable.sysOREntry.sysORUpTime.2=0
system.sysORTable.sysOREntry.sysORUpTime.3=0
system.sysORTable.sysOREntry.sysORUpTime.4=0
system.sysORTable.sysOREntry.sysORUpTime.5=0


Nice to have this in base!

gabe. 



Re: snmp client (aka "walk")

2013-10-01 Thread Stuart Henderson
On 2013/10/01 18:20, Reyk Floeter wrote:
> what oid did you specify?  snmpctl only displays "oid system" by
> default and does not continue, but you can specify the parent or even
> "oid 1.3" to display everything.

aha - that explains it then, thanks.



Re: snmp client (aka "walk")

2013-10-01 Thread Reyk Floeter
On Tue, Oct 01, 2013 at 04:08:48PM +0100, Stuart Henderson wrote:
> Most things are working fine for me.
> 

thanks for testing!

> v4 and v6 with opensnmpd OK (need two instances of the daemon
> to test this as it only opens one socket).
> 
> v4 with net-snmp OK (v6 is possibly a bit broken in the net-snmp
> port's snmpd at present).
> 
> v4 and v6 against Zyxel GS1910 (using link-local for v6) OK.
> 
> Only problem I've hit so far is against D-Link DGS-1224T where
> snmpctl only prints the system oids, whereas net-snmp snmpwalk goes
> on to walk IF-MIB, TCP-MIB, UDP-MIB.
> 

what oid did you specify?  snmpctl only displays "oid system" by
default and does not continue, but you can specify the parent or even
"oid 1.3" to display everything.

> system.sysDescr.0="DGS-1224T4.21.02"
> system.sysOID.0=iso.org.dod.internet.private.enterprises.171.10.76.5
> system.sysUpTime.0=337019590
> system.sysContact.0=""
> system.sysName.0="ott-dlink-gig24"
> system.sysLocation.0="the attic"
> system.sysServices.0=2
> 
> 
> SNMPv2-MIB::sysDescr.0 = STRING: DGS-1224T
> 4.21.02
> SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.171.10.76.5
> SNMPv2-MIB::sysUpTime.0 = Timeticks: (337032680) 39 days, 0:12:06.80
> SNMPv2-MIB::sysContact.0 = STRING: 
> SNMPv2-MIB::sysName.0 = STRING: ott-dlink-gig24
> SNMPv2-MIB::sysLocation.0 = STRING: the attic
> SNMPv2-MIB::sysServices.0 = INTEGER: 2
> IF-MIB::ifNumber.0 = INTEGER: 25
> IF-MIB::ifIndex.1 = INTEGER: 1
> IF-MIB::ifIndex.2 = INTEGER: 2
> IF-MIB::ifIndex.3 = INTEGER: 3
> IF-MIB::ifIndex.4 = INTEGER: 4
> ... 
> 
> 
> 15:57:48.845525 85.158.44.149.31774 > 10.15.3.2.161: [udp sum ok] 
> |30|30|02|01|04|0fC=XXX 
> |a1|1aGetNextRequest(26)|02|04|02|01|02|01|30|0c 
> |30|0a|06|06.1.3.6.1.2.1.1|05|00 (ttl 64, id 50398, len 78)
> 15:57:48.848682 10.15.3.2.161 > 85.158.44.149.31774: [udp sum ok] 
> |30|82|00|66|02|01|04|0fC=XXX 
> |a2|82|00|4eGetResponse(78)|02|04|02|01|02|01|30|82|00|3e 
> |30|3c|06|08.1.3.6.1.2.1.1.1.0=|04|30"DGS-1224T   
>  4.21.02" (DF) (ttl 254, id 65014, len 134)
> 15:57:48.848956 85.158.44.149.31774 > 10.15.3.2.161: [udp sum ok] 
> |30|32|02|01|04|0fC=XXX 
> |a1|1cGetNextRequest(28)|02|04|02|01|02|01|30|0e 
> |30|0c|06|08.1.3.6.1.2.1.1.1.0|05|00 (ttl 64, id 49660, len 80)
> 15:57:48.851836 10.15.3.2.161 > 85.158.44.149.31774: [udp sum ok] 
> |30|82|00|40|02|01|04|0fC=XXX 
> |a2|82|00|28GetResponse(40)|02|04|02|01|02|01|30|82|00|18 
> |30|16|06|08.1.3.6.1.2.1.1.2.0=|06|0a.1.3.6.1.4.1.171.10.76.5 (DF) (ttl 254, 
> id 65015, len 96)
> 15:57:48.851979 85.158.44.149.31774 > 10.15.3.2.161: [udp sum ok] 
> |30|32|02|01|04|0fC=XXX 
> |a1|1cGetNextRequest(28)|02|04|02|01|02|01|30|0e 
> |30|0c|06|08.1.3.6.1.2.1.1.2.0|05|00 (ttl 64, id 61889, len 80)
> 15:57:48.854907 10.15.3.2.161 > 85.158.44.149.31774: [udp sum ok] 
> |30|82|00|3a|02|01|04|0fC=XXX 
> |a2|82|00|22GetResponse(34)|02|04|02|01|02|01|30|82|00|12 
> |30|10|06|08.1.3.6.1.2.1.1.3.0=|43|04336972620 (DF) (ttl 254, id 65016, len 
> 90)
> 15:57:48.855016 85.158.44.149.31774 > 10.15.3.2.161: [udp sum ok] 
> |30|32|02|01|04|0fC=XXX 
> |a1|1cGetNextRequest(28)|02|04|02|01|02|01|30|0e 
> |30|0c|06|08.1.3.6.1.2.1.1.3.0|05|00 (ttl 64, id 30100, len 80)
> 15:57:48.857873 10.15.3.2.161 > 85.158.44.149.31774: [udp sum ok] 
> |30|82|00|36|02|01|04|0fC=XXX 
> |a2|82|00|1eGetResponse(30)|02|04|02|01|02|01|30|82|00|0e 
> |30|0c|06|08.1.3.6.1.2.1.1.4.0=|04|00"" (DF) (ttl 254, id 65017, len 86)
> 15:57:48.857983 85.158.44.149.31774 > 10.15.3.2.161: [udp sum ok] 
> |30|32|02|01|04|0fC=XXX 
> |a1|1cGetNextRequest(28)|02|04|02|01|02|01|30|0e 
> |30|0c|06|08.1.3.6.1.2.1.1.4.0|05|00 (ttl 64, id 5047, len 80)
> 15:57:48.860909 10.15.3.2.161 > 85.158.44.149.31774: [udp sum ok] 
> |30|82|00|45|02|01|04|0fC=XXX 
> |a2|82|00|2dGetResponse(45)|02|04|02|01|02|01|30|82|00|1d 
> |30|1b|06|08.1.3.6.1.2.1.1.5.0=|04|0f"ott-dlink-gig24" (DF) (ttl 254, id 
> 65018, len 101)
> 15:57:48.861018 85.158.44.149.31774 > 10.15.3.2.161: [udp sum ok] 
> |30|32|02|01|04|0fC=XXX 
> |a1|1cGetNextRequest(28)|02|04|02|01|02|01|30|0e 
> |30|0c|06|08.1.3.6.1.2.1.1.5.0|05|00 (ttl 64, id 25590, len 80)
> 15:57:48.863971 10.15.3.2.161 > 85.158.44.149.31774: [udp sum ok] 
> |30|82|00|3f|02|01|04|0fC=XXX 
> |a2|82|00|27GetResponse(39)|02|04|02|01|02|01|30|82|00|17 
> |30|15|06|08.1.3.6.1.2.1.1.6.0=|04|09"the attic" (DF) (ttl 254, id 65019, len 
> 95)
> 15:57:48.864032 85.158.44.149.31774 > 10.15.3.2.161: [udp sum ok] 
> |30|32|02|01|04|0fC=XXX 
> |a1|1cGetNextRequest(28)|02|04|02|01|02|01|30|0e 
> |30|0c|06|08.1.3.6.1.2.1.1.6.0|05|00 (ttl 64, id 19230, len 80)
> 15:57:48.866926 10.15.3.2.161 > 85.158.44.149.31774: [udp sum ok] 
> |30|82|00|37|02|01|04|0fC=XXX 
> |a2|82|00|1fGetResponse(31)|02|04|02|01|02|01|30

Re: snmp client (aka "walk")

2013-10-01 Thread Stuart Henderson
On 2013/10/01 16:17, Reyk Floeter wrote:
> Hi,
> 
> I just committed a simple SNMP client implementation to snmpctl/snmpd.
> You can use it as an in-tree alternative to net-snmp's
> snmpwalk/snmpget.
> 
> Examples:
> $ snmpctl walk 127.0.0.1
> $ snmpctl walk printer.my.domain version 1 oid printerWorkingGroup
> $ snmpctl -n walk 203.0.113.240 oid ifMIB community "blah"
> 
> Limitations:
> - no SNMPv3/USM support yet
> - no bulk support yet (bulkwalk)
> - not so many fancy options.
> 
> snmpd does not support loading of external MIB files, so you have to
> use net-snmp if you want to load additional MIBs for the symbolic name
> parsing.  snmpctl only shows symbolic names there are found in snmpd's
> mib.h.
> 
> Testing welcome, especially with non-snmpd(8) agents.
> 
> Reyk
> 

Most things are working fine for me.

v4 and v6 with opensnmpd OK (need two instances of the daemon
to test this as it only opens one socket).

v4 with net-snmp OK (v6 is possibly a bit broken in the net-snmp
port's snmpd at present).

v4 and v6 against Zyxel GS1910 (using link-local for v6) OK.

Only problem I've hit so far is against D-Link DGS-1224T where
snmpctl only prints the system oids, whereas net-snmp snmpwalk goes
on to walk IF-MIB, TCP-MIB, UDP-MIB.

system.sysDescr.0="DGS-1224T4.21.02"
system.sysOID.0=iso.org.dod.internet.private.enterprises.171.10.76.5
system.sysUpTime.0=337019590
system.sysContact.0=""
system.sysName.0="ott-dlink-gig24"
system.sysLocation.0="the attic"
system.sysServices.0=2


SNMPv2-MIB::sysDescr.0 = STRING: DGS-1224T
4.21.02
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.171.10.76.5
SNMPv2-MIB::sysUpTime.0 = Timeticks: (337032680) 39 days, 0:12:06.80
SNMPv2-MIB::sysContact.0 = STRING: 
SNMPv2-MIB::sysName.0 = STRING: ott-dlink-gig24
SNMPv2-MIB::sysLocation.0 = STRING: the attic
SNMPv2-MIB::sysServices.0 = INTEGER: 2
IF-MIB::ifNumber.0 = INTEGER: 25
IF-MIB::ifIndex.1 = INTEGER: 1
IF-MIB::ifIndex.2 = INTEGER: 2
IF-MIB::ifIndex.3 = INTEGER: 3
IF-MIB::ifIndex.4 = INTEGER: 4
... 


15:57:48.845525 85.158.44.149.31774 > 10.15.3.2.161: [udp sum ok] 
|30|30|02|01|04|0fC=XXX 
|a1|1aGetNextRequest(26)|02|04|02|01|02|01|30|0c 
|30|0a|06|06.1.3.6.1.2.1.1|05|00 (ttl 64, id 50398, len 78)
15:57:48.848682 10.15.3.2.161 > 85.158.44.149.31774: [udp sum ok] 
|30|82|00|66|02|01|04|0fC=XXX 
|a2|82|00|4eGetResponse(78)|02|04|02|01|02|01|30|82|00|3e 
|30|3c|06|08.1.3.6.1.2.1.1.1.0=|04|30"DGS-1224T
4.21.02" (DF) (ttl 254, id 65014, len 134)
15:57:48.848956 85.158.44.149.31774 > 10.15.3.2.161: [udp sum ok] 
|30|32|02|01|04|0fC=XXX 
|a1|1cGetNextRequest(28)|02|04|02|01|02|01|30|0e 
|30|0c|06|08.1.3.6.1.2.1.1.1.0|05|00 (ttl 64, id 49660, len 80)
15:57:48.851836 10.15.3.2.161 > 85.158.44.149.31774: [udp sum ok] 
|30|82|00|40|02|01|04|0fC=XXX 
|a2|82|00|28GetResponse(40)|02|04|02|01|02|01|30|82|00|18 
|30|16|06|08.1.3.6.1.2.1.1.2.0=|06|0a.1.3.6.1.4.1.171.10.76.5 (DF) (ttl 254, id 
65015, len 96)
15:57:48.851979 85.158.44.149.31774 > 10.15.3.2.161: [udp sum ok] 
|30|32|02|01|04|0fC=XXX 
|a1|1cGetNextRequest(28)|02|04|02|01|02|01|30|0e 
|30|0c|06|08.1.3.6.1.2.1.1.2.0|05|00 (ttl 64, id 61889, len 80)
15:57:48.854907 10.15.3.2.161 > 85.158.44.149.31774: [udp sum ok] 
|30|82|00|3a|02|01|04|0fC=XXX 
|a2|82|00|22GetResponse(34)|02|04|02|01|02|01|30|82|00|12 
|30|10|06|08.1.3.6.1.2.1.1.3.0=|43|04336972620 (DF) (ttl 254, id 65016, len 90)
15:57:48.855016 85.158.44.149.31774 > 10.15.3.2.161: [udp sum ok] 
|30|32|02|01|04|0fC=XXX 
|a1|1cGetNextRequest(28)|02|04|02|01|02|01|30|0e 
|30|0c|06|08.1.3.6.1.2.1.1.3.0|05|00 (ttl 64, id 30100, len 80)
15:57:48.857873 10.15.3.2.161 > 85.158.44.149.31774: [udp sum ok] 
|30|82|00|36|02|01|04|0fC=XXX 
|a2|82|00|1eGetResponse(30)|02|04|02|01|02|01|30|82|00|0e 
|30|0c|06|08.1.3.6.1.2.1.1.4.0=|04|00"" (DF) (ttl 254, id 65017, len 86)
15:57:48.857983 85.158.44.149.31774 > 10.15.3.2.161: [udp sum ok] 
|30|32|02|01|04|0fC=XXX 
|a1|1cGetNextRequest(28)|02|04|02|01|02|01|30|0e 
|30|0c|06|08.1.3.6.1.2.1.1.4.0|05|00 (ttl 64, id 5047, len 80)
15:57:48.860909 10.15.3.2.161 > 85.158.44.149.31774: [udp sum ok] 
|30|82|00|45|02|01|04|0fC=XXX 
|a2|82|00|2dGetResponse(45)|02|04|02|01|02|01|30|82|00|1d 
|30|1b|06|08.1.3.6.1.2.1.1.5.0=|04|0f"ott-dlink-gig24" (DF) (ttl 254, id 65018, 
len 101)
15:57:48.861018 85.158.44.149.31774 > 10.15.3.2.161: [udp sum ok] 
|30|32|02|01|04|0fC=XXX 
|a1|1cGetNextRequest(28)|02|04|02|01|02|01|30|0e 
|30|0c|06|08.1.3.6.1.2.1.1.5.0|05|00 (ttl 64, id 25590, len 80)
15:57:48.863971 10.15.3.2.161 > 85.158.44.149.31774: [udp sum ok] 
|30|82|00|3f|02|01|04|0fC=XXX 
|a2|82|00|27GetResponse(39)|02|04|02|01|02|01|30|82|00|17 
|30|15|06|08.1.3.6.1.2.1.1.6.0=|04|09"the attic" (DF) (ttl 254, id 65019, len 
95)
15:57:48.864032 85.158.44.149.31774 > 10.15.3

snmp client (aka "walk")

2013-10-01 Thread Reyk Floeter
Hi,

I just committed a simple SNMP client implementation to snmpctl/snmpd.
You can use it as an in-tree alternative to net-snmp's
snmpwalk/snmpget.

Examples:
$ snmpctl walk 127.0.0.1
$ snmpctl walk printer.my.domain version 1 oid printerWorkingGroup
$ snmpctl -n walk 203.0.113.240 oid ifMIB community "blah"

Limitations:
- no SNMPv3/USM support yet
- no bulk support yet (bulkwalk)
- not so many fancy options.

snmpd does not support loading of external MIB files, so you have to
use net-snmp if you want to load additional MIBs for the symbolic name
parsing.  snmpctl only shows symbolic names there are found in snmpd's
mib.h.

Testing welcome, especially with non-snmpd(8) agents.

Reyk