Fixed bug the Trap Generator failed at FreeBSD.

This commit is contained in:
Hirofumi Kosaka 2016-07-20 18:40:55 +09:00
parent a7cab9562d
commit 03126045d6
1 changed files with 6 additions and 6 deletions

View File

@ -29,21 +29,21 @@ function snmp_generate_trap($snmp_host_address, $snmp_community, $snmp_oid, $snm
if (empty($config['snmptrap'])) {
switch (PHP_OS) {
case "FreeBSD":
$snmpwalk_bin = '/usr/local/bin/snmptrap';
$snmptrap_bin = '/usr/local/bin/snmptrap';
break;
case "NetBSD":
$snmpwalk_bin = '/usr/pkg/bin/snmptrap';
$snmptrap_bin = '/usr/pkg/bin/snmptrap';
break;
default:
$snmpwalk_bin = 'snmptrap';
$snmptrap_bin = 'snmptrap';
break;
}
}
else {
$snmpwalk_bin = $config['snmptrap'];
$snmptrap_bin = $config['snmptrap'];
}
$command = "snmptrap -v 1 -c " . escapeshellarg($snmp_community) .
$command = "$snmptrap_bin -v 1 -c " . escapeshellarg($snmp_community) .
" " . escapeshellarg($snmp_host_address) .
" " . escapeshellarg($snmp_oid) .
" " . escapeshellarg($snmp_agent) .
@ -279,4 +279,4 @@ function snmp_update_translation($oid, $new_oid, $description, $post_process) {
}
}
}
?>
?>