summaryrefslogtreecommitdiffstats
path: root/src/zabbix_server/discoverer/discoverer.c
diff options
context:
space:
mode:
authoralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-03-28 18:52:46 +0000
committeralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-03-28 18:52:46 +0000
commit58f241c23b5d259220351efc421c0252bb6f3a47 (patch)
treea9ab9866a8fb67d8c89967540dd12f912d761392 /src/zabbix_server/discoverer/discoverer.c
parentc7fa9fac400f621009d138fe43ac26e0c80ecf75 (diff)
downloadzabbix-58f241c23b5d259220351efc421c0252bb6f3a47.tar.gz
zabbix-58f241c23b5d259220351efc421c0252bb6f3a47.tar.xz
zabbix-58f241c23b5d259220351efc421c0252bb6f3a47.zip
Support of service discovery events and other changes.
git-svn-id: svn://svn.zabbix.com/trunk@3950 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/zabbix_server/discoverer/discoverer.c')
-rw-r--r--src/zabbix_server/discoverer/discoverer.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/zabbix_server/discoverer/discoverer.c b/src/zabbix_server/discoverer/discoverer.c
index 56f17702..4d82b488 100644
--- a/src/zabbix_server/discoverer/discoverer.c
+++ b/src/zabbix_server/discoverer/discoverer.c
@@ -356,11 +356,14 @@ static void update_service(DB_DRULE *rule, DB_DCHECK *check, char *ip, int port)
update_dhost(&host);
}
/* Update service status */
- DBexecute("update dservices set status=%d,lastup=%d,lastdown=0,eventsent=0 where (status=%d or (lastup=0 and lastdown=0)) and dserviceid=" ZBX_FS_UI64,
- SERVICE_UP,
- now,
- SERVICE_DOWN,
- service.dserviceid);
+ if((service.status == SERVICE_DOWN)||(service.lastup==0 && service.lastdown==0))
+ {
+ service.status=SERVICE_UP;
+ service.lastdown=0;
+ service.lastup=now;
+ service.eventsent=0;
+ update_dservice(&service);
+ }
}
/* SERVICE_DOWN */
else
@@ -374,11 +377,14 @@ static void update_service(DB_DRULE *rule, DB_DCHECK *check, char *ip, int port)
update_dhost(&host);
}
/* Update service status */
- DBexecute("update dservices set status=%d,lastup=0,lastdown=%d,eventsent=0 where (status=%d or (lastup=0 and lastdown=0)) and dserviceid=" ZBX_FS_UI64,
- SERVICE_DOWN,
- now,
- SERVICE_UP,
- service.dserviceid);
+ if((service.status == SERVICE_UP)||(service.lastup==0 && service.lastdown==0))
+ {
+ service.status=SERVICE_DOWN;
+ service.lastup=now;
+ service.lastdown=0;
+ service.eventsent=0;
+ update_dservice(&service);
+ }
}
/* Generating host events */