A PHP SNMP Library for People Who Hate SNMP, MIBs and OIDs!

Today we are pleased to announce that we have open sourced and published a new PHP SNMP library on GitHub (https://github.com/opensolutions/OSS_SNMP).

A lot of us hate SNMP. But we have to use it on a daily basis. Now, don’t get me wrong, it’s an essential tool in the trade of network engineering but it’s also a serious PITA. Finding MIBs, OIBs, making them work, translating them, cross-vendor translations, etc, blah, blah. And then, when you do find what you need, you’ll have forgotten it months later when you need it again.

Anyway, while trying to create some automatic L2 topology graphing tools (via Cisco/Foundry Discovery Protocol for example) and also some per VLAN RSTP tools to show port states, we started writing this library. As we wrote, we realised it was actually very useful and present it here now in the hopes that the wider network engineering community will find it useful and also contribute back MIBs.

An example may best illustrate the library: First, we need to instantiate an SNMP object with a hostname / IP address and a community string:

$ciscosw = new \OSS\SNMP( $ip, $community ); 

Assuming the above is a standard Cisco switch, let’s say we want to get an associate array of VLAN names indexed by the VLAN ids:

print_r( $ciscosw->useCisco_VTP()->vlanNames() ); 

This yields something like the following:

Array (
    [1] => default
    [2] => mgmt
    [100] => cust-widgets
    [1002] => fddi-default
    ...
)

It really is that easy.

This entry was posted in How-tos, Open Source, OSS_SNMP, PHP, PR and tagged , , , . Bookmark the permalink.

Comments are closed.