summaryrefslogtreecommitdiffstats
path: root/src/zabbix_server
diff options
context:
space:
mode:
authorsasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-05-09 09:31:34 +0000
committersasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-05-09 09:31:34 +0000
commita6b057c94aab1d1dd636fcce5237556164624046 (patch)
tree9950a6e97f79f47b94a4910166c98a4f5ecac30c /src/zabbix_server
parent5422393afccc526b8289f2999fc44b29441b419f (diff)
downloadzabbix-a6b057c94aab1d1dd636fcce5237556164624046.tar.gz
zabbix-a6b057c94aab1d1dd636fcce5237556164624046.tar.xz
zabbix-a6b057c94aab1d1dd636fcce5237556164624046.zip
- [DEV-167] added support of Host Template=<template> in actions
git-svn-id: svn://svn.zabbix.com/trunk@5690 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/zabbix_server')
-rw-r--r--src/zabbix_server/actions.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/zabbix_server/actions.c b/src/zabbix_server/actions.c
index 91b8cf40..565f3d07 100644
--- a/src/zabbix_server/actions.c
+++ b/src/zabbix_server/actions.c
@@ -123,6 +123,41 @@ static int check_action_condition(DB_EVENT *event, DB_CONDITION *condition)
}
DBfree_result(result);
}
+ else if (event->source == EVENT_SOURCE_TRIGGERS && condition->conditiontype == CONDITION_TYPE_HOST_TEMPLATE)
+ {
+ condition_value = zbx_atoui64(condition->value);
+
+ result = DBselect("select distinct ht.templateid from hosts_templates ht,items i,functions f,triggers t"
+ " where ht.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=t.triggerid and t.triggerid=" ZBX_FS_UI64,
+ event->objectid);
+
+ if (condition->operator == CONDITION_OPERATOR_EQUAL) {
+ while (NULL != (row = DBfetch(result))) {
+ hostid = zbx_atoui64(row[0]);
+
+ if (condition_value == hostid) {
+ ret = SUCCEED;
+ break;
+ }
+ }
+ } else if (condition->operator == CONDITION_OPERATOR_NOT_EQUAL) {
+ ret = SUCCEED;
+
+ while (NULL != (row = DBfetch(result))) {
+ hostid = zbx_atoui64(row[0]);
+
+ if (condition_value == hostid) {
+ ret = FAIL;
+ break;
+ }
+ }
+ } else
+ 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_TRIGGERS && condition->conditiontype == CONDITION_TYPE_HOST)
{
ZBX_STR2UINT64(condition_value, condition->value);