summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-12-27 18:10:30 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2002-12-27 18:10:30 +0000
commit3f4fb0cd9e216fa21c47cf6652c6c951b4ecdfde (patch)
tree9d44fd98f7b9672d0eff2cf2eeb077e27c6bd02b /src
parenta95958e564bcd16f44395ed7d45f7994b198e9b2 (diff)
downloadzabbix-3f4fb0cd9e216fa21c47cf6652c6c951b4ecdfde.tar.gz
zabbix-3f4fb0cd9e216fa21c47cf6652c6c951b4ecdfde.tar.xz
zabbix-3f4fb0cd9e216fa21c47cf6652c6c951b4ecdfde.zip
- improvements for chart.php (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@611 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src')
-rw-r--r--src/zabbix_sucker/zabbix_sucker.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/zabbix_sucker/zabbix_sucker.c b/src/zabbix_sucker/zabbix_sucker.c
index 4e5ba110..2a7efd91 100644
--- a/src/zabbix_sucker/zabbix_sucker.c
+++ b/src/zabbix_sucker/zabbix_sucker.c
@@ -877,7 +877,7 @@ int housekeeping_history(int now)
int i;
/* How lastdelete is used ??? */
- sprintf(sql,"select i.itemid,i.lastdelete,i.history from items i where i.lastdelete<=%d", now);
+ sprintf(sql,"select itemid,lastdelete,history,delay from items where lastdelete<=%d", now);
result = DBselect(sql);
for(i=0;i<DBnum_rows(result);i++)
@@ -885,15 +885,21 @@ int housekeeping_history(int now)
item.itemid=atoi(DBget_field(result,i,0));
item.lastdelete=atoi(DBget_field(result,i,1));
item.history=atoi(DBget_field(result,i,2));
+ item.delay=atoi(DBget_field(result,i,3));
+
+ if(item.delay==0)
+ {
+ item.delay=1;
+ }
#ifdef HAVE_MYSQL
- sprintf (sql,"delete from history where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.history,CONFIG_HOUSEKEEPING_FREQUENCY*3600);
+ sprintf (sql,"delete from history where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.history,2*CONFIG_HOUSEKEEPING_FREQUENCY*3600/item.delay);
#else
sprintf (sql,"delete from history where itemid=%d and clock<%d",item.itemid,now-24*3600*item.history);
#endif
DBexecute(sql);
#ifdef HAVE_MYSQL
- sprintf (sql,"delete from history_str where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.history,CONFIG_HOUSEKEEPING_FREQUENCY*3600);
+ sprintf (sql,"delete from history_str where itemid=%d and clock<%d limit %d",item.itemid,now-24*3600*item.history,2*CONFIG_HOUSEKEEPING_FREQUENCY*3600/item.delay);
#else
sprintf (sql,"delete from history_str where itemid=%d and clock<%d",item.itemid,now-24*3600*item.history);
#endif