Mixing pysnmp and stdin

Depending on the application, sometimes you want to have some socket operations going (such as loading a website) and have stdin being read. There are plenty of examples for this in python which usually boil down to making stdin behave like a socket and mixing it into the list of sockets select() cares about.

A while ago I asked an email list could I have pysnmp use a different socket map so I could add my own sockets in (UDP, TCP and a zmq to name a few) and the Ilya the author of pysnmp explained how pysnmp can use a foreign socket map.
Read more Mixing pysnmp and stdin

JFFNMS 0.9.3 1st release candidate

I have been putting a lot of testing into JFFNMS lately.  I have been very lucky to have had someone with the time and patience to try out various sub versions and give me access to their results.

The end-result of all this testing is a much, much less buggy JFFNMS.  There have been a strack of problems with caching results, for example, where status would not be updated or even worse the status of one device impacted on another.

The poller parent scheduler had a problem too where it would almost always sit in the first child starving the others of work which slowed things down. The scheduler now is a lot fairer across the children giving a speed up. I’ve heard speed-ups of 15x for this one change alone.

I also had a curious bug where if a device was set to not gather state it still did and created events but not alerts.  This meant your event table was spammed with down interface alerts even on interface you know are down and you turned state checking off.  0.9.3 now does it the right way.

The first RC is now uploaded and can be found at https://sourceforge.net/projects/jffnms/files/jffnms%20RC/ to try out.

I’m a little worried that the pollers now run too fast and could overwhelm the usually crummy control stack found in network devices for parsing SNMP.  I’m interested to hear how people find it.

Enhanced by Zemanta

SNMP Information from your DLink DSL-300 ADSL Modem

Not many people know it, but the DLink DSL-300 ADSL modem has SNMP management capabilities. And for such a small and cheap network device, its not too bad an implementation of it. Or perhaps I’ve just seen a lot of dead-awful ones to compare objectively. Of course the displaying of the private community in the MIB, which is something the DSL-300 does, is a pretty dumb idea.

I should point out right here that these instructions work for me. They might work for you, or you might just find some easter egg in the modems firmware that turns it into a smoke machine So do any of this stuff at your own risk.

You will have to connect to the modem using a serial port first to find out the IP address and change either your computers or the modems IP address so they are in the same network. Note that this address is not the same as the one your provider gives. And the communities are the very hard to guess public and private for read-only and read-write respectively.

The modem has some of the standard SNMP MIBs that anyone who’s played with SNMP will quickly recognise, such as.

* system information
* interface information including the ifTable
* IP MIB – Packets in out, discards etc
* ip routes
* SNMP MIB, which is statistics about the agent itself
* SNMPv2-SMI::mib-2.17.4

All pretty standard stuff you see in pretty much any device. All the good information is always found in the private enterprises part of the MIB, and the DSL-300 is no exception. The problem is that if you ask
DLink about it, they will tell you nothing. The nice thing about DLink is they’re pretty consistent about annoying the hell out of their customers by denying them technical information.

With that rant out of the way, its time to work out for myself what these values are for. I’ve got some worked out but it will take some more time to get it all clear and possibly some will never be worked out, thanks DLink!

All OIDs start with private.enterprises.171.11 There are quite a few gaps so if you know what the missing values mean, drop me a line.

OID Type Description STRING Software version eg “R1.14AU” STRING PROM firmware version “Ver. 1.00” STRING Hardware version “Rev. 1.00” INTEGER Management Protocols supported: 2=snmp-ip Table Table showing what MIBs are supported INTEGER  – Index of Table STRING  – Name of MIB supported eg “DSL504-MIB”, “RFC1213-MIB” INTEGER  – Version of MIB supported INTEGER  – Type of MIB INTEGER Bridge/Router: 1=PPPoA-Router, 2=PPPoA-Bridge, 3=RFC1483-Router, 4=RFC1483-Bridge INTEGER Config Save 1 INTEGER System Restart 1 INTEGER ?? 1 INTEGER ADSL Driver Mode: 0=link down, 1=T1-413, 2=G-lite, 3=G-DMT INTEGER Upstream rate in kbps INTEGER Downstream rate in kbps STRING Device driver version INTEGER ADSL Link Status: 0=Idle, 1=Connecting, 2=Connected INTEGER Driver Path: 0=Fast, 1=Interleave INTEGER Near End FEC line error count INTEGER Far End FEC line error count INTEGER Near End CRC line error count INTEGER Far End CRC line error count INTEGER Near End HEC line error count INTEGER Far End HEC line error count INTEGER Near End LOS (Loss Of Signal) count INTEGER Far End LOS (Loss Of Signal) count INTEGER Near End LOF (Loss Of Frame) count INTEGER Far End LOF (Loss Of Frame) count INTEGER Near End line error count INTEGER Far End line error count INTEGER Near End Alarm Indication Signal: 0=no alarm, 1=alarm INTEGER Far End Alarm Indication Signal: 0=no alarm, 1=alarm INTEGER Near End Remote Defect Identification: 0=no defect, 1=defect INTEGER Far End Remote Defect Identification: 0=no defect, 1=defect INTEGER Upstream Capacity (in percent) INTEGER Downstream Capacity (in percent) INTEGER Upstream line attenuation INTEGER Downstream line attenuation INTEGER Upstream Noise Margin INTEGER Downstream Noise Margin INTEGER Upstream Output Power INTEGER Downstream Output Power INTEGER Link retrain count Array Carrier Load Array INTEGER Unable to initialize count INTEGER A 96 row table, index column. The value equals the instance. INTEGER Near End Error Second INTEGER Far End Error Second INTEGER Near End Error Second count for the day INTEGER Far End Error Second count for the day INTEGER Error Second for the day table – instance. Value = instance INTEGER Near End Error Second count for the day INTEGER Far End Error Second count for the day INTEGER Spanning Tree State: 0=other, 1=disabled, 2=enabled INTEGER VPI of bridged PVC INTEGER VCI of bridged PVC INTEGER Index of table IpAddress IP address of modem IpAddress Network mask of modem INTEGER Send RIP 1=RIPv1 2=RIPv2 3=Both RIP 4=None INTEGER Accept RIP 1=RIPv1 2=RIPv2 3=Both RIP 4=None INTEGER IP Forwarding: 2=None 3=All INTEGER DHCP Client: 1=other, 2=disabled, 3=enabled INTEGER NAT State: 1=other, 2=disabled, 3=enabled INTEGER Static Route Count 0
Hex-STRING SNMP read-only community, 28 bytes long with 0 padding. eg fred = 66 72 65 64 00…
Hex-S SNMP read/write community, same encoding as Read-only
INTEGER ?? 2 IpAddress IP address of TFTP server String Remote filename on TFTP server String Local filename INTEGER Set to 1 to make modem connect to server INTEGER Set to 1 to get remote file INTEGER TFTP status: 0=idle, 1=Wait ACK, 2=Wait Data, 3=Sent Write Request, 4=Sent Read Request, 5=Done

Some definitions you might find useful:

* Error Second (ES) – Any second where at least one bit error was received.