diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2003-06-12 20:20:55 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2003-06-12 20:20:55 +0000 |
| commit | f7cac54c235db36f17074bf78de5b30dd9415bcb (patch) | |
| tree | d5c62f9da849ab0cbf2e0e11e49e18dc20b3d21b /frontends/php/include | |
| parent | 2d4065252826a4fe62ead51342a1f72516dbd32d (diff) | |
| download | zabbix-f7cac54c235db36f17074bf78de5b30dd9415bcb.tar.gz zabbix-f7cac54c235db36f17074bf78de5b30dd9415bcb.tar.xz zabbix-f7cac54c235db36f17074bf78de5b30dd9415bcb.zip | |
- added support for units (Mb, Kb, Gb, etc) (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@819 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
| -rw-r--r-- | frontends/php/include/config.inc.php | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index 889f2f77..58c7c18f 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -21,6 +21,8 @@ { $u=""; + $value=$value*pow(1024,(int)$multiplier); + if($units=="") { if(round($value)==$value) @@ -1601,7 +1603,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,$snmp_port,$units) + function update_item($itemid,$description,$key,$hostid,$delay,$history,$status,$type,$snmp_community,$snmp_oid,$value_type,$trapper_hosts,$snmp_port,$units,$multiplier) { global $ERROR_MSG; @@ -1622,7 +1624,7 @@ 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',snmp_port=$snmp_port,units='$units' where itemid=$itemid"; + $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,units='$units',multiplier=$multiplier where itemid=$itemid"; return DBexecute($sql); } @@ -1986,7 +1988,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,$snmp_port,$units) + function add_item($description,$key,$hostid,$delay,$history,$status,$type,$snmp_community,$snmp_oid,$value_type,$trapper_hosts,$snmp_port,$units,$multiplier) { global $ERROR_MSG; @@ -2020,7 +2022,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; $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,snmp_port,units) values ('$description','$key',$hostid,$delay,$history,0,0,$status,$type,'$snmp_community','$snmp_oid',$value_type,'$trapper_hosts',$snmp_port,'$units')"; + $sql="insert into items (description,key_,hostid,delay,history,lastdelete,nextcheck,status,type,snmp_community,snmp_oid,value_type,trapper_hosts,snmp_port,units,multiplier) values ('$description','$key',$hostid,$delay,$history,0,0,$status,$type,'$snmp_community','$snmp_oid',$value_type,'$trapper_hosts',$snmp_port,'$units',$multiplier)"; $result=DBexecute($sql); return DBinsert_id($result,"items","itemid"); } @@ -2379,7 +2381,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; while($row=DBfetch($result)) { $item=get_item_by_itemid($row["itemid"]); - $itemid=add_item($item["description"],$item["key_"],$hostid,$item["delay"],$item["history"],$item["status"],$item["type"],$item["snmp_community"],$item["snmp_oid"],$item["value_type"],"",161); + $itemid=add_item($item["description"],$item["key_"],$hostid,$item["delay"],$item["history"],$item["status"],$item["type"],$item["snmp_community"],$item["snmp_oid"],$item["value_type"],"",161,$item["units"],$item["multiplier"]); $sql="select distinct t.triggerid from triggers t,functions f where f.itemid=".$row["itemid"]." and f.triggerid=t.triggerid"; $result2=DBselect($sql); @@ -3170,7 +3172,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; if(isset($HTTP_GET_VARS["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,i.snmp_port,i.units from items i,hosts h where i.itemid=".$HTTP_GET_VARS["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,i.units,i.multiplier from items i,hosts h where i.itemid=".$HTTP_GET_VARS["itemid"]." and h.hostid=i.hostid"); $description=DBget_field($result,0,0); $key=DBget_field($result,0,1); @@ -3186,6 +3188,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; $trapper_hosts=DBget_field($result,0,11); $snmp_port=DBget_field($result,0,12); $units=DBget_field($result,0,13); + $multiplier=DBget_field($result,0,14); } else { @@ -3203,6 +3206,7 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; $trapper_hosts=@iif(isset($HTTP_GET_VARS["trapper_hosts"]),$HTTP_GET_VARS["trapper_hosts"],""); $snmp_port=@iif(isset($HTTP_GET_VARS["snmp_port"]),$HTTP_GET_VARS["snmp_port"],161); $units=@iif(isset($HTTP_GET_VARS["units"]),$HTTP_GET_VARS["units"],''); + $multiplier=@iif(isset($HTTP_GET_VARS["multiplier"]),$HTTP_GET_VARS["multiplier"],0); } echo "<br>"; @@ -3298,6 +3302,24 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; show_table2_h_delimiter(); echo "<input class=\"biginput\" name=\"units\" value=\"$units\" size=10>"; + show_table2_v_delimiter(); + echo "Multiplier"; + show_table2_h_delimiter(); + echo "<SELECT class=\"biginput\" NAME=\"multiplier\" value=\"$multiplier\" size=\"1\">"; + echo "<OPTION VALUE=\"0\""; + if($multiplier==0) echo "SELECTED"; + echo ">-"; + echo "<OPTION VALUE=\"1\""; + if($multiplier==1) echo "SELECTED"; + echo ">K (1024)"; + echo "<OPTION VALUE=\"2\""; + if($multiplier==2) echo "SELECTED"; + echo ">M (1024^2)"; + echo "<OPTION VALUE=\"3\""; + if($multiplier==2) echo "SELECTED"; + echo ">G (1024^3)"; + echo "</SELECT>"; + if($type!=2) { show_table2_v_delimiter(); |
