diff options
author | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-30 09:06:15 +0000 |
---|---|---|
committer | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-30 09:06:15 +0000 |
commit | a839ed6e48cd074cd279180ee79aa684cd6fc350 (patch) | |
tree | a6f011487dc9ce81cb0f55b1620b44a4fb75a1ad | |
parent | e84814d3313e8d54c24106e1ac6806aeffec15dd (diff) | |
download | zabbix-a839ed6e48cd074cd279180ee79aa684cd6fc350.tar.gz zabbix-a839ed6e48cd074cd279180ee79aa684cd6fc350.tar.xz zabbix-a839ed6e48cd074cd279180ee79aa684cd6fc350.zip |
- added support of macro {TRIGGER.ID} (Alexei)
- added support of macro {EVENT.ID} (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@3408 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/zabbix_server/expression.c | 18 |
2 files changed, 20 insertions, 0 deletions
@@ -12,6 +12,8 @@ Changes for 1.3: Integrated from 1.1.x + - added support of macro {TRIGGER.ID} (Alexei) + - added support of macro {EVENT.ID} (Alexei) - better calculation of next check timestamp for active items (Alexei) - new algorithm for housekeeping same for all DB engines (Alexei) - always draw graphs for items having type "trapper" (Alexei) diff --git a/src/zabbix_server/expression.c b/src/zabbix_server/expression.c index 5cae3c78..a61be4cd 100644 --- a/src/zabbix_server/expression.c +++ b/src/zabbix_server/expression.c @@ -570,6 +570,8 @@ int evaluate(int *result,char *exp, char *error, int maxerrlen) #define MVAR_TRIGGER_STATUS "{TRIGGER.STATUS}" #define MVAR_TRIGGER_STATUS_OLD "{STATUS}" #define MVAR_TRIGGER_SEVERITY "{TRIGGER.SEVERITY}" +#define MVAR_TRIGGER_ID "{TRIGGER.ID}" +#define MVAR_EVENT_ID "{EVENT.ID}" #define STR_UNKNOWN_VARIAVLE "*UNKNOWN*" @@ -756,6 +758,22 @@ void substitute_simple_macros(DB_EVENT *event, DB_ACTION *action, char *data, in else zbx_snprintf(replace_to, sizeof(replace_to), "ON"); } + else if(macro_type & (MACRO_TYPE_MESSAGE_SUBJECT | MACRO_TYPE_MESSAGE_BODY) && + strncmp(pr, MVAR_TRIGGER_ID, strlen(MVAR_TRIGGER_ID)) == 0) + { + /* NOTE: if you make changes for this bloc, don't forgot MVAR_TRIGGER_STATUS block */ + var_len = strlen(MVAR_TRIGGER_ID); + + zbx_snprintf(replace_to, sizeof(replace_to), "%d", event->triggerid); + } + else if(macro_type & (MACRO_TYPE_MESSAGE_SUBJECT | MACRO_TYPE_MESSAGE_BODY) && + strncmp(pr, MVAR_EVENT_ID, strlen(MVAR_EVENT_ID)) == 0) + { + /* NOTE: if you make changes for this bloc, don't forgot MVAR_TRIGGER_STATUS block */ + var_len = strlen(MVAR_EVENT_ID); + + zbx_snprintf(replace_to, sizeof(replace_to), "%d", event->eventid); + } else if(macro_type & (MACRO_TYPE_MESSAGE_SUBJECT | MACRO_TYPE_MESSAGE_BODY) && strncmp(pr, MVAR_TRIGGER_SEVERITY, strlen(MVAR_TRIGGER_SEVERITY)) == 0) { |