× NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Orbi WiFi 7 RBE973
Reply

Re: M4200 get status information via python

Jan_de_Vries
Follower

M4200 get status information via python

Hi All,

 

I know there are many ways to retrieve status information from the (M4200) switch. These work fine, but are very "manual". What I really like to achieve is to get some basic status information programattically. Preferably with python so I can use a raspberry Pi.

 

The goal is to display this information on a external lcd display.

 

The information I like to have for example is:

  • Which port is Up/Down (has a cable plugged in)
  • Firmware version
  • Fiber strength (dB)

Serial port

I have tried multiple ways, but I doesnt feel gooed. I tried via RS 232, convert it so Pi is able to read the data. Issue with this is that its bassicaly telnet commands and the response is a lot of text in a certain format. This text is kinda hard to transform in a way that it is easy to read (read by python).

 

SNMP

Another way I tried is using SNMP. It kinda worked okay. Main issue here is finding the correct OIB's. I was not able to find a list. So by doing SNMP walk plugging in cables and remove them again gave me some information what changed and I am now able to see if a port is connected or not. But the correct OID to fetch firmware version, light strength I have not found yet. (Does anhone know where to find a list of OID's for this netgear and how to read them?)

 

SSH

Last method I tried so far is using ssh. This whould be a great option. Unfortunally the ssh libraries I found sofar dont make it really easy getting a proper response. There is a library netmiko for python, which sounds awesome, but unfortunally, from the many switch vendors they support, netgear isnt one of them.

 

Ideas

Does anyone have any good tips, approaches, ideas on how to get basic information from the M4200 switch via python? Or maybe an "easy" and more importantly reliable method to fetch teh data every X seconds? Any help is very appreciated.

 

The goal is to display this information on a external lcd display.

Model: GSM4210P|M4200-10MG-PoE+ - Multigigabit Managed Switch with 8x2.5G and 2x10G SFP+ Layer 2+
Message 1 of 2
msi
Luminary
Luminary

Re: M4200 get status information via python

Serial console won't scale and is likely even less reliably than parsing the CLI using i.e. as you mentioned netmiko.

 

I can only imagine SNMP being the best route to success. Yes OID searching is not a lot of fun. Best is to get the MIBs matching the firmware you are currently running on the M4200, then do a SNMP walk with net-snmp while loading all MIBs from Netgear as well. Depending on your environment this is sometimes different. Debian for example doesn't ship public MIBs due to licensing concerns but are easily downloaded.

 

Most relevant parts should be found in the private OID, usually there are MIBs with box-something in them like boxservices.my in many managed switches. This one for example usually reveals the OIDs for things like fans and power supplies for example. It is going to be helpful to learn how to convert from an MIB to an OID using i.e. Net-SNMP (you can google that command)

 

Message 2 of 2
Top Contributors
Discussion stats
  • 1 reply
  • 916 views
  • 1 kudo
  • 2 in conversation
Announcements