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