diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-07-12 09:14:46 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-07-12 09:14:46 +0000 |
| commit | 8a9f232945f6ec241470513933baf6d72d256a06 (patch) | |
| tree | 01c03798a9850c55f88a3e34db706a8786040482 /src/zabbix_server/timer/timer.c | |
| parent | 62918b434f4f3c809505715d1d92c402110ab230 (diff) | |
zabbix-1.2_dev integration
git-svn-id: svn://svn.zabbix.com/trunk@3038 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/zabbix_server/timer/timer.c')
| -rw-r--r-- | src/zabbix_server/timer/timer.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/zabbix_server/timer/timer.c b/src/zabbix_server/timer/timer.c index 5dcc27c2..648bd6eb 100644 --- a/src/zabbix_server/timer/timer.c +++ b/src/zabbix_server/timer/timer.c @@ -77,22 +77,20 @@ void main_timer_loop() for(;;) { -#ifdef HAVE_FUNCTION_SETPROCTITLE - setproctitle("updating nodata() functions"); -#endif + zbx_setproctitle("updating nodata() functions"); DBconnect(); now=time(NULL); /* #ifdef HAVE_PGSQL - snprintf(sql,sizeof(sql)-1,"select distinct f.itemid,f.functionid,f.parameter from functions f, items i,hosts h where h.hostid=i.hostid and h.status=%d and i.itemid=f.itemid and f.function in ('nodata','date','dayofweek','time','now') and i.lastclock+f.parameter::text::integer<=%d and i.status=%d", HOST_STATUS_MONITORED, now, ITEM_STATUS_ACTIVE); + zbx_snprintf(sql,sizeof(sql),"select distinct f.itemid,f.functionid,f.parameter from functions f, items i,hosts h where h.hostid=i.hostid and h.status=%d and i.itemid=f.itemid and f.function in ('nodata','date','dayofweek','time','now') and i.lastclock+f.parameter::text::integer<=%d and i.status=%d", HOST_STATUS_MONITORED, now, ITEM_STATUS_ACTIVE); #else - snprintf(sql,sizeof(sql)-1,"select distinct f.itemid,f.functionid,f.parameter,f.function from functions f, items i,hosts h where h.hostid=i.hostid and h.status=%d and i.itemid=f.itemid and f.function in ('nodata','date','dayofweek','time','now') and i.lastclock+f.parameter<=%d and i.status=%d", HOST_STATUS_MONITORED, now, ITEM_STATUS_ACTIVE); + zbx_snprintf(sql,sizeof(sql),"select distinct f.itemid,f.functionid,f.parameter,f.function from functions f, items i,hosts h where h.hostid=i.hostid and h.status=%d and i.itemid=f.itemid and f.function in ('nodata','date','dayofweek','time','now') and i.lastclock+f.parameter<=%d and i.status=%d", HOST_STATUS_MONITORED, now, ITEM_STATUS_ACTIVE); #endif */ - snprintf(sql,sizeof(sql)-1,"select distinct %s, functions f where h.hostid=i.hostid and h.status=%d and i.status=%d and f.function in ('nodata','date','dayofweek','time','now') and i.itemid=f.itemid", ZBX_SQL_ITEM_SELECT, HOST_STATUS_MONITORED, ITEM_STATUS_ACTIVE); + zbx_snprintf(sql,sizeof(sql),"select distinct %s, functions f where h.hostid=i.hostid and h.status=%d and i.status=%d and f.function in ('nodata','date','dayofweek','time','now') and i.itemid=f.itemid", ZBX_SQL_ITEM_SELECT, HOST_STATUS_MONITORED, ITEM_STATUS_ACTIVE); result = DBselect(sql); @@ -101,7 +99,7 @@ void main_timer_loop() DBget_item_from_db(&item,row); /* Update triggers will update value for NODATA */ -/* snprintf(sql,sizeof(sql)-1,"update functions set lastvalue='1' where itemid=%d and function='%s' and parameter='%s'" , itemid, function, parameter ); +/* zbx_snprintf(sql,sizeof(sql),"update functions set lastvalue='1' where itemid=%d and function='%s' and parameter='%s'" , itemid, function, parameter ); DBexecute(sql);*/ update_functions(&item); @@ -111,9 +109,8 @@ void main_timer_loop() DBfree_result(result); DBclose(); -#ifdef HAVE_FUNCTION_SETPROCTITLE - setproctitle("sleeping for 30 sec"); -#endif + zbx_setproctitle("sleeping for 30 sec"); + sleep(30); } } |
