diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-06-08 20:31:10 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-06-08 20:31:10 +0000 |
| commit | ca5e5c13e5471d0e8e984fa0c3786926969c8bb7 (patch) | |
| tree | 2cdd1fb29153fb8edb51c7fc756ded5df0bf07b7 /src | |
| parent | a485607e0910336acb48b076d9d1953721ff80db (diff) | |
| download | zabbix-ca5e5c13e5471d0e8e984fa0c3786926969c8bb7.tar.gz zabbix-ca5e5c13e5471d0e8e984fa0c3786926969c8bb7.tar.xz zabbix-ca5e5c13e5471d0e8e984fa0c3786926969c8bb7.zip | |
Support of escalations.
git-svn-id: svn://svn.zabbix.com/trunk@1830 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
| -rw-r--r-- | src/zabbix_server/Makefile.in | 2 | ||||
| -rw-r--r-- | src/zabbix_server/escalator.c | 38 | ||||
| -rw-r--r-- | src/zabbix_server/server.c | 2 |
3 files changed, 34 insertions, 8 deletions
diff --git a/src/zabbix_server/Makefile.in b/src/zabbix_server/Makefile.in index 2a83102d..da50ed03 100644 --- a/src/zabbix_server/Makefile.in +++ b/src/zabbix_server/Makefile.in @@ -5,7 +5,7 @@ LIBS = @LIBS@ @MYSQL_LFLAGS@ @PGSQL_LFLAGS@ @SNMP_LFLAGS@ @LDAP_LFLAGS@ all: - @CC@ -o ../../bin/zabbix_server @CFLAGS@ -I../../include $(INCLUDE) server.c ../../include/db.c ../../include/functions.c ../../include/expression.c ../../include/cfg.c ../../include/log.c ../../include/security.c ../../include/pid.c ../../include/email.c ../../include/snprintf.c ../zabbix_agent/sysinfo.c ../../include/md5.c ../../include/zlog.c alerter.c pinger.c housekeeper.c checks_simple.c checks_snmp.c checks_agent.c checks_internal.c trapper.c -Wall $(LIBS) + @CC@ -o ../../bin/zabbix_server @CFLAGS@ -I../../include $(INCLUDE) server.c ../../include/db.c ../../include/functions.c ../../include/expression.c ../../include/cfg.c ../../include/log.c ../../include/security.c ../../include/pid.c ../../include/email.c ../../include/snprintf.c ../zabbix_agent/sysinfo.c ../../include/md5.c ../../include/zlog.c alerter.c pinger.c housekeeper.c checks_simple.c checks_snmp.c checks_agent.c checks_internal.c trapper.c escalator.c -Wall $(LIBS) clean: rm -f *.o diff --git a/src/zabbix_server/escalator.c b/src/zabbix_server/escalator.c index 7035f8bb..5f8f4369 100644 --- a/src/zabbix_server/escalator.c +++ b/src/zabbix_server/escalator.c @@ -55,25 +55,51 @@ int process_escalation(DB_ESCALATION_LOG *escalation_log) { + int i; + char sql[MAX_STRING_LEN]; + + DB_RESULT *result; + DB_ESCALATION_RULE escalation_rule; + + zabbix_log( LOG_LEVEL_WARNING, "In process_escalation()"); + + snprintf(sql,sizeof(sql)-1,"select escalationruleid, escalationid,level,period,delay,actiontype from escalation_rules where escalationid=%d and level>=%d order by level", escalation_log->escalationid, escalation_log->level); + zabbix_log( LOG_LEVEL_WARNING, "SQL [%s]", sql); + result = DBselect(sql); + + for(i=0;i<DBnum_rows(result);i++) + { + escalation_rule.escalationruleid=atoi(DBget_field(result,i,0)); + escalation_rule.escalationid=atoi(DBget_field(result,i,1)); + escalation_rule.level=atoi(DBget_field(result,i,2)); + escalation_rule.period=DBget_field(result,i,3); + escalation_rule.delay=atoi(DBget_field(result,i,4)); + escalation_rule.actiontype=atoi(DBget_field(result,i,5)); + + zabbix_log( LOG_LEVEL_WARNING, "Selected escalationrule ID [%d]", escalation_rule.escalationruleid); + if(escalation_log->level >= escalation_log->level) + { + } + } + DBfree_result(result); + return SUCCEED; } int main_escalator_loop() { char sql[MAX_STRING_LEN]; - char error[MAX_STRING_LEN]; - char error_esc[MAX_STRING_LEN]; int i,res; int now; - struct sigaction phan; + DB_RESULT *result; DB_ESCALATION_LOG escalation_log; for(;;) { - zabbix_log( LOG_LEVEL_WARNING, "Selecting data from escalation_log]"); + zabbix_log( LOG_LEVEL_WARNING, "Selecting data from escalation_log"); #ifdef HAVE_FUNCTION_SETPROCTITLE setproctitle("connecting to the database"); #endif @@ -111,9 +137,9 @@ int main_escalator_loop() DBclose(); #ifdef HAVE_FUNCTION_SETPROCTITLE - setproctitle("escalator [sleeping for %d seconds]", CONFIG_SENDER_FREQUENCY); + setproctitle("escalator [sleeping for %d seconds]", 10); #endif - sleep(CONFIG_SENDER_FREQUENCY); + sleep(10); } } diff --git a/src/zabbix_server/server.c b/src/zabbix_server/server.c index f471fa06..aa131164 100644 --- a/src/zabbix_server/server.c +++ b/src/zabbix_server/server.c @@ -802,7 +802,7 @@ int main(int argc, char **argv) { /* Fourth instance of zabbix_server escalates notifications */ zabbix_log( LOG_LEVEL_WARNING, "server #%d started [Escalator]",sucker_num); - main_pinger_loop(); + main_escalator_loop(); } else { |
