2010-08-11 Sergio Martin <sergio.martin@artica.es>

* include/functions.php: Added a function to call snmpwalk
	functions setting the version, ip address, community...



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3126 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2010-08-11 11:22:43 +00:00
parent 25355fc6b5
commit cf5a40a1bc
2 changed files with 46 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2010-08-11 Sergio Martin <sergio.martin@artica.es>
* include/functions.php: Added a function to call snmpwalk
functions setting the version, ip address, community...
2010-08-11 Junichi Satoh <junichi@rworks.jp> 2010-08-11 Junichi Satoh <junichi@rworks.jp>
* include/help/ja/help_network_map.php, * include/help/ja/help_network_map.php,

View File

@ -1040,4 +1040,45 @@ function array_key_to_offset($array, $key) {
return $offset; return $offset;
} }
/**
* Make a snmpwalk and return it.
*
* @param string $ip_target The target address.
* @param string $snmp_version Version of the snmp: 1,2,2c or 3.
* @param string $snmp_community.
* @param string $snmp3_auth_user.
* @param string $snmp3_security_level.
* @param string $snmp3_auth_method.
* @param string $snmp3_auth_pass.
* @param string $snmp3_privacy_method.
* @param string $snmp3_privacy_pass.
* @param integer $quick_print 0 for all details, 1 for only value.
*
* @return array SNMP result.
*/
function snmpwalk_versions($ip_target, $snmp_version, $snmp_community = '', $snmp3_auth_user = '',
$snmp3_security_level = '', $snmp3_auth_method = '', $snmp3_auth_pass = '',
$snmp3_privacy_method = '', $snmp3_privacy_pass = '', $quick_print = 0) {
snmp_set_quick_print ($quick_print);
switch ($snmp_version) {
case '3':
$snmpwalk = @snmp3_real_walk ($ip_target, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, null);
break;
case '2':
case '2c':
$snmpwalk = @snmp2_real_walk ($ip_target, $snmp_community, NULL);
break;
case '1':
default:
$snmpwalk = @snmprealwalk($ip_target, $snmp_community, null);
break;
}
return $snmpwalk;
}
?> ?>