0
所以我試圖在一個denkovi SNMP以太網控制器在php打開數字輸出。根據PHP手冊,這應該工作,但事實並非如此。因此,這裏是我的代碼,如果有人能幫助我:PHP snmpset錯誤
<?php
if($_GET["host"] && $_GET["port"] && $_GET["com"] && $_GET["oid"] && $_GET["status"])
{
$host = $_GET['host']; //localhost
$ip = gethostbyname($host);
$port = $_GET['port']; //10161
$community = $_GET['com']; //private
$relenr = $_GET['oid']; // 10
$status = $_GET['status']; // 1 (turn it on)
$adress = $ip.":".$port;
$OID = ".1.3.6.1.4.1.19865.1.2.1.{$relenr}.0";
if(snmpset($adress, $community, $OID, 'i', intval($status))== true)
{
echo "\n succes!";
}
else
{
echo "\n error!!";
}
}
?>
你能提供額外的錯誤細節,參見http://php.net/manual/en/class.snmp.php#snmp.props.exceptions-enabled當你在命令行執行等效的net-snmp snmpset時會發生什麼?還有snmpget? – k1eran 2014-11-25 11:58:56
with comman line: 'snmpset -v1 -c private localhost:10161.1.3.6.1.4.1.19865.1.2.1.10.0 i 1 SNMPv2-SMI :: enterprises.19865.1.2.1.10.0 = INTEGER:1' – WdarinS 2014-11-25 12:50:28