diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-04-24 07:37:57 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-04-24 07:37:57 +0000 |
| commit | 8dad0bcff42c44923a5d8c3ae2c82d06a29cc79e (patch) | |
| tree | a8b396eec00825b043b2cd2650bc0f25a6a38eb1 /frontends/php/include/items.inc.php | |
| parent | d5979168e9373a6e0bf9914f1f3b28b03d209dc5 (diff) | |
| download | zabbix-8dad0bcff42c44923a5d8c3ae2c82d06a29cc79e.tar.gz zabbix-8dad0bcff42c44923a5d8c3ae2c82d06a29cc79e.tar.xz zabbix-8dad0bcff42c44923a5d8c3ae2c82d06a29cc79e.zip | |
Minor changes.
git-svn-id: svn://svn.zabbix.com/trunk@2771 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/items.inc.php')
| -rw-r--r-- | frontends/php/include/items.inc.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php index 45213f30..29fbf33f 100644 --- a/frontends/php/include/items.inc.php +++ b/frontends/php/include/items.inc.php @@ -104,6 +104,43 @@ $delta=0; } + if( ($type == ITEM_TYPE_AGGREGATE) && ($value_type != ITEM_VALUE_TYPE_FLOAT)) + { + error("Value type must be Float for aggregate items"); + return FALSE; + } + if($type == ITEM_TYPE_AGGREGATE) + { + /* grpfunc('group','key','itemfunc','numeric param') */ + if(eregi('^((.)*)(\(\'((.)*)\'\,\'((.)*)\'\,\'((.)*)\'\,\'([0-9]+)\'\))$', $key, $arr)) + { + $g=$arr[1]; + if(!in_array($g,array("grpmax","grpmin","grpsum","grpavg"))) + { + error("Group function [$g] is not one of [grpmax,grpmin,grpsum,grpavg]"); + return FALSE; + } + // Group + $g=$arr[4]; + // Key + $g=$arr[6]; + // Item function + $g=$arr[8]; + if(!in_array($g,array("last", "min", "max", "avg", "sum","count"))) + { + error("Item function [$g] is not one of [last, min, max, avg, sum,count]"); + return FALSE; + } + // Parameter + $g=$arr[10]; + } + else + { + error("Key does not match grpfunc('group','key','itemfunc','numeric param')"); + return FALSE; + } + } + $db_items = DBexecute("select itemid,hostid from items". " where hostid=$hostid and key_=".zbx_dbstr($key)); if(DBnum_rows($db_items) > 0 && $templateid == 0) |
