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 /src/zabbix_server | |
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
Diffstat (limited to 'src/zabbix_server')
-rw-r--r-- | src/zabbix_server/evalfunc.c | 21 |
1 files changed, 20 insertions, 1 deletions
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); |