diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-04-02 11:22:22 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-04-02 11:22:22 +0000 |
| commit | d2a3e65806eb484b59de7c3d8b7a8612249e70ca (patch) | |
| tree | a86c165cd36fe5284a3e59bcbcf6a10eb56077dc /src | |
| parent | 5297145c0a145eea288a0488e24e08d56c2b7dee (diff) | |
- Developed action configurations for discodery events (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3965 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
| -rw-r--r-- | src/zabbix_server/discoverer/discoverer.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/zabbix_server/discoverer/discoverer.c b/src/zabbix_server/discoverer/discoverer.c index 4d82b488..13c1df3e 100644 --- a/src/zabbix_server/discoverer/discoverer.c +++ b/src/zabbix_server/discoverer/discoverer.c @@ -30,9 +30,6 @@ #include "discoverer.h" #include "../events.h" -#define SERVICE_UP 0 -#define SERVICE_DOWN 1 - int discoverer_num; /****************************************************************************** @@ -197,7 +194,7 @@ static void register_service(DB_DSERVICE *service,DB_DRULE *rule,DB_DCHECK *chec if(!row || DBis_null(row[0])==SUCCEED) { /* Add host only if service is up */ - if(check->status == SERVICE_UP) + if(check->status == DOBJECT_STATUS_UP) { zabbix_log(LOG_LEVEL_DEBUG, "New service discovered on port %d", port); dserviceid = DBget_maxid("dservices","dserviceid"); @@ -206,13 +203,13 @@ static void register_service(DB_DSERVICE *service,DB_DRULE *rule,DB_DCHECK *chec dserviceid, check->type, port, - SERVICE_UP); + DOBJECT_STATUS_UP); service->dserviceid = dserviceid; service->dhostid = dhostid; service->type = check->type; service->port = port; - service->status = SERVICE_UP; + service->status = DOBJECT_STATUS_UP; service->lastup = 0; service->lastdown = 0; service->eventsent = 0; @@ -266,7 +263,7 @@ static void register_host(DB_DHOST *host,DB_DCHECK *check, zbx_uint64_t druleid, if(!row || DBis_null(row[0])==SUCCEED) { /* Add host only if service is up */ - if(check->status == SERVICE_UP) + if(check->status == DOBJECT_STATUS_UP) { zabbix_log(LOG_LEVEL_DEBUG, "New host discovered at %s", ip); @@ -323,7 +320,7 @@ static void update_service(DB_DRULE *rule, DB_DCHECK *check, char *ip, int port) zabbix_log(LOG_LEVEL_DEBUG, "In update_check(ip:%s, port:%d, status:%s)", ip, port, - (check->status==SERVICE_UP?"up":"down")); + (check->status==DOBJECT_STATUS_UP?"up":"down")); service.dserviceid=0; @@ -344,42 +341,42 @@ static void update_service(DB_DRULE *rule, DB_DCHECK *check, char *ip, int port) } now = time(NULL); - if(check->status == SERVICE_UP) + if(check->status == DOBJECT_STATUS_UP) { /* Update host status */ - if((host.status == SERVICE_DOWN)||(host.lastup==0 && host.lastdown==0)) + if((host.status == DOBJECT_STATUS_DOWN)||(host.lastup==0 && host.lastdown==0)) { - host.status=SERVICE_UP; + host.status=DOBJECT_STATUS_UP; host.lastdown=0; host.lastup=now; host.eventsent=0; update_dhost(&host); } /* Update service status */ - if((service.status == SERVICE_DOWN)||(service.lastup==0 && service.lastdown==0)) + if((service.status == DOBJECT_STATUS_DOWN)||(service.lastup==0 && service.lastdown==0)) { - service.status=SERVICE_UP; + service.status=DOBJECT_STATUS_UP; service.lastdown=0; service.lastup=now; service.eventsent=0; update_dservice(&service); } } - /* SERVICE_DOWN */ + /* DOBJECT_STATUS_DOWN */ else { - if((host.status == SERVICE_UP)||(host.lastup==0 && host.lastdown==0)) + if((host.status == DOBJECT_STATUS_UP)||(host.lastup==0 && host.lastdown==0)) { - host.status=SERVICE_DOWN; + host.status=DOBJECT_STATUS_DOWN; host.lastup=now; host.lastdown=0; host.eventsent=0; update_dhost(&host); } /* Update service status */ - if((service.status == SERVICE_UP)||(service.lastup==0 && service.lastdown==0)) + if((service.status == DOBJECT_STATUS_UP)||(service.lastup==0 && service.lastdown==0)) { - service.status=SERVICE_DOWN; + service.status=DOBJECT_STATUS_DOWN; service.lastup=now; service.lastdown=0; service.eventsent=0; @@ -390,7 +387,7 @@ static void update_service(DB_DRULE *rule, DB_DCHECK *check, char *ip, int port) /* Generating host events */ if(host.eventsent == 0) { - if(host.status == SERVICE_UP && (host.lastup<=now-rule->upevent)) + if(host.status == DOBJECT_STATUS_UP && (host.lastup<=now-rule->upevent)) { zabbix_log(LOG_LEVEL_DEBUG, "Generating host event for %s", host.ip); @@ -399,7 +396,7 @@ static void update_service(DB_DRULE *rule, DB_DCHECK *check, char *ip, int port) update_dhost(&host); add_host_event(&host,&service); } - if(host.status == SERVICE_DOWN && (host.lastdown<=now-rule->downevent)) + if(host.status == DOBJECT_STATUS_DOWN && (host.lastdown<=now-rule->downevent)) { zabbix_log(LOG_LEVEL_DEBUG, "Generating host event for %s", host.ip); @@ -413,7 +410,7 @@ static void update_service(DB_DRULE *rule, DB_DCHECK *check, char *ip, int port) /* Generating service events */ if(service.eventsent == 0) { - if(service.status == SERVICE_UP && (service.lastup<=now-rule->svcupevent)) + if(service.status == DOBJECT_STATUS_UP && (service.lastup<=now-rule->svcupevent)) { zabbix_log(LOG_LEVEL_DEBUG, "Generating service event for %s", host.ip); @@ -422,7 +419,7 @@ static void update_service(DB_DRULE *rule, DB_DCHECK *check, char *ip, int port) update_dservice(&service); add_service_event(&service); } - if(service.status == SERVICE_DOWN && (service.lastdown<=now-rule->svcdownevent)) + if(service.status == DOBJECT_STATUS_DOWN && (service.lastdown<=now-rule->svcdownevent)) { zabbix_log(LOG_LEVEL_DEBUG, "Generating service event for %s", host.ip); |
