summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-06-26 07:20:41 +0000
committersasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-06-26 07:20:41 +0000
commit0524a8a2dfb101e926b5a092c32a3e7c4dbb2543 (patch)
tree36f09ca9e171267aa2d77a7cc69e336f3663cd37 /src
parente20118aa386b5d231699ee309a6cd7cbdd166756 (diff)
downloadzabbix-0524a8a2dfb101e926b5a092c32a3e7c4dbb2543.tar.gz
zabbix-0524a8a2dfb101e926b5a092c32a3e7c4dbb2543.tar.xz
zabbix-0524a8a2dfb101e926b5a092c32a3e7c4dbb2543.zip
- [DEV-183] added support of applications in action conditions
git-svn-id: svn://svn.zabbix.com/trunk@5793 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r--src/zabbix_server/actions.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/zabbix_server/actions.c b/src/zabbix_server/actions.c
index f52dad8f..ca88da7c 100644
--- a/src/zabbix_server/actions.c
+++ b/src/zabbix_server/actions.c
@@ -356,6 +356,47 @@ int check_action_condition(DB_EVENT *event, DB_CONDITION *condition)
DBfree_result(result);
}
+ else if(event->source == EVENT_SOURCE_TRIGGERS && condition->conditiontype == CONDITION_TYPE_APPLICATION)
+ {
+ result = DBselect("select distinct a.name from applications a,items_applications i,functions f,triggers t"
+ " where a.applicationid=i.applicationid and i.itemid=f.itemid"
+ " and f.triggerid=t.triggerid and t.triggerid=" ZBX_FS_UI64,
+ event->objectid);
+
+ switch (condition->operator) {
+ case CONDITION_OPERATOR_EQUAL:
+ while (NULL != (row = DBfetch(result))) {
+ if (0 == strcmp(row[0], condition->value)) {
+ ret = SUCCEED;
+ break;
+ }
+ }
+ break;
+ case CONDITION_OPERATOR_LIKE:
+ while (NULL != (row = DBfetch(result))) {
+ if (NULL != strstr(row[0], condition->value)) {
+ ret = SUCCEED;
+ break;
+ }
+ }
+ break;
+ case CONDITION_OPERATOR_NOT_LIKE:
+ ret = SUCCEED;
+ while (NULL != (row = DBfetch(result))) {
+ if (NULL != strstr(row[0], condition->value)) {
+ ret = FAIL;
+ break;
+ }
+ }
+ break;
+ default:
+ zabbix_log( LOG_LEVEL_ERR, "Unsupported operator [%d] for condition id [" ZBX_FS_UI64 "]",
+ condition->operator,
+ condition->conditionid);
+ }
+
+ DBfree_result(result);
+ }
else if(event->source == EVENT_SOURCE_DISCOVERY &&
event->object == EVENT_OBJECT_DSERVICE &&
condition->conditiontype == CONDITION_TYPE_DVALUE)