summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-07-04 08:42:31 +0000
committeralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-07-04 08:42:31 +0000
commit621b3e8d4771f21e4ac620f957abdb5dc8573fd6 (patch)
tree7c715328526416ca76f7ef73ba5a7748cc51f69f
parentacf3d2d5e9493430c187af9dc673bf5fcf438593 (diff)
downloadzabbix-621b3e8d4771f21e4ac620f957abdb5dc8573fd6.tar.gz
zabbix-621b3e8d4771f21e4ac620f957abdb5dc8573fd6.tar.xz
zabbix-621b3e8d4771f21e4ac620f957abdb5dc8573fd6.zip
- added support of NOT IN operator for time periods (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@4423 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--ChangeLog1
-rw-r--r--frontends/php/include/actions.inc.php10
-rw-r--r--frontends/php/include/defines.inc.php1
-rw-r--r--frontends/php/include/locales/en_gb.inc.php4
-rw-r--r--include/common.h3
-rw-r--r--src/zabbix_server/actions.c9
6 files changed, 22 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 722d98bc..011d8a6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@ Changes for 1.5:
Changes for 1.4.2:
+ - added support of NOT IN operator for time periods (Alexei)
- fixed processing of macro {TRIGGER.VALUE} on 32 bit systems (Alexei)
- changed priorities of '|' and '&' in trigger expressions (Alexei)
- fixed no graphs for PostgreSQL (Eugene)
diff --git a/frontends/php/include/actions.inc.php b/frontends/php/include/actions.inc.php
index 9b872a85..f8e90ab1 100644
--- a/frontends/php/include/actions.inc.php
+++ b/frontends/php/include/actions.inc.php
@@ -298,11 +298,12 @@ include_once 'include/discovery.inc.php';
{
$str_op[CONDITION_OPERATOR_EQUAL] = '=';
$str_op[CONDITION_OPERATOR_NOT_EQUAL] = '<>';
- $str_op[CONDITION_OPERATOR_LIKE] = 'like';
- $str_op[CONDITION_OPERATOR_NOT_LIKE] = 'not like';
- $str_op[CONDITION_OPERATOR_IN] = 'in';
+ $str_op[CONDITION_OPERATOR_LIKE] = S_LIKE_SMALL;
+ $str_op[CONDITION_OPERATOR_NOT_LIKE] = S_NOT_LIKE_SMALL;
+ $str_op[CONDITION_OPERATOR_IN] = S_IN_SMALL;
$str_op[CONDITION_OPERATOR_MORE_EQUAL] = '>=';
$str_op[CONDITION_OPERATOR_LESS_EQUAL] = '<=';
+ $str_op[CONDITION_OPERATOR_NOT_IN] = S_NOT_IN_SMALL;
if(isset($str_op[$operator]))
return $str_op[$operator];
@@ -558,7 +559,8 @@ include_once 'include/discovery.inc.php';
CONDITION_OPERATOR_EQUAL
);
$operators[CONDITION_TYPE_TIME_PERIOD] = array(
- CONDITION_OPERATOR_IN
+ CONDITION_OPERATOR_IN,
+ CONDITION_OPERATOR_NOT_IN
);
$operators[CONDITION_TYPE_DHOST_IP] = array(
CONDITION_OPERATOR_EQUAL,
diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php
index e709a73a..59043c76 100644
--- a/frontends/php/include/defines.inc.php
+++ b/frontends/php/include/defines.inc.php
@@ -126,6 +126,7 @@
define('CONDITION_OPERATOR_IN', 4);
define('CONDITION_OPERATOR_MORE_EQUAL', 5);
define('CONDITION_OPERATOR_LESS_EQUAL', 6);
+ define('CONDITION_OPERATOR_NOT_IN', 7);
define('HOST_STATUS_MONITORED', 0);
define('HOST_STATUS_NOT_MONITORED', 1);
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index 6a2c4c51..d2bae0f1 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -288,6 +288,10 @@
'S_ENABLE_SELECTED_ACTIONS_Q'=> 'Enable selected actions?',
'S_DISABLE_SELECTED_ACTIONS_Q'=> 'Disable selected actions?',
'S_DELETE_SELECTED_ACTION_Q'=> 'Delete selected action?',
+ 'S_LIKE_SMALL'=> 'like',
+ 'S_NOT_LIKE_SMALL'=> 'not like',
+ 'S_IN_SMALL'=> 'in',
+ 'S_NOT_IN_SMALL'=> 'not in',
// alarms.php
'S_ALARMS'=> 'Alarms',
diff --git a/include/common.h b/include/common.h
index 1b4e6f6d..2ed7607c 100644
--- a/include/common.h
+++ b/include/common.h
@@ -286,7 +286,8 @@ typedef enum
CONDITION_OPERATOR_NOT_LIKE,
CONDITION_OPERATOR_IN,
CONDITION_OPERATOR_MORE_EQUAL,
- CONDITION_OPERATOR_LESS_EQUAL
+ CONDITION_OPERATOR_LESS_EQUAL,
+ CONDITION_OPERATOR_NOT_IN
} zbx_condition_op_t;
typedef enum
diff --git a/src/zabbix_server/actions.c b/src/zabbix_server/actions.c
index 85cfbb10..324e1fca 100644
--- a/src/zabbix_server/actions.c
+++ b/src/zabbix_server/actions.c
@@ -280,7 +280,14 @@ static int check_action_condition(DB_EVENT *event, DB_CONDITION *condition)
condition->value);
if(condition->operator == CONDITION_OPERATOR_IN)
{
- if(check_time_period(condition->value, (time_t)NULL)==1)
+ if(check_time_period(condition->value, (time_t)NULL) == 1)
+ {
+ ret = SUCCEED;
+ }
+ }
+ else if(condition->operator == CONDITION_OPERATOR_NOT_IN)
+ {
+ if(check_time_period(condition->value, (time_t)NULL) == 0)
{
ret = SUCCEED;
}