2013-05-20 Junichi Satoh <junichi@rworks.jp>

* include/functions_snmp_browser.php: Added default binary path for
	snmptranslate in *BSD. The path can also be defined specific one by
	using config['snmptranslate'].



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8159 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
jsatoh 2013-05-20 01:56:07 +00:00
parent d0efdfe718
commit 397d0a5a3b
2 changed files with 23 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2013-05-20 Junichi Satoh <junichi@rworks.jp>
* include/functions_snmp_browser.php: Added default binary path for
snmptranslate in *BSD. The path can also be defined specific one by
using config['snmptranslate'].
2013-05-20 Junichi Satoh <junichi@rworks.jp>
* ChangeLog: Updated the changelog, I forgot.

View File

@ -277,7 +277,23 @@ function snmp_browser_get_oid ($target_ip, $community, $target_oid) {
$oid_data['numeric_oid'] = $oid;
// Translate the OID
exec ("snmptranslate -Td " . escapeshellarg($oid), $translate_output);
if ($config['snmptranslate'] == '') {
switch (PHP_OS) {
case "FreeBSD":
$snmptranslate_bin = '/usr/local/bin/snmptranslate';
break;
case "NetBSD":
$snmptranslate_bin = '/usr/pkg/bin/snmptranslate';
break;
default:
$snmptranslate_bin = 'snmptranslate';
break;
}
}
else {
$snmptranslate_bin = $config['snmptranslate'];
}
exec ($snmptranslate_bin . " -Td " . escapeshellarg($oid), $translate_output);
foreach ($translate_output as $line) {
if (preg_match ('/SYNTAX\s+(.*)/', $line, $matches) == 1) {
$oid_data['syntax'] = $matches[1];