SNMP ipAddrTable Windows、AIX和Linux的不同

Windows和 AIX返回5个项目:

 ipAdEntAddr    1.3.6.1.2.1.4.20.1.1
 ipAdEntIfIndex    1.3.6.1.2.1.4.20.1.2
 ipAdEntNetMask    1.3.6.1.2.1.4.20.1.3
 ipAdEntBcastAddr    1.3.6.1.2.1.4.20.1.4
 ipAdEntReasmMaxSize    1.3.6.1.2.1.4.20.1.5
--------------------- 
完整的实现了标准

C:\usr\bin>snmpwalk -v 2c -c public localhost .iso.org.dod.internet.mgmt.mib-2.ip.ipAddrTable.ipAddrEntry
IP-MIB::ipAdEntAddr.127.0.0.1 = IpAddress: 127.0.0.1
IP-MIB::ipAdEntAddr.192.168.0.3 = IpAddress: 192.168.0.3
IP-MIB::ipAdEntAddr.192.168.6.1 = IpAddress: 192.168.6.1
IP-MIB::ipAdEntAddr.192.168.111.1 = IpAddress: 192.168.111.1
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.192.168.0.3 = INTEGER: 8
IP-MIB::ipAdEntIfIndex.192.168.6.1 = INTEGER: 21
IP-MIB::ipAdEntIfIndex.192.168.111.1 = INTEGER: 11
IP-MIB::ipAdEntNetMask.127.0.0.1 = IpAddress: 255.0.0.0
IP-MIB::ipAdEntNetMask.192.168.0.3 = IpAddress: 255.255.255.0
IP-MIB::ipAdEntNetMask.192.168.6.1 = IpAddress: 255.255.255.0
IP-MIB::ipAdEntNetMask.192.168.111.1 = IpAddress: 255.255.255.0
IP-MIB::ipAdEntBcastAddr.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntBcastAddr.192.168.0.3 = INTEGER: 1
IP-MIB::ipAdEntBcastAddr.192.168.6.1 = INTEGER: 1
IP-MIB::ipAdEntBcastAddr.192.168.111.1 = INTEGER: 1
IP-MIB::ipAdEntReasmMaxSize.127.0.0.1 = INTEGER: 65535
IP-MIB::ipAdEntReasmMaxSize.192.168.0.3 = INTEGER: 65535
IP-MIB::ipAdEntReasmMaxSize.192.168.6.1 = INTEGER: 65535
IP-MIB::ipAdEntReasmMaxSize.192.168.111.1 = INTEGER: 65535

LINUX返回4个项目:

 ipAdEntAddr    1.3.6.1.2.1.4.20.1.1
 ipAdEntIfIndex    1.3.6.1.2.1.4.20.1.2
 ipAdEntNetMask    1.3.6.1.2.1.4.20.1.3
 ipAdEntBcastAddr    1.3.6.1.2.1.4.20.1.4
--------------------- 
标准中的ipAdEntReasmMaxSize没有实现

C:\usr\bin>snmpwalk -v 2c -c public 192.168.111.139 .iso.org.dod.internet.mgmt.mib-2.ip.ipAddrTable.ipAddrEntry
IP-MIB::ipAdEntAddr.127.0.0.1 = IpAddress: 127.0.0.1
IP-MIB::ipAdEntAddr.192.168.111.139 = IpAddress: 192.168.111.139
IP-MIB::ipAdEntAddr.192.168.122.1 = IpAddress: 192.168.122.1
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.192.168.111.139 = INTEGER: 2
IP-MIB::ipAdEntIfIndex.192.168.122.1 = INTEGER: 3
IP-MIB::ipAdEntNetMask.127.0.0.1 = IpAddress: 255.0.0.0
IP-MIB::ipAdEntNetMask.192.168.111.139 = IpAddress: 255.255.255.0
IP-MIB::ipAdEntNetMask.192.168.122.1 = IpAddress: 255.255.255.0
IP-MIB::ipAdEntBcastAddr.127.0.0.1 = INTEGER: 0
IP-MIB::ipAdEntBcastAddr.192.168.111.139 = INTEGER: 1
IP-MIB::ipAdEntBcastAddr.192.168.122.1 = INTEGER: 1

php区别对待代码:

if($this->operating_system == 'windows')
        {
            $ipAd = array_chunk($result,count($result)/5);
        }
        if($this->operating_system == 'linux')
        {
            $ipAd = array_chunk($result,count($result)/4);
        }
        if($this->operating_system == 'aix')
        {
            $ipAd = array_chunk($result,count($result)/5);
        }        //print_r($if);

猜你喜欢

转载自blog.csdn.net/allway2/article/details/92710991