diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-02-21 15:50:17 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-02-21 15:50:17 +0000 |
| commit | bc3960286b5f858cedb188dfb9ac64e655fc1205 (patch) | |
| tree | 31654a9aeaac87ae310511a23b5735e2215dbb9c /frontends/php/include | |
| parent | e777462175794243937ce3078209224619dfa320 (diff) | |
| download | zabbix-bc3960286b5f858cedb188dfb9ac64e655fc1205.tar.gz zabbix-bc3960286b5f858cedb188dfb9ac64e655fc1205.tar.xz zabbix-bc3960286b5f858cedb188dfb9ac64e655fc1205.zip | |
- support of max(#N) for sum,min,max,delta and avg (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2667 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
| -rw-r--r-- | frontends/php/include/config.inc.php | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index f379e63f..94d8c77f 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -768,6 +768,17 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } # DEBUG INFO!!! } } +// Check if str has format #<float> or <float> + function validate_ticks($str) + { +// echo "Validating float:$str<br>"; + if (eregi('^[ ]*#([0-9]+)((\.)?)([0-9]*)[ ]*$', $str, $arr)) + { + return 0; + } + else return validate_float($str); + } + // Does expression match server:key.function(param) ? function validate_simple_expression($expression) { @@ -775,7 +786,7 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } # DEBUG INFO!!! // Before str() // if (eregi('^\{([0-9a-zA-Z[.-.]\_\.]+)\:([]\[0-9a-zA-Z\_\/\.\,]+)\.((diff)|(min)|(max)|(last)|(prev))\(([0-9\.]+)\)\}$', $expression, $arr)) // if (eregi('^\{([0-9a-zA-Z[.-.]\_\.]+)\:([]\[0-9a-zA-Z\_\/\.\,]+)\.((diff)|(min)|(max)|(last)|(prev)|(str))\(([0-9a-zA-Z\.\_\/\,]+)\)\}$', $expression, $arr)) - if (eregi('^\{([0-9a-zA-Z\_\.-]+)\:([]\[0-9a-zA-Z\_\/\.\,\:\(\) -]+)\.([a-z]{3,11})\(([0-9a-zA-Z\_\/\.\,]+)\)\}$', $expression, $arr)) + if (eregi('^\{([0-9a-zA-Z\_\.-]+)\:([]\[0-9a-zA-Z\_\/\.\,\:\(\) -]+)\.([a-z]{3,11})\(([#0-9a-zA-Z\_\/\.\,]+)\)\}$', $expression, $arr)) { $host=$arr[1]; $key=$arr[2]; @@ -824,12 +835,22 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } # DEBUG INFO!!! } - if(!in_array($function,array("str","regexp","logseverity","logsource")) + if(in_array($function,array("last","diff","count", + "prev","change","abschange","nodata","time","dayofweek", + "date","now","fuzzytime")) && (validate_float($parameter)!=0) ) { error("[$parameter] is not a float"); return -1; } + + if(in_array($function,array("min","max","avg","sum", + "delta")) + && (validate_ticks($parameter)!=0) ) + { + error("[$parameter] is not a float"); + return -1; + } } else { |
