使用此函数调试 SNMP 连接。
<?php
error_reporting(8191);
date_default_timezone_set('Europe/Moscow');
ini_set('display_errors',1);
snmp_test_connection('12.34.56.78', 'guest', 'guest')
function snmp_test_connection($ip, $user, $pass){
$a = array('noAuthNoPriv','authNoPriv','authPriv');
$b = array('MD5','SHA');
$c = array('DES','AES');
$branch = '.1.3.6.1.2.1.1.3'; foreach($a as $aPriv)
foreach($b as $bProt)
foreach($c as $cPrivProt){
echo 'time = '.date('Y-m-d H:i:s').'<br/>';
echo '<b>sec_level=</b>'.$aPriv.'<br/><b>auth_protocol=</b>'.$bProt.'<br/><b>priv_protocol=</b>'.$cPrivProt.'<br/>Request = ';
var_dump(
snmp3_real_walk($ip, $user, $aPriv, $bProt, $pass, $cPrivProt, $pass, $branch)
);
}
}
?>