From f2d0e11eb6be9a4d51682d037befdfd645257da4 Mon Sep 17 00:00:00 2001 From: hugetoad Date: Sun, 24 Aug 2003 08:16:09 +0000 Subject: - added src/zabbix_sucker/housekeeper.* (Alexei) git-svn-id: svn://svn.zabbix.com/trunk@938 97f52cf1-0a1b-0410-bd0e-c28be96e8082 --- src/zabbix_sucker/Makefile.in | 2 +- src/zabbix_sucker/housekeeper.c | 215 ++++++++++++++++++++++++++++++++++++++ src/zabbix_sucker/housekeeper.h | 34 ++++++ src/zabbix_sucker/zabbix_sucker.c | 167 +---------------------------- 4 files changed, 252 insertions(+), 166 deletions(-) create mode 100644 src/zabbix_sucker/housekeeper.c create mode 100644 src/zabbix_sucker/housekeeper.h (limited to 'src') diff --git a/src/zabbix_sucker/Makefile.in b/src/zabbix_sucker/Makefile.in index acc759d2..aba7d381 100644 --- a/src/zabbix_sucker/Makefile.in +++ b/src/zabbix_sucker/Makefile.in @@ -5,7 +5,7 @@ LIBS = @LIBS@ @MYSQL_LFLAGS@ @PGSQL_LFLAGS@ @SNMP_LFLAGS@ all: - @CC@ -o ../../bin/zabbix_suckerd @CFLAGS@ -I../../include $(INCLUDE) zabbix_sucker.c ../../include/db.c ../../include/functions.c ../../include/expression.c ../../include/cfg.c ../../include/log.c ../../include/security.c ../../include/pid.c ../zabbix_agent/sysinfo.c alerter.c pinger.c -Wall $(LIBS) + @CC@ -o ../../bin/zabbix_suckerd @CFLAGS@ -I../../include $(INCLUDE) zabbix_sucker.c ../../include/db.c ../../include/functions.c ../../include/expression.c ../../include/cfg.c ../../include/log.c ../../include/security.c ../../include/pid.c ../zabbix_agent/sysinfo.c alerter.c pinger.c housekeeper.c -Wall $(LIBS) clean: rm -f *.o diff --git a/src/zabbix_sucker/housekeeper.c b/src/zabbix_sucker/housekeeper.c new file mode 100644 index 00000000..99f7307f --- /dev/null +++ b/src/zabbix_sucker/housekeeper.c @@ -0,0 +1,215 @@ +/* +** Zabbix +** Copyright (C) 2000,2001,2002,2003 Alexei Vladishev +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#ifdef HAVE_NETDB_H + #include +#endif + +/* Required for getpwuid */ +#include + +#include +#include + +#include + +#include "common.h" +#include "cfg.h" +#include "db.h" +#include "log.h" + +#include "housekeeper.h" + +int housekeeping_history(int now) +{ + char sql[MAX_STRING_LEN+1]; + DB_ITEM item; + + DB_RESULT *result; + + int i; + +/* How lastdelete is used ??? */ + sprintf(sql,"select itemid,lastdelete,history,delay from items where lastdelete<=%d", now); + result = DBselect(sql); + + for(i=0;i