Fixed bug the Trap Generator failed at FreeBSD.

This commit is contained in:
Hirofumi Kosaka 2016-07-20 18:52:32 +09:00
parent 85ad9eb2ac
commit 8e96378695
1 changed files with 5 additions and 5 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) . " " . escapeshellarg($snmp_host_address) . " " . escapeshellarg($snmp_oid) . " "
$command = "$snmptrap_bin -v 1 -c " . escapeshellarg($snmp_community) . " " . escapeshellarg($snmp_host_address) . " " . escapeshellarg($snmp_oid) . " "
. escapeshellarg($snmp_agent) . " " . escapeshellarg($snmp_type) . " " . escapeshellarg($snmp_data) . " 0 2>&1";
$output = null;