diff options
author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-01-02 08:15:39 +0000 |
---|---|---|
committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-01-02 08:15:39 +0000 |
commit | 6d536e136ac68af7741c2a7f0d6a55baec7ef67a (patch) | |
tree | 65e62a97cd1dbb45dbd21e8eb29b8a84e4315121 | |
parent | 2a9fc3a4279034b3770c2e29ff404d601c7730e9 (diff) | |
download | zabbix-6d536e136ac68af7741c2a7f0d6a55baec7ef67a.tar.gz zabbix-6d536e136ac68af7741c2a7f0d6a55baec7ef67a.tar.xz zabbix-6d536e136ac68af7741c2a7f0d6a55baec7ef67a.zip |
- new trigger function: regexp (Alexei)
- support of function str() for item type 'log' (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2469 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | frontends/php/include/config.inc.php | 7 | ||||
-rw-r--r-- | src/libs/zbxcommon/misc.c | 5 | ||||
-rw-r--r-- | src/zabbix_server/evalfunc.c | 21 |
4 files changed, 32 insertions, 3 deletions
@@ -1,5 +1,7 @@ Changes for 1.1beta5: + - new trigger function: regexp (Alexei) + - support of function str() for item type 'log' (Alexei) - terminology change: trigger's 'description' -> 'name' (Alexei) - new macro for actions {TRIGGER.NAME} (Alexei) - added Graphs synchronization for linked hosts (Eugene) diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index 9c28443a..b26ca7ea 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -780,14 +780,17 @@ function SDI($msg) { echo "DEBUG INFO: $msg <br>"; } # DEBUG INFO!!! ($function!="dayofweek")&& ($function!="date")&& ($function!="now")&& - ($function!="str")) + ($function!="str")&& + ($function!="fuzzytime")&& + ($function!="regexp") + ) { error("Unknown function [$function]"); return -1; } - if(( $function!="str") && (validate_float($parameter)!=0) ) + if(( $function!="str") && ( $function!="regexp") && (validate_float($parameter)!=0) ) { error("[$parameter] is not a float"); return -1; diff --git a/src/libs/zbxcommon/misc.c b/src/libs/zbxcommon/misc.c index e36cc9ee..3e709318 100644 --- a/src/libs/zbxcommon/misc.c +++ b/src/libs/zbxcommon/misc.c @@ -205,6 +205,11 @@ int set_result_type(AGENT_RESULT *result, int value_type, char *c) SET_STR_RESULT(result, strdup(c)); ret = SUCCEED; } + else if(value_type == ITEM_VALUE_TYPE_LOG) + { + SET_STR_RESULT(result, strdup(c)); + ret = SUCCEED; + } return ret; } diff --git a/src/zabbix_server/evalfunc.c b/src/zabbix_server/evalfunc.c index 19a4f2ca..2a273018 100644 --- a/src/zabbix_server/evalfunc.c +++ b/src/zabbix_server/evalfunc.c @@ -413,6 +413,7 @@ int evaluate_FUNCTION(char *value,DB_ITEM *item,char *function,char *parameter, int fuzlow, fuzhig; int day; + int len; zabbix_log( LOG_LEVEL_DEBUG, "In evaluate_FUNCTION() Function [%s] flag [%d]",function,flag); @@ -595,7 +596,7 @@ int evaluate_FUNCTION(char *value,DB_ITEM *item,char *function,char *parameter, } else if(strcmp(function,"str")==0) { - if(item->value_type==ITEM_VALUE_TYPE_STR) + if( (item->value_type==ITEM_VALUE_TYPE_STR) || (item->value_type==ITEM_VALUE_TYPE_LOG)) { if(strstr(item->lastvalue_str, parameter) == NULL) { @@ -612,6 +613,24 @@ int evaluate_FUNCTION(char *value,DB_ITEM *item,char *function,char *parameter, ret = FAIL; } } + else if(strcmp(function,"regexp")==0) + { + if( (item->value_type==ITEM_VALUE_TYPE_STR) || (item->value_type==ITEM_VALUE_TYPE_LOG)) + { + if(zbx_regexp_match(item->lastvalue_str, parameter, &len) != NULL) + { + strcpy(value,"1"); + } + else + { + strcpy(value,"0"); + } + } + else + { + ret = FAIL; + } + } else if(strcmp(function,"now")==0) { now=time(NULL); |