diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2003-05-27 19:44:17 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2003-05-27 19:44:17 +0000 |
| commit | 533cc9984d83cd6dcbc0ef601522366fe1c473f1 (patch) | |
| tree | 62999cdd5aef540bb0b599386318c815cc65028a /include | |
| parent | bc8375013e30eace0e09f86c59980517f96f221d (diff) | |
| download | zabbix-533cc9984d83cd6dcbc0ef601522366fe1c473f1.tar.gz zabbix-533cc9984d83cd6dcbc0ef601522366fe1c473f1.tar.xz zabbix-533cc9984d83cd6dcbc0ef601522366fe1c473f1.zip | |
- added severity to media definition (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@788 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'include')
| -rw-r--r-- | include/db.h | 1 | ||||
| -rw-r--r-- | include/functions.c | 16 |
2 files changed, 13 insertions, 4 deletions
diff --git a/include/db.h b/include/db.h index aa7b36b6..70c3a382 100644 --- a/include/db.h +++ b/include/db.h @@ -102,6 +102,7 @@ DB_MEDIA int mediatypeid; char *sendto; int active; + int severity; }; DB_MEDIATYPE diff --git a/include/functions.c b/include/functions.c index 5287ed75..e285fdb9 100644 --- a/include/functions.c +++ b/include/functions.c @@ -752,7 +752,7 @@ int send_email(char *smtp_server,char *smtp_helo,char *smtp_email,char *mailto,c /* * Send message to user. Message will be sent to all medias registered to given user. */ -void send_to_user(int actionid,int userid,char *subject,char *message) +void send_to_user(DB_TRIGGER *trigger,int actionid,int userid,char *subject,char *message) { DB_MEDIA media; char sql[MAX_STRING_LEN+1]; @@ -760,14 +760,22 @@ void send_to_user(int actionid,int userid,char *subject,char *message) int i; - sprintf(sql,"select mediatypeid,sendto,active from media where active=%d and userid=%d",MEDIA_STATUS_ACTIVE,userid); + sprintf(sql,"select mediatypeid,sendto,active,severity from media where active=%d and userid=%d",MEDIA_STATUS_ACTIVE,userid); result = DBselect(sql); for(i=0;i<DBnum_rows(result);i++) { media.mediatypeid=atoi(DBget_field(result,i,0)); - media.active=atoi(DBget_field(result,i,2)); media.sendto=DBget_field(result,i,1); + media.active=atoi(DBget_field(result,i,2)); + media.severity=atoi(DBget_field(result,i,3)); + + zabbix_log( LOG_LEVEL_DEBUG, "Trigger severity [%d] Media severity [%d]",trigger->priority, media.severity); + if(((1<<trigger->priority)&media.severity)==0) + { + zabbix_log( LOG_LEVEL_DEBUG, "Won't send message"); + continue; + } DBadd_alert(actionid,media.mediatypeid,media.sendto,subject,message); } @@ -919,7 +927,7 @@ void apply_actions(DB_TRIGGER *trigger,int good) zabbix_log( LOG_LEVEL_WARNING, "Unsupported scope [%d] for actionid [%d]", action.scope, action.actionid); } - send_to_user(action.actionid,action.userid,action.subject,action.message); + send_to_user(trigger,action.actionid,action.userid,action.subject,action.message); now = time(NULL); sprintf(sql,"update actions set nextcheck=%d where actionid=%d",now+action.delay,action.actionid); DBexecute(sql); |
