summaryrefslogtreecommitdiffstats
path: root/src/zabbix_server/alerter/alerter.c
diff options
context:
space:
mode:
authorguliver <guliver@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-02-16 15:24:49 +0000
committerguliver <guliver@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-02-16 15:24:49 +0000
commit46e7eba7e031f101a82973caae71c2a0c1882cca (patch)
tree553c037b867439d72318e5f1b405601e3608d939 /src/zabbix_server/alerter/alerter.c
parentf0f1c557e1d9e42c79dbf566990b369929be09dd (diff)
downloadzabbix-46e7eba7e031f101a82973caae71c2a0c1882cca.tar.gz
zabbix-46e7eba7e031f101a82973caae71c2a0c1882cca.tar.xz
zabbix-46e7eba7e031f101a82973caae71c2a0c1882cca.zip
- integrated jabber messager (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3835 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/zabbix_server/alerter/alerter.c')
-rw-r--r--src/zabbix_server/alerter/alerter.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/zabbix_server/alerter/alerter.c b/src/zabbix_server/alerter/alerter.c
index c370c72b..f8358c19 100644
--- a/src/zabbix_server/alerter/alerter.c
+++ b/src/zabbix_server/alerter/alerter.c
@@ -51,6 +51,9 @@
#include "zlog.h"
#include "email.h"
#include "sms.h"
+#if defined (HAVE_JABBER)
+# include "jabber.h"
+#endif
#include "daemon.h"
#include "alerter.h"
@@ -94,6 +97,12 @@ static int execute_action(DB_ALERT *alert,DB_MEDIATYPE *mediatype, char *error,
res = send_email(mediatype->smtp_server,mediatype->smtp_helo,mediatype->smtp_email,alert->sendto,alert->subject,
alert->message, error, max_error_len);
}
+#if defined (HAVE_JABBER)
+ else if(mediatype->type==ALERT_TYPE_JABBER)
+ {
+ res = send_jabber(mediatype->username, mediatype->passwd, alert->sendto, alert->message, error, max_error_len);
+ }
+#endif /* HAVE_JABBER */
else if(mediatype->type==ALERT_TYPE_SMS)
{
res = send_sms(mediatype->gsm_modem,alert->sendto,alert->message, error, max_error_len);
@@ -197,7 +206,7 @@ int main_alerter_loop()
now = time(NULL);
/* zbx_snprintf(sql,sizeof(sql),"select a.alertid,a.mediatypeid,a.sendto,a.subject,a.message,a.status,a.retries,mt.mediatypeid,mt.type,mt.description,mt.smtp_server,mt.smtp_helo,mt.smtp_email,mt.exec_path from alerts a,media_type mt where a.status=0 and a.retries<3 and a.mediatypeid=mt.mediatypeid order by a.clock"); */
- result = DBselect("select a.alertid,a.mediatypeid,a.sendto,a.subject,a.message,a.status,a.retries,mt.mediatypeid,mt.type,mt.description,mt.smtp_server,mt.smtp_helo,mt.smtp_email,mt.exec_path,a.delay,mt.gsm_modem from alerts a,media_type mt where a.status=%d and a.retries<3 and (a.repeats<a.maxrepeats or a.maxrepeats=0) and a.nextcheck<=%d and a.mediatypeid=mt.mediatypeid and " ZBX_COND_NODEID " order by a.clock", ALERT_STATUS_NOT_SENT, now, LOCAL_NODE("mt.mediatypeid"));
+ result = DBselect("select a.alertid,a.mediatypeid,a.sendto,a.subject,a.message,a.status,a.retries,mt.mediatypeid,mt.type,mt.description,mt.smtp_server,mt.smtp_helo,mt.smtp_email,mt.exec_path,a.delay,mt.gsm_modem,mt.username,mt.passwd from alerts a,media_type mt where a.status=%d and a.retries<3 and (a.repeats<a.maxrepeats or a.maxrepeats=0) and a.nextcheck<=%d and a.mediatypeid=mt.mediatypeid and " ZBX_COND_NODEID " order by a.clock", ALERT_STATUS_NOT_SENT, now, LOCAL_NODE("mt.mediatypeid"));
while((row=DBfetch(result)))
{
@@ -220,6 +229,8 @@ int main_alerter_loop()
alert.delay=atoi(row[14]);
mediatype.gsm_modem=row[15];
+ mediatype.username=row[16];
+ mediatype.passwd=row[17];
phan.sa_handler = child_signal_handler;
sigemptyset(&phan.sa_mask);