summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libs/zbxcommon/misc.c5
-rw-r--r--src/zabbix_server/evalfunc.c21
2 files changed, 25 insertions, 1 deletions
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);