l4rzzz / snmp
Interact with network connected devices using SNMP
This package's canonical repository appears to be gone and the package has been frozen as a result.
Requires
- php: >=5.4
This package is auto-updated.
Last update: 2023-03-01 00:33:21 UTC
README
PHP Component to interact with network connected devices via SNMP
Classes and associated MIBs
-
L4rzzz\Snmp\Snmp
This class has 3 public methods where you can pass OIDs to interact with devices. The other classes extend it and use preset methods for specific MIBs. -
L4rzzz\Snmp\Mgmt\Mib2
- BRIDGE-MIB
- ENTITY-MIB
- IF-MIB
- IP-MIB
- SNMPv2-SMI
-
L4rzzz\Snmp\Enterprise\Cisco\Cisco
ExtendsL4rzzz\Snmp\Mgmt\Mib2
to use MIBs from the MIB-2 tree.- CISCO-VTP-MIB
- CISCO-VLAN-MEMBERSHIP
-
L4rzzz\Snmp\Enterprise\Cisco\Ccm
ExtendsL4rzzz\Snmp\Mgmt\Mib2
to use MIBs from the MIB-2 tree.- CISCO-CCM-MIB
-
L4rzzz\Snmp\Enterprise\Infoblox\Infoblox
ExtendsL4rzzz\Snmp\Mgmt\Mib2
to use MIBs from the MIB-2 tree.- IB-DNSONE-MIB
- IB-DHCPONE-MIB
Usage
- Examples
SNMPv2c with custom OID
<?php use \L4rzzz\Snmp\Snmp; $auth = ['ro' => 'public']; $s = new Snmp('10.10.10.10', $auth, 'v2c'); print $s->walk('1.3.6.1.2.1.1.1');
SNMPv3 with MIB-2 methods
<?php use \L4rzzz\Snmp\Mgmt\Mib2; $auth = [ 'securityName' => 'foo', 'securityLevel' => 'AuthPriv', 'authProtocol' => 'md5', 'authKey' => 'bar', 'privProtocol' => 'des', 'privKey' => 'foobar', ]; $s = new Mib2('10.10.10.10', $auth, 'v3'); print $s->walkIfName();
SNMPv2c with Cisco methods
<?php use \L4rzzz\Snmp\Enterprise\Cisco\Cisco; $auth = ['ro' => 'public']; $s = new Cisco('10.10.10.10', $auth, 'v2c'); print $s->walkVtpVlanName(); //Cisco extends Mib2, Mib2 extends Snmp //So you can use these methods on Cisco objects too print $s->walk('1.3.6.1.2.1.1.1'); print $s->walkEntPhysicalDescr();