diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2003-01-23 21:26:33 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2003-01-23 21:26:33 +0000 |
| commit | 6d293ecc813b6ba31ec28ad4e78ab372c939fe30 (patch) | |
| tree | 5a9d4ed26b9a303f6d783faad8ea7e748e95a99f /frontends/php/include | |
| parent | 18994e2ba8fdd9f377660f8e3f0dc5965d4733dd (diff) | |
| download | zabbix-6d293ecc813b6ba31ec28ad4e78ab372c939fe30.tar.gz zabbix-6d293ecc813b6ba31ec28ad4e78ab372c939fe30.tar.xz zabbix-6d293ecc813b6ba31ec28ad4e78ab372c939fe30.zip | |
- user-defined port number for SNMP requests (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@662 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
| -rw-r--r-- | frontends/php/include/config.inc.php | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index 7ac35a44..3cd7b1ec 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -1450,7 +1450,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; # Update Item definition - function update_item($itemid,$description,$key,$hostid,$delay,$history,$status,$type,$snmp_community,$snmp_oid,$value_type,$trapper_hosts) + function update_item($itemid,$description,$key,$hostid,$delay,$history,$status,$type,$snmp_community,$snmp_oid,$value_type,$trapper_hosts,$snmp_port) { global $ERROR_MSG; @@ -1465,7 +1465,13 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; return 0; } - $sql="update items set description='$description',key_='$key',hostid=$hostid,delay=$delay,history=$history,lastdelete=0,nextcheck=0,status=$status,type=$type,snmp_community='$snmp_community',snmp_oid='$snmp_oid',value_type=$value_type,trapper_hosts='$trapper_hosts' where itemid=$itemid"; + if( ($snmp_port<1)||($snmp_port>65535)) + { + $ERROR_MSG="Invalid SNMP port"; + return 0; + } + + $sql="update items set description='$description',key_='$key',hostid=$hostid,delay=$delay,history=$history,lastdelete=0,nextcheck=0,status=$status,type=$type,snmp_community='$snmp_community',snmp_oid='$snmp_oid',value_type=$value_type,trapper_hosts='$trapper_hosts',snmp_port=$snmp_port where itemid=$itemid"; return DBexecute($sql); } @@ -1811,7 +1817,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; # Add Item definition - function add_item($description,$key,$hostid,$delay,$history,$status,$type,$snmp_community,$snmp_oid,$value_type,$trapper_hosts) + function add_item($description,$key,$hostid,$delay,$history,$status,$type,$snmp_community,$snmp_oid,$value_type,$trapper_hosts,$snmp_port) { global $ERROR_MSG; @@ -1827,10 +1833,17 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; return 0; } + if( ($snmp_port<1)||($snmp_port>65535)) + { + $ERROR_MSG="Invalid SNMP port"; + return 0; + } + + $key=addslashes($key); $description=addslashes($description); - $sql="insert into items (description,key_,hostid,delay,history,lastdelete,nextcheck,status,type,snmp_community,snmp_oid,value_type,trapper_hosts) values ('$description','$key',$hostid,$delay,$history,0,0,$status,$type,'$snmp_community','$snmp_oid',$value_type,'$trapper_hosts')"; + $sql="insert into items (description,key_,hostid,delay,history,lastdelete,nextcheck,status,type,snmp_community,snmp_oid,value_type,trapper_hosts,snmp_port) values ('$description','$key',$hostid,$delay,$history,0,0,$status,$type,'$snmp_community','$snmp_oid',$value_type,'$trapper_hosts',$snmp_port)"; $result=DBexecute($sql); return DBinsert_id($result,"items","itemid"); } @@ -2929,7 +2942,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; { if(isset($itemid)) { - $result=DBselect("select i.description, i.key_, h.host, h.port, i.delay, i.history, i.status, i.type, i.snmp_community,i.snmp_oid,i.value_type,i.trapper_hosts from items i,hosts h where i.itemid=$itemid and h.hostid=i.hostid"); + $result=DBselect("select i.description, i.key_, h.host, h.port, i.delay, i.history, i.status, i.type, i.snmp_community,i.snmp_oid,i.value_type,i.trapper_hosts,i.snmp_port from items i,hosts h where i.itemid=$itemid and h.hostid=i.hostid"); $description=DBget_field($result,0,0); $key=DBget_field($result,0,1); @@ -2943,6 +2956,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; $snmp_oid=DBget_field($result,0,9); $value_type=DBget_field($result,0,10); $trapper_hosts=DBget_field($result,0,11); + $snmp_port=DBget_field($result,0,12); } else { @@ -2958,6 +2972,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; $snmp_oid="interfaces.ifTable.ifEntry.ifInOctets.1"; $value_type=0; $trapper_hosts=""; + $snmp_port=161; } echo "<br>"; @@ -3044,6 +3059,11 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; echo "<input class=\"biginput\" name=\"snmp_oid\" value=\"$snmp_oid\" size=40>"; show_table2_v_delimiter(); + echo "SNMP port (for SNMP only)"; + show_table2_h_delimiter(); + echo "<input class=\"biginput\" name=\"snmp_port\" value=\"$snmp_port\" size=5>"; + + show_table2_v_delimiter(); echo "Key"; show_table2_h_delimiter(); echo "<input class=\"biginput\" name=\"key\" value=\"$key\" size=40>"; |
