You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(19) |
Oct
(10) |
Nov
(14) |
Dec
(58) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(5) |
Mar
(33) |
Apr
(31) |
May
(3) |
Jun
(30) |
Jul
(4) |
Aug
(26) |
Sep
(23) |
Oct
|
Nov
(6) |
Dec
(56) |
2008 |
Jan
(12) |
Feb
(9) |
Mar
(2) |
Apr
(8) |
May
(2) |
Jun
(3) |
Jul
(4) |
Aug
(1) |
Sep
|
Oct
|
Nov
(16) |
Dec
(4) |
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(36) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
|
From: Florian G. <re...@us...> - 2007-12-18 00:03:12
|
Update of /cvsroot/perfparse/_perfparse/cgi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26547/cgi Modified Files: cgi.c Log Message: squashed some compiler warnings Index: cgi.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/cgi/cgi.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** cgi.c 12 Aug 2007 00:11:44 -0000 1.4 --- cgi.c 18 Dec 2007 00:03:00 -0000 1.5 *************** *** 88,92 **** if(sGet!= NULL) strncpy(sQuery,sGet,getLength-1); // do not copy the \0 // get POST data from stdin ! fgets(sQuery+getLength,contentLength+1,stdin); #ifdef DEBUG fprintf(df,"GET+POST: %s\n",sQuery); --- 88,93 ---- if(sGet!= NULL) strncpy(sQuery,sGet,getLength-1); // do not copy the \0 // get POST data from stdin ! // todo: compiler warns here. We should not rely on content length ! fgets(sQuery+getLength,contentLength+1,stdin); #ifdef DEBUG fprintf(df,"GET+POST: %s\n",sQuery); |
From: Florian G. <re...@us...> - 2007-12-18 00:03:12
|
Update of /cvsroot/perfparse/_perfparse/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26547/modules Modified Files: libpp_storage.h storage_file_output.c Log Message: squashed some compiler warnings Index: libpp_storage.h =================================================================== RCS file: /cvsroot/perfparse/_perfparse/modules/libpp_storage.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libpp_storage.h 24 Aug 2006 11:31:59 -0000 1.2 --- libpp_storage.h 18 Dec 2007 00:03:00 -0000 1.3 *************** *** 52,56 **** ! int (*log)(char *file, int line, char *fmt, ...); } storage_module_t; --- 52,56 ---- ! int (*log)(char *file, int line, int loglevel, char *fmt, ...); } storage_module_t; Index: storage_file_output.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/modules/storage_file_output.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** storage_file_output.c 26 Sep 2005 14:36:33 -0000 1.1.1.1 --- storage_file_output.c 18 Dec 2007 00:03:00 -0000 1.2 *************** *** 3,8 **** * storage_file_output.c - Parse Nagios data and store in relational database. * ! * Copyright (c) 2004 Yves Mettier (yme...@li...) ! * Last Modified: 2004-09-16 * * License: --- 3,10 ---- * storage_file_output.c - Parse Nagios data and store in relational database. * ! * Copyright (c) 2004-2007 Yves Mettier (yme...@li...) ! * Florian Gleixner ! * ! * $Id$ * * License: *************** *** 53,57 **** pos[0] = '\0'; if(mkdir (filename,0755) && (errno != EEXIST)) { ! pp_log(__FILE__,__LINE__, _("Could not create directory '%s'"), filename); pos[0] = '/'; return(-1); --- 55,59 ---- pos[0] = '\0'; if(mkdir (filename,0755) && (errno != EEXIST)) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Could not create directory '%s'"), filename); pos[0] = '/'; return(-1); *************** *** 168,170 **** return(sm); } - --- 170,171 ---- |
From: Florian G. <re...@us...> - 2007-12-18 00:03:12
|
Update of /cvsroot/perfparse/_perfparse/perfparse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26547/perfparse Modified Files: log_reader.h Log Message: squashed some compiler warnings Index: log_reader.h =================================================================== RCS file: /cvsroot/perfparse/_perfparse/perfparse/log_reader.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** log_reader.h 26 Sep 2005 14:36:33 -0000 1.1.1.1 --- log_reader.h 18 Dec 2007 00:03:00 -0000 1.2 *************** *** 27,30 **** --- 27,35 ---- #define __LOG_READER__ + #if HAVE_CONFIG_H + # include <config.h> + #endif /* HAVE_CONFIG_H */ + + #include <glib.h> |
From: Florian G. <re...@us...> - 2007-12-17 20:50:04
|
Update of /cvsroot/perfparse/_perfparse/libpp_common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21824/libpp_common Modified Files: config_file.c libpp_common.h Log Message: replace macro with function should make code make better to debug - and probably even smaller. Index: libpp_common.h =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_common/libpp_common.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** libpp_common.h 15 Dec 2007 23:30:56 -0000 1.9 --- libpp_common.h 17 Dec 2007 20:49:53 -0000 1.10 *************** *** 60,64 **** #define LOG_DEBUG3 64 #define LOG_DEBUG2 32 ! #define LOG_DEBUG1 16 #define LOG_INFO 8 #define LOG_WARNING 4 --- 60,64 ---- #define LOG_DEBUG3 64 #define LOG_DEBUG2 32 ! #define LOG_STATISTICS 16 #define LOG_INFO 8 #define LOG_WARNING 4 *************** *** 183,186 **** --- 183,190 ---- #define config_get_value_as_integer(id) (config[id].integer) #define config_get_value_as_boolean(id) (config[id].boolean) + void config_item_add(config_item_t *cd,config_item_id_e x, char *skey, + char *svalue, const char *sdesc, const char *ldesc, char *sopt, char *lopt, type_e ttype, + int bin_config_file); + void config_definition_init(const char*default_error_log); Index: config_file.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_common/config_file.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** config_file.c 14 Dec 2007 21:42:17 -0000 1.6 --- config_file.c 17 Dec 2007 20:49:53 -0000 1.7 *************** *** 54,58 **** char *my_gethostname(void) { ! pp_log(__FILE__,__LINE__,LOG_DEBUG_FUNCTION,_("my_gethostname() called\n")); char *s=NULL; #if defined (OS_SOLARIS) --- 54,58 ---- char *my_gethostname(void) { ! pp_log_func; char *s=NULL; #if defined (OS_SOLARIS) *************** *** 88,103 **** } ! #define config_item_add(cd, x, skey, svalue, sdesc, ldesc, sopt, lopt, ttype, bin_config_file) \ ! cd[x].key = strdup(skey); \ ! cd[x].value = svalue?strdup(svalue):NULL; \ ! cd[x].short_description = strdup(sdesc); \ ! cd[x].long_description = strdup(ldesc); \ ! cd[x].short_option = sopt?strdup(sopt):NULL; \ ! cd[x].long_option = lopt?strdup(lopt):NULL; \ ! cd[x].integer = svalue?strtol(svalue,NULL,10):0; \ ! cd[x].boolean = strtoboolean(svalue); \ ! cd[x].in_config_file = bin_config_file; \ cd[x].type = ttype; ! void config_definition_init(const char*default_error_log) { --- 88,106 ---- } ! void config_item_add(config_item_t *cd,config_item_id_e x, char *skey, ! char *svalue, const char *sdesc, const char *ldesc, char *sopt, char *lopt, type_e ttype, ! int bin_config_file) { ! ! cd[x].key = strdup(skey); ! cd[x].value = svalue?strdup(svalue):NULL; ! cd[x].short_description = strdup(sdesc); ! cd[x].long_description = strdup(ldesc); ! cd[x].short_option = sopt?strdup(sopt):NULL; ! cd[x].long_option = lopt?strdup(lopt):NULL; ! cd[x].integer = svalue?strtol(svalue,NULL,10):0; ! cd[x].boolean = strtoboolean(svalue); ! cd[x].in_config_file = bin_config_file; cd[x].type = ttype; ! } void config_definition_init(const char*default_error_log) { *************** *** 108,112 **** config_item_add(config_definition, CONFIG_ITEM_ID_CONFIG_FILE, "Config_File", "/" SYSCONFDIR "/" CONFIG_FILE , _("Config file"), _("File for Perfparse configuration"), "-c", "--config-file", TYPE_STRING, 0); config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG, "Error_Log", default_error_log, _("Perfparse log"), _("File where Perfparse logs messages"), "-e", "--error-log", TYPE_STRING, 1); ! config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG_LEVEL, "Error_Log_Level", "255", _("Perfparse log level"), _("Error log level"), NULL, "--error-log-level", TYPE_INT, 1); config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG_ROTATE, "Error_Log_Rotate", "yes", _("Perfparse log rotate"), _("Rotate Perfparse log files"), NULL, NULL,TYPE_BOOLEAN, 1); config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG_KEEP_N_DAYS, "Error_Log_Keep_N_Days", "7", _("Keep N days of error log"), _("Keep N days of error log. Compress recent logs and remove too old ones"), NULL, NULL,TYPE_INT, 1); --- 111,115 ---- config_item_add(config_definition, CONFIG_ITEM_ID_CONFIG_FILE, "Config_File", "/" SYSCONFDIR "/" CONFIG_FILE , _("Config file"), _("File for Perfparse configuration"), "-c", "--config-file", TYPE_STRING, 0); config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG, "Error_Log", default_error_log, _("Perfparse log"), _("File where Perfparse logs messages"), "-e", "--error-log", TYPE_STRING, 1); ! config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG_LEVEL, "Error_Log_Level", "15", _("Perfparse log level"), _("Error log level"), "-x", "--error-log-level", TYPE_INT, 1); config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG_ROTATE, "Error_Log_Rotate", "yes", _("Perfparse log rotate"), _("Rotate Perfparse log files"), NULL, NULL,TYPE_BOOLEAN, 1); config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG_KEEP_N_DAYS, "Error_Log_Keep_N_Days", "7", _("Keep N days of error log"), _("Keep N days of error log. Compress recent logs and remove too old ones"), NULL, NULL,TYPE_INT, 1); |
From: Florian G. <re...@us...> - 2007-12-17 20:49:53
|
Update of /cvsroot/perfparse/_perfparse/libpp_mysql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21824/libpp_mysql Modified Files: del_policy.c del_policy.h Log Message: replace macro with function should make code make better to debug - and probably even smaller. Index: del_policy.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_mysql/del_policy.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** del_policy.c 15 Dec 2007 23:30:56 -0000 1.7 --- del_policy.c 17 Dec 2007 20:49:53 -0000 1.8 *************** *** 226,231 **** ! ! void getRawHostPolicy(t_raw_policyinfo *policyinfo) { pp_log_func; --- 226,233 ---- ! /* get Raw deletion policy info from settings in host. If there are no settings ! in host, get them from hostgroup setting ! */ ! void getRawHostPolicy(t_policyinfo *policyinfo) { pp_log_func; *************** *** 249,253 **** } ! void getRawGroupPolicy(t_raw_policyinfo *policyinfo) { pp_log_func; --- 251,259 ---- } ! /* get Raw deletion policy info from settings in hostgroup. If there are no ! settings in hostgroup, get them from default entries. ! */ ! ! void getRawGroupPolicy(t_policyinfo *policyinfo) { pp_log_func; *************** *** 260,264 **** int maxdel=DEL_POLICY_UNDEFINED; ! while(result_row = mysql_fetch_row(query_result)) { if(!isNull(0)) { // individual settings before group settings if(iData(0)>maxdel || iData(0)==DEL_POLICY_INFINITY) { --- 266,270 ---- int maxdel=DEL_POLICY_UNDEFINED; ! while((result_row = mysql_fetch_row(query_result))) { if(!isNull(0)) { // individual settings before group settings if(iData(0)>maxdel || iData(0)==DEL_POLICY_INFINITY) { *************** *** 283,286 **** --- 289,297 ---- } + + if(policyinfo->iPolicySource==DEL_POLICY_SOURCE_NONE) { + policyinfo->iPolicySeconds=getDefaultRawPolicy(); + policyinfo->iPolicySource=DEL_POLICY_SOURCE_DEFAULT; + } } Index: del_policy.h =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_mysql/del_policy.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** del_policy.h 15 Dec 2007 23:30:56 -0000 1.5 --- del_policy.h 17 Dec 2007 20:49:53 -0000 1.6 *************** *** 24,28 **** DEL_POLICY_SOURCE_HOST_GROUP, DEL_POLICY_SOURCE_HOSTGROUP, ! DEL_POLICY_SOURCE_HOSTGROUP_GROUP}; typedef struct { --- 24,29 ---- DEL_POLICY_SOURCE_HOST_GROUP, DEL_POLICY_SOURCE_HOSTGROUP, ! DEL_POLICY_SOURCE_HOSTGROUP_GROUP, ! DEL_POLICY_SOURCE_DEFAULT}; typedef struct { *************** *** 34,38 **** // raw del policy info ! typedef struct t_raw_policyinfo { int iServiceId; char *sServiceDesc; --- 35,39 ---- // raw del policy info ! typedef struct t_policyinfo { int iServiceId; char *sServiceDesc; *************** *** 41,45 **** int iPolicySource; int iPolicySeconds; ! } t_raw_policyinfo; --- 42,46 ---- int iPolicySource; int iPolicySeconds; ! } t_policyinfo; *************** *** 55,60 **** char *getPolicyDesc(int iPolicy); ! void getRawHostPolicy(t_raw_policyinfo *policyinfo); ! void getRawGroupPolicy(t_raw_policyinfo *policyinfo); int getBinHostPolicy(char *sHost); --- 56,61 ---- char *getPolicyDesc(int iPolicy); ! void getRawHostPolicy(t_policyinfo *policyinfo); ! void getRawGroupPolicy(t_policyinfo *policyinfo); int getBinHostPolicy(char *sHost); |
From: Florian G. <re...@us...> - 2007-12-17 20:49:50
|
Update of /cvsroot/perfparse/_perfparse/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21824/modules Modified Files: storage_mysql.c Log Message: replace macro with function should make code make better to debug - and probably even smaller. Index: storage_mysql.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/modules/storage_mysql.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** storage_mysql.c 15 Dec 2007 23:30:56 -0000 1.19 --- storage_mysql.c 17 Dec 2007 20:49:53 -0000 1.20 *************** *** 420,424 **** ! t_raw_policyinfo *raw_policyinfo=NULL; g_string_printf(s_SQL,"SELECT service_id,service_description,host_id,policy_name,delete_policy_seconds,raw_delete_policy_individual FROM perfdata_service s LEFT JOIN perfdata_delete_policy d ON s.raw_delete_policy_id=d.policy_id"); --- 420,424 ---- ! t_policyinfo *raw_policyinfo=NULL; g_string_printf(s_SQL,"SELECT service_id,service_description,host_id,policy_name,delete_policy_seconds,raw_delete_policy_individual FROM perfdata_service s LEFT JOIN perfdata_delete_policy d ON s.raw_delete_policy_id=d.policy_id"); *************** *** 426,430 **** while ((result_row = mysql_fetch_row(query_result))) { ! raw_policyinfo = (t_raw_policyinfo *)malloc(sizeof(t_raw_policyinfo)); raw_policyinfo->iPolicySource=DEL_POLICY_SOURCE_NONE; raw_policyinfo->iServiceId = iData(0); --- 426,430 ---- while ((result_row = mysql_fetch_row(query_result))) { ! raw_policyinfo = (t_policyinfo *)malloc(sizeof(t_policyinfo)); raw_policyinfo->iPolicySource=DEL_POLICY_SOURCE_NONE; raw_policyinfo->iServiceId = iData(0); *************** *** 448,452 **** while(tmplist2) { ! raw_policyinfo=(t_raw_policyinfo *) tmplist2->data; if(raw_policyinfo->iPolicySource==DEL_POLICY_SOURCE_NONE) { // get policy info from host or hostgroup getRawHostPolicy(raw_policyinfo); --- 448,452 ---- while(tmplist2) { ! raw_policyinfo=(t_policyinfo *) tmplist2->data; if(raw_policyinfo->iPolicySource==DEL_POLICY_SOURCE_NONE) { // get policy info from host or hostgroup getRawHostPolicy(raw_policyinfo); *************** *** 462,466 **** if(raw_policyinfo->iPolicySeconds>1) { dps=t-raw_policyinfo->iPolicySeconds; ! pp_log(__FILE__,__LINE__,LOG_INFO,_("Purging raw data older than %s from service %s Id %d due to "), asctime(localtime(&dps)),raw_policyinfo->sServiceDesc, raw_policyinfo->iServiceId); --- 462,466 ---- if(raw_policyinfo->iPolicySeconds>1) { dps=t-raw_policyinfo->iPolicySeconds; ! pp_log(__FILE__,__LINE__,LOG_INFO,_("Purging raw data older than %s from service '%s', ServiceId %d due to "), asctime(localtime(&dps)),raw_policyinfo->sServiceDesc, raw_policyinfo->iServiceId); *************** *** 484,487 **** --- 484,489 ---- pp_log(__FILE__,__LINE__,LOG_INFO,_("group '%s' setting in hostgroup.\n"),raw_policyinfo->sPolicyName); break; + case DEL_POLICY_SOURCE_DEFAULT: + pp_log_fl(LOG_INFO,_("default setting.\n")); default: pp_log(__FILE__,__LINE__,LOG_FATAL,_("This is a error. This line should not be executed.\n")); |
From: Florian G. <re...@us...> - 2007-12-16 22:45:52
|
Update of /cvsroot/perfparse/_perfparse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22333 Modified Files: ChangeLog Log Message: Changelog update Index: ChangeLog =================================================================== RCS file: /cvsroot/perfparse/_perfparse/ChangeLog,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ChangeLog 31 May 2007 14:58:31 -0000 1.18 --- ChangeLog 16 Dec 2007 22:45:52 -0000 1.19 *************** *** 1,3 **** --- 1,4 ---- Version 0.106.2 + Added advanced error log facilities. (FG) Fixed bug where part of the grid is painted on the border. (FG) Corrected bug where perfparsed does not close the client socket. Thanks to Tamas Erdei for the patch. (FG) |
From: Florian G. <re...@us...> - 2007-12-16 22:45:48
|
Update of /cvsroot/perfparse/_perfparse/libpp_common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22333/libpp_common Modified Files: log.c Log Message: Changelog update Index: log.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_common/log.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** log.c 9 Dec 2007 20:40:40 -0000 1.4 --- log.c 16 Dec 2007 22:45:52 -0000 1.5 *************** *** 148,152 **** fd = log_file_fopen(config_get_value_as_string(CONFIG_ITEM_ID_ERROR_LOG), t,config_get_value_as_boolean(CONFIG_ITEM_ID_ERROR_LOG_ROTATE)); if(!fd) fd = stderr; - // todo: add option for log level in config #ifdef LOG_DEBUG_INFORMATION fprintf(fd, "%s [%12s:%-5d Pid: %-6ld log level: %d ] %s\n", log_date, file, line, (long)getpid(), log_level, message); --- 148,151 ---- |
From: Florian G. <re...@us...> - 2007-12-15 23:30:54
|
Update of /cvsroot/perfparse/_perfparse/libpp_mysql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9112/libpp_mysql Modified Files: dbms.c del_policy.c del_policy.h Log Message: advanced logging macros - is it a problem to use C99 Style macros? Index: dbms.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_mysql/dbms.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dbms.c 10 Dec 2007 18:55:09 -0000 1.9 --- dbms.c 15 Dec 2007 23:30:56 -0000 1.10 *************** *** 87,90 **** --- 87,91 ---- double dData(int iCol) { + pp_log_func; if (result_row[iCol] && result_row[iCol][0]) return atof(result_row[iCol]); *************** *** 104,108 **** void libpp_mysql_query(char*file, int line, const char *sql) { ! pp_log(__FILE__,__LINE__,LOG_DEBUG_SQL,"SQL execution: \"%s\"\n", sql); freeResult(); --- 105,109 ---- void libpp_mysql_query(char*file, int line, const char *sql) { ! pp_log_func; pp_log(__FILE__,__LINE__,LOG_DEBUG_SQL,"SQL execution: \"%s\"\n", sql); freeResult(); *************** *** 123,126 **** --- 124,128 ---- int libpp_mysql_query_int(char*file, int line, const char *sql) { + pp_log_func; int iRet; MYSQL_ROW row; *************** *** 149,152 **** --- 151,155 ---- const char *libpp_mysql_query_char(char*file, int line, const char *sql) { + pp_log_func; static char *sRet = NULL; MYSQL_RES *result; *************** *** 178,181 **** --- 181,185 ---- void libpp_mysql_query_no_return(char*file, int line, const char *sql) { + pp_log_func; MYSQL_RES *discaud; *************** *** 204,207 **** --- 208,212 ---- void freeResult(void) { + pp_log_func; if (query_result) { mysql_free_result(query_result); *************** *** 214,217 **** --- 219,223 ---- int rows(void) { + pp_log_func; if (query_result) return mysql_num_rows(query_result); *************** *** 222,225 **** --- 228,232 ---- int now_connect(int bTerminate) { + pp_log_func; if(NULL == sql_failure) sql_failure = pp_mysql_default_sql_failure; if (!mysql_init (&db_mysql)) { *************** *** 265,268 **** --- 272,276 ---- char* getRegistry(const char*host, const char*key, time_t *tm) { + pp_log_func; char *value=NULL; g_string_printf(s_SQL, "SELECT rvalue,ctime from perfdata_registry WHERE host = '%s' ", sql_escape(host,PERCENT_ESCAPE_CHAR)); Index: del_policy.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_mysql/del_policy.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** del_policy.c 13 Dec 2007 22:25:18 -0000 1.6 --- del_policy.c 15 Dec 2007 23:30:56 -0000 1.7 *************** *** 55,59 **** int isPolicyDefined(char *sPolicyName) { ! g_string_printf(s_SQL, "SELECT COUNT(*) FROM perfdata_delete_policy WHERE policy_name = '%s'", --- 55,59 ---- int isPolicyDefined(char *sPolicyName) { ! pp_log_func; g_string_printf(s_SQL, "SELECT COUNT(*) FROM perfdata_delete_policy WHERE policy_name = '%s'", *************** *** 67,71 **** int getPolicy(char *sPolicyName) { ! g_string_printf(s_SQL, "SELECT delete_policy FROM perfdata_delete_policy WHERE policy_name = '%s'", --- 67,71 ---- int getPolicy(char *sPolicyName) { ! pp_log_func; g_string_printf(s_SQL, "SELECT delete_policy FROM perfdata_delete_policy WHERE policy_name = '%s'", *************** *** 86,89 **** --- 86,90 ---- char *pval2sql(int iPolicy) { + pp_log_func; static char sPolicy[10]; *************** *** 98,101 **** --- 99,103 ---- int sql2pval(const char *sPolicy) { + pp_log_func; if (!sPolicy || !strcmp(sPolicy, "NULL") || sPolicy[0] == 0) return -1; *************** *** 107,110 **** --- 109,113 ---- char *ptype2sql(int iType) { + pp_log_func; switch (iType) { case DP_USER: return "'user'"; *************** *** 121,124 **** --- 124,128 ---- int sql2ptype(const char *sIn) { + pp_log_func; if (!strcmp(sIn, "user")) return DP_USER; if (!strcmp(sIn, "host")) return DP_HOST; *************** *** 133,136 **** --- 137,141 ---- void validateDefaultDP() { + pp_log_func; /* Ensure the default policies exist. */ *************** *** 143,153 **** for (s = sDefaultDP[0]; sDefaultDP[i][0]; s = sDefaultDP[++i]) { ! g_string_printf(s_SQL, "SELECT count(*) FROM perfdata_delete_policy WHERE policy_name = '%s'", ! sql_escape(gettext(s),PERCENT_ESCAPE_CHAR)); if (!query_int(s_SQL->str)) { ! g_string_printf(s_SQL, "INSERT perfdata_delete_policy (policy_name, delete_policy) VALUES ('%s',%d)", ! sql_escape(gettext(s),PERCENT_ESCAPE_CHAR), DEFAULT_DELETE_POLICY_DAYS); query_no_return(s_SQL->str); --- 148,158 ---- for (s = sDefaultDP[0]; sDefaultDP[i][0]; s = sDefaultDP[++i]) { ! g_string_printf(s_SQL, "SELECT count(*) FROM perfdata_delete_policy WHERE policy_id = %d", ! i); if (!query_int(s_SQL->str)) { ! g_string_printf(s_SQL, "INSERT INTO perfdata_delete_policy (policy_name, delete_policy_seconds) VALUES ('%s',%d)", ! sql_escape(gettext(s),PERCENT_ESCAPE_CHAR), DEL_POLICY_UNDEFINED); query_no_return(s_SQL->str); *************** *** 162,165 **** --- 167,171 ---- int isDefaultDP(char *sPolicy) { + pp_log_func; /* Is this a dafault policy */ *************** *** 177,184 **** int getDefaultPolicy(int i) { ! g_string_printf(s_SQL, "SELECT delete_policy FROM perfdata_delete_policy WHERE policy_name = '%s'", ! sql_escape(gettext(sDefaultDP[i]),PERCENT_ESCAPE_CHAR)); ! return sql2pval(query_char(s_SQL->str)); } --- 183,192 ---- int getDefaultPolicy(int i) { ! pp_log_func; ! g_string_printf(s_SQL, "SELECT delete_policy FROM perfdata_delete_policy WHERE policy_id = %d", ! i); ! //return sql2pval(query_char(s_SQL->str)); ! return(query_int(s_SQL->str)); } *************** *** 186,199 **** int getDefaultBinPolicy() { ! return getDefaultPolicy(0); } int getDefaultRawPolicy() { ! return getDefaultPolicy(1); } char *getPolicyDesc(int iPolicy) { static char s[20]; --- 194,210 ---- int getDefaultBinPolicy() { ! pp_log_func; ! return getDefaultPolicy(DEFAULT_BIN_POLICY_ID); } int getDefaultRawPolicy() { ! pp_log_func; ! return getDefaultPolicy(DEFAULT_RAW_POLICY_ID); } char *getPolicyDesc(int iPolicy) { + pp_log_func; static char s[20]; *************** *** 218,223 **** void getRawHostPolicy(t_raw_policyinfo *policyinfo) { ! pp_log(__FILE__,__LINE__,LOG_DEBUG_FUNCTION,_("getRawHostPolicy() called")); ! g_string_printf(s_SQL, "SELECT raw_delete_policy_individual,policy_name,delete_policy_seconds FROM perfdata_host h left join perfdata_delete_policy p on h.raw_delete_policy_id=p.policy_id WHERE host_id = '%d'", policyinfo->iHostId); --- 229,234 ---- void getRawHostPolicy(t_raw_policyinfo *policyinfo) { ! pp_log_func; ! g_string_printf(s_SQL, "SELECT raw_delete_policy_individual,policy_name,delete_policy_seconds FROM perfdata_host h left join perfdata_delete_policy p on h.raw_delete_policy_id=p.policy_id WHERE host_id = '%d'", policyinfo->iHostId); *************** *** 240,245 **** void getRawGroupPolicy(t_raw_policyinfo *policyinfo) { ! pp_log(__FILE__,__LINE__,LOG_DEBUG_FUNCTION,_("getRawGroupPolicy() called")); ! g_string_printf(s_SQL,"SELECT g.raw_delete_policy_individual,policy_name,delete_policy_seconds FROM perfdata_host_groups hg, perfdata_groups g left join perfdata_delete_policy p on g.raw_delete_policy_id=p.policy_id WHERE g.group_id=hg.group_id AND hg.host_id = '%d'", policyinfo->iHostId); --- 251,256 ---- void getRawGroupPolicy(t_raw_policyinfo *policyinfo) { ! pp_log_func; ! g_string_printf(s_SQL,"SELECT g.raw_delete_policy_individual,policy_name,delete_policy_seconds FROM perfdata_host_groups hg, perfdata_groups g left join perfdata_delete_policy p on g.raw_delete_policy_id=p.policy_id WHERE g.group_id=hg.group_id AND hg.host_id = '%d'", policyinfo->iHostId); *************** *** 277,280 **** --- 288,292 ---- int getBinHostPolicy(char *sHost) { + pp_log_func; g_string_printf(s_SQL, "SELECT bin_delete_policy FROM perfdata_host WHERE host_name = '%s'", sql_escape(sHost,PERCENT_ESCAPE_CHAR)); *************** *** 286,289 **** --- 298,302 ---- TPolicyList *getPolicyList() { + pp_log_func; static TPolicyList *first = NULL; TPolicyList *p, *prev; *************** *** 319,322 **** --- 332,336 ---- void destroyPolicyList(TPolicyList *first) { + pp_log_func; /* [TODO] */ } Index: del_policy.h =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_mysql/del_policy.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** del_policy.h 13 Dec 2007 22:25:18 -0000 1.4 --- del_policy.h 15 Dec 2007 23:30:56 -0000 1.5 *************** *** 12,15 **** --- 12,18 ---- #define DEL_POLICY_INFINITY -2 + #define DEFAULT_RAW_POLICY_ID 1 + #define DEFAULT_BIN_POLICY_ID 0 + enum { DEL_POLICY_SOURCE_NONE, *************** *** 53,56 **** --- 56,61 ---- char *getPolicyDesc(int iPolicy); void getRawHostPolicy(t_raw_policyinfo *policyinfo); + void getRawGroupPolicy(t_raw_policyinfo *policyinfo); + int getBinHostPolicy(char *sHost); |
From: Florian G. <re...@us...> - 2007-12-15 23:30:54
|
Update of /cvsroot/perfparse/_perfparse/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9112/modules Modified Files: storage_mysql.c Log Message: advanced logging macros - is it a problem to use C99 Style macros? Index: storage_mysql.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/modules/storage_mysql.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** storage_mysql.c 13 Dec 2007 22:25:18 -0000 1.18 --- storage_mysql.c 15 Dec 2007 23:30:56 -0000 1.19 *************** *** 97,101 **** storage_module_t* storage_module_init(void) { ! storage_module_t *sm; --- 97,101 ---- storage_module_t* storage_module_init(void) { ! pp_log_func; storage_module_t *sm; *************** *** 116,119 **** --- 116,120 ---- int storage_mysql_connect(struct storage_module_t *this) { + pp_log_func; if(NULL == this->params) {pp_log(__FILE__,__LINE__,LOG_ERROR,_("Malloc failed")); exit(EXIT_FAILURE); } MYSQL_USER_PARAMS(this->params)->statistics = malloc(sizeof(mysql_statistics_t)); *************** *** 173,176 **** --- 174,178 ---- int storage_mysql_store_line(storage_module_t *this, const log_line_t *log_data) { + pp_log_func; int iHostID, iServiceID; *************** *** 218,221 **** --- 220,224 ---- int storage_mysql_store_perf_values(storage_module_t *this, const log_line_t *log_data, const perf_fields_t *perf_fields, const perf_value_t *perf_value) { + pp_log_func; int iHostID, iServiceID, iMetricID; *************** *** 278,281 **** --- 281,285 ---- int storage_mysql_set_registry(storage_module_t *this, const char*hostname, const char*key, const char*value, time_t tm) { + pp_log_func; pp_log(__FILE__,__LINE__,LOG_DEBUG,"setRegistry: %ld '%s/%s' = '%s'\n", tm,hostname,key,value); *************** *** 288,291 **** --- 292,296 ---- void storage_mysql_atexit(storage_module_t* this) { + pp_log_func; mysql_close(&db_mysql); *************** *** 294,297 **** --- 299,303 ---- void storage_mysql_print_statistics(storage_module_t *this, FILE*fd) { + pp_log_func; MYSQL_USER_PARAMS(this->params)->statistics->iSQLCount = iSQLCount; *************** *** 332,335 **** --- 338,342 ---- void storage_mysql_print_usage(storage_module_t *this, FILE*fd, const char*id) { + pp_log_func; int options[] = { CONFIG_ITEM_ID_DB_USER, *************** *** 357,361 **** void storage_mysql_periodic_cleanup(storage_module_t*this) { ! pp_log(__FILE__,__LINE__,LOG_DEBUG_FUNCTION,"storage_mysql_periodic_cleanup called.\n"); /* delete all data of objects that are marked as deleted */ GSList *tmplist2,*tmplist=NULL; --- 364,368 ---- void storage_mysql_periodic_cleanup(storage_module_t*this) { ! pp_log_func; /* delete all data of objects that are marked as deleted */ GSList *tmplist2,*tmplist=NULL; *************** *** 501,504 **** --- 508,512 ---- void purge_all_metricid_data(int iMid) { + pp_log_func; pp_log(__FILE__,__LINE__,LOG_INFO,"Deleting all data from metric id %d\n",iMid); g_string_printf(s_SQL,"DELETE from perfdata_service_bin WHERE metric_id=%d",iMid); *************** *** 507,510 **** --- 515,519 ---- void purge_all_serviceid_data(int iSid) { + pp_log_func; pp_log(__FILE__,__LINE__,LOG_INFO,"Deleting all data from service id %d\n",iSid); g_string_printf(s_SQL,"DELETE from perfdata_service_raw WHERE service_id=%d",iSid); *************** *** 521,524 **** --- 530,534 ---- static int validate_host(storage_module_t*this, const char *sHost) { + pp_log_func; /* Validate the host exists. If not, create */ *************** *** 564,567 **** --- 574,578 ---- static int validate_service(storage_module_t*this, const char *sHost, const char *sService) { + pp_log_func; /* Validate the service exists. If not, create */ *************** *** 632,635 **** --- 643,647 ---- static int validate_metric(storage_module_t*this, const char *sHost, const char *sService, const char *sMetric, const char *sUnit) { + pp_log_func; /* Validate the metric exists. If not, create */ *************** *** 689,692 **** --- 701,705 ---- static int isSaveBinAllowed(char *sHost, char *sService, char *sMetric) { + pp_log_func; /* Check policy to find out if we are allowed to save this metric */ static int bResult; *************** *** 723,726 **** --- 736,740 ---- static int save_raw_data(storage_module_t*this, const log_line_t *data) { + pp_log_func; static int iAuto; int iServiceID; *************** *** 753,756 **** --- 767,771 ---- static int save_summary_raw_data(storage_module_t*this, const log_line_t *data, int iServiceID) { + pp_log_func; /* first update any existing records only do this if the last update time is smaller than ctime *************** *** 805,808 **** --- 820,824 ---- void save_bin_data(storage_module_t*this, const log_line_t *data, const perf_value_t *perf, const perf_fields_t *perf_fields, int iHostID, int iServiceID, int iMetricID) { + pp_log_func; int iAuto = 0; *************** *** 853,856 **** --- 869,873 ---- static const char *getSafeD(double d) { + pp_log_func; static char sOut[25]; *************** *** 884,887 **** --- 901,905 ---- void populateSummaryList() { + pp_log_func; TSummaryList *summary, *tail = NULL; *************** *** 914,917 **** --- 932,936 ---- static int save_summary_data(storage_module_t *this, const log_line_t *data, const perf_value_t *perf, const perf_fields_t *perf_fields, int iMetricID) { + pp_log_func; TSummaryList *summary; *************** *** 935,938 **** --- 954,958 ---- static int save_summary_data_nested(storage_module_t *this, const log_line_t *data, const perf_value_t *perf, const perf_fields_t *perf_fields, int iMetricID, int iFrequency) { + pp_log_func; time_t tSample; *************** *** 1004,1007 **** --- 1024,1028 ---- static int validate_summary(storage_module_t *this, int iMetricID, int iFrequency, int iDefaultDelete) { + pp_log_func; /* Validate the summary data is correct. */ |
From: Florian G. <re...@us...> - 2007-12-15 23:30:53
|
Update of /cvsroot/perfparse/_perfparse/perfparse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9112/perfparse Modified Files: perfparsed.c Log Message: advanced logging macros - is it a problem to use C99 Style macros? Index: perfparsed.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/perfparse/perfparsed.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** perfparsed.c 14 Dec 2007 21:42:17 -0000 1.9 --- perfparsed.c 15 Dec 2007 23:30:56 -0000 1.10 *************** *** 53,56 **** --- 53,57 ---- void daemonize (const char*lock_file) { + pp_log_func; int i; int fd; *************** *** 58,62 **** pid_t pid,sid; ! pp_log(__FILE__,__LINE__,LOG_DEBUG,_("daemonize: about to fork\n")); pid = fork (); if (pid < 0) --- 59,63 ---- pid_t pid,sid; ! pp_log_fl(LOG_DEBUG,_("daemonize: about to fork\n")); pid = fork (); if (pid < 0) |
From: Florian G. <re...@us...> - 2007-12-15 23:30:53
|
Update of /cvsroot/perfparse/_perfparse/libpp_common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9112/libpp_common Modified Files: libpp_common.h Log Message: advanced logging macros - is it a problem to use C99 Style macros? Index: libpp_common.h =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_common/libpp_common.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** libpp_common.h 10 Dec 2007 18:55:09 -0000 1.8 --- libpp_common.h 15 Dec 2007 23:30:56 -0000 1.9 *************** *** 72,75 **** --- 72,88 ---- extern int pp_log_count; + // make function name makro work + #if __STDC_VERSION__ < 199901L + # if __GNUC__ >= 2 + # define __func__ __FUNCTION__ + # else + # define __func__ "<unknown>" + # endif + #endif + + + #define pp_log_fl(...) pp_log(__FILE__,__LINE__,__VA_ARGS__) + #define pp_log_func pp_log(__FILE__,__LINE__,LOG_DEBUG_FUNCTION,_("Function %s called"),__func__) + /* compress_file() returns 0 when OK, * -1 if pb in the original file, |
From: Florian G. <re...@us...> - 2007-12-14 21:42:14
|
Update of /cvsroot/perfparse/_perfparse/perfparse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1160/perfparse Modified Files: perfparsed.c storage.c Log Message: fixed some small memleaks and logging Index: perfparsed.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/perfparse/perfparsed.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** perfparsed.c 9 Dec 2007 20:40:40 -0000 1.8 --- perfparsed.c 14 Dec 2007 21:42:17 -0000 1.9 *************** *** 78,82 **** } ! for (i = getdtablesize (); i >= 0; --i) close (i); --- 78,82 ---- } ! for (i = getdtablesize()-1; i >= 0; --i) close (i); Index: storage.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/perfparse/storage.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** storage.c 8 Dec 2007 21:25:30 -0000 1.7 --- storage.c 14 Dec 2007 21:42:17 -0000 1.8 *************** *** 138,141 **** --- 138,142 ---- n=0; for(sm=storage_modules; sm; sm = sm->next) n++; + free(modules_list); return(n); } *************** *** 285,298 **** } /* Module periodic_cleanup procedures */ for(this=storage_modules; this; this = this->next) { - pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of storage modules\n")); if(this->module->enabled && this->module->periodic_cleanup) { ! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of storage module %s\n")); ! this->module->periodic_cleanup(this->module);} ! else { pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of storage module %s not supported or module disabled\n"),this->module->id); } } ! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup finished\n"),this->module->id); if(config_get_value_as_boolean(CONFIG_ITEM_ID_DAEMONIZE)) { exit(EXIT_SUCCESS); --- 286,300 ---- } /* Module periodic_cleanup procedures */ + pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of storage modules\n")); for(this=storage_modules; this; this = this->next) { if(this->module->enabled && this->module->periodic_cleanup) { ! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of storage module %s\n"),this->module->id); ! this->module->periodic_cleanup(this->module); ! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of storage module %s finished\n"),this->module->id); ! }else { pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of storage module %s not supported or module disabled\n"),this->module->id); } } ! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of storage modules finished\n")); if(config_get_value_as_boolean(CONFIG_ITEM_ID_DAEMONIZE)) { exit(EXIT_SUCCESS); |
From: Florian G. <re...@us...> - 2007-12-14 21:42:14
|
Update of /cvsroot/perfparse/_perfparse/libpp_common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1160/libpp_common Modified Files: config_file.c Log Message: fixed some small memleaks and logging Index: config_file.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_common/config_file.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** config_file.c 9 Dec 2007 20:40:40 -0000 1.5 --- config_file.c 14 Dec 2007 21:42:17 -0000 1.6 *************** *** 54,57 **** --- 54,58 ---- char *my_gethostname(void) { + pp_log(__FILE__,__LINE__,LOG_DEBUG_FUNCTION,_("my_gethostname() called\n")); char *s=NULL; #if defined (OS_SOLARIS) *************** *** 246,249 **** --- 247,251 ---- fclose(f); regfree(pattern); + free(pattern); } |
From: Florian G. <re...@us...> - 2007-12-13 22:25:19
|
Update of /cvsroot/perfparse/_perfparse/doc/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17528/doc/database Modified Files: database_schema_v20.odp Log Message: more work on delete policies Index: database_schema_v20.odp =================================================================== RCS file: /cvsroot/perfparse/_perfparse/doc/database/database_schema_v20.odp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 Binary files /tmp/cvspk9Ebk and /tmp/cvstJzM2X differ |
From: Florian G. <re...@us...> - 2007-12-13 22:25:19
|
Update of /cvsroot/perfparse/_perfparse/libpp_mysql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17528/libpp_mysql Modified Files: del_policy.c del_policy.h Log Message: more work on delete policies Index: del_policy.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_mysql/del_policy.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** del_policy.c 10 Dec 2007 18:55:09 -0000 1.5 --- del_policy.c 13 Dec 2007 22:25:18 -0000 1.6 *************** *** 225,239 **** query(s_SQL->str); result_row = mysql_fetch_row(query_result); ! if(isNull(0) && isNull(2)) { ! getRawGroupPolicy(policyinfo); ! } else { ! policyinfo->iRawDelPolicy=iData(0); policyinfo->sPolicyName=strdup(sData(1)); policyinfo->iPolicySeconds=iData(2); ! // TODO: policyinfo->iPolicySource= } } int getBinHostPolicy(char *sHost) { --- 225,278 ---- query(s_SQL->str); result_row = mysql_fetch_row(query_result); ! if(!isNull(0)) { ! policyinfo->iPolicySeconds=iData(0); ! policyinfo->iPolicySource=DEL_POLICY_SOURCE_HOST; ! } else if (!isNull(2)) { policyinfo->sPolicyName=strdup(sData(1)); policyinfo->iPolicySeconds=iData(2); ! policyinfo->iPolicySource=DEL_POLICY_SOURCE_HOST_GROUP; ! } else { ! getRawGroupPolicy(policyinfo); } } + void getRawGroupPolicy(t_raw_policyinfo *policyinfo) + { + pp_log(__FILE__,__LINE__,LOG_DEBUG_FUNCTION,_("getRawGroupPolicy() called")); + + g_string_printf(s_SQL,"SELECT g.raw_delete_policy_individual,policy_name,delete_policy_seconds FROM perfdata_host_groups hg, perfdata_groups g left join perfdata_delete_policy p on g.raw_delete_policy_id=p.policy_id WHERE g.group_id=hg.group_id AND hg.host_id = '%d'", + policyinfo->iHostId); + query(s_SQL->str); + + //walk through all groups and if more than one match find the maximum + int maxdel=DEL_POLICY_UNDEFINED; + + while(result_row = mysql_fetch_row(query_result)) { + if(!isNull(0)) { // individual settings before group settings + if(iData(0)>maxdel || iData(0)==DEL_POLICY_INFINITY) { + maxdel=iData(0); + policyinfo->iPolicySeconds=iData(0); + policyinfo->iPolicySource=DEL_POLICY_SOURCE_HOSTGROUP; + // shall we store the group name somewhere? no. not yet. + } + } else if (!isNull(2)) { + if(iData(2)>maxdel || iData(2)==DEL_POLICY_INFINITY) { + maxdel=iData(2); + policyinfo->iPolicySeconds=iData(2); + policyinfo->sPolicyName=strdup(sData(1)); + policyinfo->iPolicySource=DEL_POLICY_SOURCE_HOSTGROUP_GROUP; + // shall we store the group name somewhere? no. not yet. + } + } + + if(maxdel==DEL_POLICY_INFINITY) { + break; // bail out to avoid overwriting infinity + } + + } + + } + int getBinHostPolicy(char *sHost) { Index: del_policy.h =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_mysql/del_policy.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** del_policy.h 10 Dec 2007 18:55:09 -0000 1.3 --- del_policy.h 13 Dec 2007 22:25:18 -0000 1.4 *************** *** 13,16 **** --- 13,17 ---- enum { + DEL_POLICY_SOURCE_NONE, DEL_POLICY_SOURCE_METRIC, DEL_POLICY_SOURCE_METRIC_GROUP, *************** *** 37,41 **** int iPolicySource; int iPolicySeconds; - int iRawDelPolicy; } t_raw_policyinfo; --- 38,41 ---- |
From: Florian G. <re...@us...> - 2007-12-13 22:25:19
|
Update of /cvsroot/perfparse/_perfparse/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17528/modules Modified Files: storage_mysql.c Log Message: more work on delete policies Index: storage_mysql.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/modules/storage_mysql.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** storage_mysql.c 10 Dec 2007 18:55:09 -0000 1.17 --- storage_mysql.c 13 Dec 2007 22:25:18 -0000 1.18 *************** *** 361,364 **** --- 361,367 ---- GSList *tmplist2,*tmplist=NULL; int *p=NULL; + time_t dps=DEL_POLICY_UNDEFINED; + time_t t=time(NULL); + // connect again to mysql since this is a forked process *************** *** 417,450 **** while ((result_row = mysql_fetch_row(query_result))) { raw_policyinfo = (t_raw_policyinfo *)malloc(sizeof(t_raw_policyinfo)); raw_policyinfo->iServiceId = iData(0); raw_policyinfo->sServiceDesc=strdup(sData(1)); raw_policyinfo->iHostId=iData(2); - // todo: check if this policy matches and if not search for matching parent policy raw_policyinfo->sPolicyName=strdup(sData(3)); ! if(isNull(4)){ ! raw_policyinfo->iPolicySeconds=DEL_POLICY_UNDEFINED; ! } else { raw_policyinfo->iPolicySeconds=iData(4); } ! if(isNull(5)) { ! raw_policyinfo->iRawDelPolicy=DEL_POLICY_UNDEFINED; ! } else { ! raw_policyinfo->iRawDelPolicy=iData(5); ! } ! pp_log(__FILE__,__LINE__,LOG_DEBUG,"service_id %d policy info (%s,%d,%s,%d,%d) added to temporary list\n" ! ,raw_policyinfo->iServiceId,raw_policyinfo->sServiceDesc, ! raw_policyinfo->iHostId,raw_policyinfo->sPolicyName, ! raw_policyinfo->iPolicySeconds,raw_policyinfo->iRawDelPolicy); tmplist=g_slist_append(tmplist,raw_policyinfo); } tmplist2=tmplist; while(tmplist2) { raw_policyinfo=(t_raw_policyinfo *) tmplist2->data; ! if(raw_policyinfo->iRawDelPolicy==DEL_POLICY_UNDEFINED && ! raw_policyinfo->iPolicySeconds==DEL_POLICY_UNDEFINED) { getRawHostPolicy(raw_policyinfo); } //todo: now purge data } --- 420,490 ---- while ((result_row = mysql_fetch_row(query_result))) { raw_policyinfo = (t_raw_policyinfo *)malloc(sizeof(t_raw_policyinfo)); + raw_policyinfo->iPolicySource=DEL_POLICY_SOURCE_NONE; raw_policyinfo->iServiceId = iData(0); raw_policyinfo->sServiceDesc=strdup(sData(1)); raw_policyinfo->iHostId=iData(2); raw_policyinfo->sPolicyName=strdup(sData(3)); ! raw_policyinfo->iPolicySeconds=DEL_POLICY_UNDEFINED; ! ! if(!isNull(5)) { ! raw_policyinfo->iPolicySeconds=iData(5); ! raw_policyinfo->iPolicySource=DEL_POLICY_SOURCE_SERVICE; ! } else if (!isNull(4)){ raw_policyinfo->iPolicySeconds=iData(4); + raw_policyinfo->iPolicySource=DEL_POLICY_SOURCE_SERVICE_GROUP; } ! tmplist=g_slist_append(tmplist,raw_policyinfo); } tmplist2=tmplist; + while(tmplist2) { raw_policyinfo=(t_raw_policyinfo *) tmplist2->data; ! if(raw_policyinfo->iPolicySource==DEL_POLICY_SOURCE_NONE) { // get policy info from host or hostgroup getRawHostPolicy(raw_policyinfo); } + + pp_log(__FILE__,__LINE__,LOG_DEBUG,"service_id %d raw policy info (ServiceDesc: %s,HostId: %d, PolicyName: %s, PolicySeconds: %d, PolicySource: %d) in temporary list\n" + ,raw_policyinfo->iServiceId,raw_policyinfo->sServiceDesc, + raw_policyinfo->iHostId,raw_policyinfo->sPolicyName, + raw_policyinfo->iPolicySeconds, + raw_policyinfo->iPolicySource); //todo: now purge data + + if(raw_policyinfo->iPolicySeconds>1) { + dps=t-raw_policyinfo->iPolicySeconds; + pp_log(__FILE__,__LINE__,LOG_INFO,_("Purging raw data older than %s from service %s Id %d due to "), + asctime(localtime(&dps)),raw_policyinfo->sServiceDesc, + raw_policyinfo->iServiceId); + switch(raw_policyinfo->iPolicySource) { + case DEL_POLICY_SOURCE_SERVICE: + pp_log(__FILE__,__LINE__,LOG_INFO,_("individual service setting\n")); + break; + case DEL_POLICY_SOURCE_HOST: + pp_log(__FILE__,__LINE__,LOG_INFO,_("individual host setting\n")); + break; + case DEL_POLICY_SOURCE_HOSTGROUP: + pp_log(__FILE__,__LINE__,LOG_INFO,_("individual hostgroup setting\n")); + break; + case DEL_POLICY_SOURCE_SERVICE_GROUP: + pp_log(__FILE__,__LINE__,LOG_INFO,_("group '%s' setting in service.\n"),raw_policyinfo->sPolicyName); + break; + case DEL_POLICY_SOURCE_HOST_GROUP: + pp_log(__FILE__,__LINE__,LOG_INFO,_("group '%s' setting in host.\n"),raw_policyinfo->sPolicyName); + break; + case DEL_POLICY_SOURCE_HOSTGROUP_GROUP: + pp_log(__FILE__,__LINE__,LOG_INFO,_("group '%s' setting in hostgroup.\n"),raw_policyinfo->sPolicyName); + break; + default: + pp_log(__FILE__,__LINE__,LOG_FATAL,_("This is a error. This line should not be executed.\n")); + } + + + g_string_printf(s_SQL,"DELETE FROM perfdata_service_raw WHERE service_id=%d and ctime < %d", + raw_policyinfo->iServiceId,(int) dps); + query(s_SQL->str); + } + tmplist2=g_slist_next(tmplist2); } |
From: Florian G. <re...@us...> - 2007-12-10 18:55:21
|
Update of /cvsroot/perfparse/_perfparse/libpp_common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2944/libpp_common Modified Files: libpp_common.h Log Message: some more work on purging data Index: libpp_common.h =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_common/libpp_common.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** libpp_common.h 9 Dec 2007 20:40:40 -0000 1.7 --- libpp_common.h 10 Dec 2007 18:55:09 -0000 1.8 *************** *** 54,58 **** #define LOG_DEBUG 4096 ! #define LOG_DEBUG7 2048 #define LOG_DEBUG6 1024 #define LOG_DEBUG5 256 --- 54,58 ---- #define LOG_DEBUG 4096 ! #define LOG_DEBUG_FUNCTION 2048 #define LOG_DEBUG6 1024 #define LOG_DEBUG5 256 |
From: Florian G. <re...@us...> - 2007-12-10 18:55:21
|
Update of /cvsroot/perfparse/_perfparse/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2944/modules Modified Files: storage_mysql.c storage_mysql.h Log Message: some more work on purging data Index: storage_mysql.h =================================================================== RCS file: /cvsroot/perfparse/_perfparse/modules/storage_mysql.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** storage_mysql.h 9 Dec 2007 20:40:40 -0000 1.6 --- storage_mysql.h 10 Dec 2007 18:55:09 -0000 1.7 *************** *** 33,39 **** #define STORAGE_MYSQL_VERSION "0.0.2" - #define DEL_POLICY_UNDEFINED -1 - #define DEL_POLICY_INFINITY -2 - int storage_mysql_init(void); --- 33,36 ---- Index: storage_mysql.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/modules/storage_mysql.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** storage_mysql.c 9 Dec 2007 20:40:40 -0000 1.16 --- storage_mysql.c 10 Dec 2007 18:55:09 -0000 1.17 *************** *** 35,39 **** #include "common.h" #include "dbms.h" ! #include "storage_mysql.h" #include <config.h> --- 35,39 ---- #include "common.h" #include "dbms.h" ! #include "del_policy.h" #include "storage_mysql.h" #include <config.h> *************** *** 357,360 **** --- 357,361 ---- void storage_mysql_periodic_cleanup(storage_module_t*this) { + pp_log(__FILE__,__LINE__,LOG_DEBUG_FUNCTION,"storage_mysql_periodic_cleanup called.\n"); /* delete all data of objects that are marked as deleted */ GSList *tmplist2,*tmplist=NULL; *************** *** 363,367 **** // connect again to mysql since this is a forked process now_connect(TRUE); ! pp_log(__FILE__,__LINE__,LOG_DEBUG,"MySQL version: %s\n", query_char("SELECT VERSION()")); // find metric ids to delete completely --- 364,368 ---- // connect again to mysql since this is a forked process now_connect(TRUE); ! pp_log(__FILE__,__LINE__,LOG_DEBUG_SQL,"MySQL version: %s\n", query_char("SELECT VERSION()")); // find metric ids to delete completely *************** *** 408,422 **** /* walk through all services and metrics and purge old data */ ! // raw data ! typedef struct t_raw_policyinfo { ! int iServiceId; ! char *sServiceDesc; ! int iHostId; ! char *sPolicyName; ! int iPolicySource; ! int iPolicySeconds; ! int iRawDelPolicy; ! } t_raw_policyinfo; ! t_raw_policyinfo *raw_policyinfo=NULL; --- 409,413 ---- /* walk through all services and metrics and purge old data */ ! t_raw_policyinfo *raw_policyinfo=NULL; *************** *** 427,436 **** raw_policyinfo = (t_raw_policyinfo *)malloc(sizeof(t_raw_policyinfo)); raw_policyinfo->iServiceId = iData(0); ! raw_policyinfo->sServiceDesc=malloc(strlen(sData(1))+sizeof(char)); ! strncpy(raw_policyinfo->sServiceDesc,sData(1),strlen(sData(1))+1); raw_policyinfo->iHostId=iData(2); // todo: check if this policy matches and if not search for matching parent policy ! raw_policyinfo->sPolicyName=malloc(strlen(sData(3))+sizeof(char)); ! strncpy(raw_policyinfo->sPolicyName,sData(3),strlen(sData(3))+1); if(isNull(4)){ raw_policyinfo->iPolicySeconds=DEL_POLICY_UNDEFINED; --- 418,425 ---- raw_policyinfo = (t_raw_policyinfo *)malloc(sizeof(t_raw_policyinfo)); raw_policyinfo->iServiceId = iData(0); ! raw_policyinfo->sServiceDesc=strdup(sData(1)); raw_policyinfo->iHostId=iData(2); // todo: check if this policy matches and if not search for matching parent policy ! raw_policyinfo->sPolicyName=strdup(sData(3)); if(isNull(4)){ raw_policyinfo->iPolicySeconds=DEL_POLICY_UNDEFINED; *************** *** 449,452 **** --- 438,451 ---- tmplist=g_slist_append(tmplist,raw_policyinfo); } + + tmplist2=tmplist; + while(tmplist2) { + raw_policyinfo=(t_raw_policyinfo *) tmplist2->data; + if(raw_policyinfo->iRawDelPolicy==DEL_POLICY_UNDEFINED && + raw_policyinfo->iPolicySeconds==DEL_POLICY_UNDEFINED) { + getRawHostPolicy(raw_policyinfo); + } + //todo: now purge data + } |
From: Florian G. <re...@us...> - 2007-12-10 18:55:12
|
Update of /cvsroot/perfparse/_perfparse/libpp_postgresql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2944/libpp_postgresql Modified Files: del_policy.c Log Message: some more work on purging data Index: del_policy.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_postgresql/del_policy.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** del_policy.c 26 Sep 2005 14:36:33 -0000 1.1.1.1 --- del_policy.c 10 Dec 2007 18:55:09 -0000 1.2 *************** *** 346,355 **** ! int getRawHostPolicy(char *sHost) { ! g_string_printf(s_SQL, "SELECT raw_delete_policy FROM perfdata_host WHERE host_name = '%s'", ! sql_escape(sHost,PERCENT_ESCAPE_CHAR)); ! ! return sql2pval(query_char(s_SQL->str)); } --- 346,358 ---- ! void getRawHostPolicy(t_raw_policyinfo *policyinfo) { ! pp_log(__FILE__,__LINE__,LOG_DEBUG_FUNCTION,_("getRawHostPolicy() called")); ! ! g_string_printf(s_SQL, "SELECT raw_delete_policy_individual,policy_name,delete_policy_seconds FROM perfdata_host h left join perfdata_delete_policy p on h.raw_delete_policy_id=p.policy_id WHERE host_id = '%d'", ! policyinfo->iHostId); ! ! query(s_SQL->str); ! } *************** *** 400,405 **** { /* [TODO] */ ! } ! ! ! --- 403,405 ---- { /* [TODO] */ ! } |
From: Florian G. <re...@us...> - 2007-12-10 18:55:12
|
Update of /cvsroot/perfparse/_perfparse/libpp_mysql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2944/libpp_mysql Modified Files: dbms.c del_policy.c del_policy.h Log Message: some more work on purging data Index: dbms.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_mysql/dbms.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dbms.c 8 Dec 2007 21:25:30 -0000 1.8 --- dbms.c 10 Dec 2007 18:55:09 -0000 1.9 *************** *** 105,109 **** { ! pp_log(__FILE__,__LINE__,LOG_DEBUG,"SQL execution: \"%s\"\n", sql); freeResult(); --- 105,109 ---- { ! pp_log(__FILE__,__LINE__,LOG_DEBUG_SQL,"SQL execution: \"%s\"\n", sql); freeResult(); *************** *** 116,120 **** ! pp_log(__FILE__,__LINE__,LOG_DEBUG,"Rows: %d\n", rows()); iSQLCount++; --- 116,120 ---- ! pp_log(__FILE__,__LINE__,LOG_DEBUG_SQL,"Rows: %d\n", rows()); iSQLCount++; *************** *** 127,135 **** MYSQL_RES *result; ! #ifdef SHOW_SQL ! printf("SQL: \"%s\"\n", sql); ! fflush(stdout); ! #endif ! if (mysql_query(&db_mysql, sql)) sql_failure(file, line, sql, mysql_error(&db_mysql)); --- 127,132 ---- MYSQL_RES *result; ! pp_log(__FILE__,__LINE__,LOG_DEBUG_SQL,"SQL execution: \"%s\"\n", sql); ! if (mysql_query(&db_mysql, sql)) sql_failure(file, line, sql, mysql_error(&db_mysql)); *************** *** 156,160 **** MYSQL_ROW row; ! pp_log(__FILE__,__LINE__,LOG_DEBUG,"SQL: \"%s\"\n", sql); if (sRet) free(sRet); --- 153,157 ---- MYSQL_ROW row; ! pp_log(__FILE__,__LINE__,LOG_DEBUG_SQL,"SQL execution: \"%s\"\n", sql); if (sRet) free(sRet); *************** *** 183,190 **** MYSQL_RES *discaud; ! #ifdef SHOW_SQL ! printf("SQL: \"%s\"\n", sql); ! fflush(stdout); ! #endif if (mysql_query(&db_mysql, sql)) --- 180,184 ---- MYSQL_RES *discaud; ! pp_log(__FILE__,__LINE__,LOG_DEBUG_SQL,"SQL execution: \"%s\"\n", sql); if (mysql_query(&db_mysql, sql)) *************** *** 247,271 **** config_get_value_as_string(CONFIG_ITEM_ID_DB_SOCKET), 0)) { ! #ifdef SHOW_SQL ! g_string_printf(s_SQL, "Could not connect to MySQL using: Database = '%s', Host = '%s', Username = '%s', Password = '%s', Port = '%d', Socket = '%s'", ! config_get_value_as_string(CONFIG_ITEM_ID_DB_DATABASE), ! config_get_value_as_string(CONFIG_ITEM_ID_DB_HOST), ! config_get_value_as_string(CONFIG_ITEM_ID_DB_USER), ! config_get_value_as_string(CONFIG_ITEM_ID_DB_PWD), ! config_get_value_as_integer(CONFIG_ITEM_ID_DB_PORT), ! config_get_value_as_string(CONFIG_ITEM_ID_DB_SOCKET)); ! #else ! g_string_printf(s_SQL, "Could not connect to MySQL using: Database = '%s', Host = '%s', Username = '%s', Port = '%d', Socket = '%s'", config_get_value_as_string(CONFIG_ITEM_ID_DB_DATABASE), config_get_value_as_string(CONFIG_ITEM_ID_DB_HOST), config_get_value_as_string(CONFIG_ITEM_ID_DB_USER), ! config_get_value_as_integer(CONFIG_ITEM_ID_DB_PORT), ! config_get_value_as_string(CONFIG_ITEM_ID_DB_SOCKET)); ! #endif mysql_close(&db_mysql); if (bTerminate) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, "Error %s: %s", s_SQL->str, mysql_error(&db_mysql)); sql_failure(__FILE__, __LINE__, s_SQL->str, mysql_error(&db_mysql)); exit(EXIT_FAILURE); --- 241,255 ---- config_get_value_as_string(CONFIG_ITEM_ID_DB_SOCKET), 0)) { ! pp_log(__FILE__,__LINE__,LOG_ERROR,_("Could not connect to MySQL using: Database = '%s', Host = '%s', Username = '%s', Port = '%d', Socket = '%s'"), config_get_value_as_string(CONFIG_ITEM_ID_DB_DATABASE), config_get_value_as_string(CONFIG_ITEM_ID_DB_HOST), config_get_value_as_string(CONFIG_ITEM_ID_DB_USER), ! config_get_value_as_integer(CONFIG_ITEM_ID_DB_PORT), ! config_get_value_as_string(CONFIG_ITEM_ID_DB_SOCKET)); mysql_close(&db_mysql); if (bTerminate) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Error %s: %s"), s_SQL->str, mysql_error(&db_mysql)); sql_failure(__FILE__, __LINE__, s_SQL->str, mysql_error(&db_mysql)); exit(EXIT_FAILURE); Index: del_policy.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_mysql/del_policy.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** del_policy.c 26 Nov 2007 00:54:09 -0000 1.4 --- del_policy.c 10 Dec 2007 18:55:09 -0000 1.5 *************** *** 215,224 **** - int getRawHostPolicy(char *sHost) - { - g_string_printf(s_SQL, "SELECT raw_delete_policy FROM perfdata_host WHERE host_name = '%s'", - sql_escape(sHost,PERCENT_ESCAPE_CHAR)); ! return sql2pval(query_char(s_SQL->str)); } --- 215,237 ---- ! void getRawHostPolicy(t_raw_policyinfo *policyinfo) ! { ! pp_log(__FILE__,__LINE__,LOG_DEBUG_FUNCTION,_("getRawHostPolicy() called")); ! ! g_string_printf(s_SQL, "SELECT raw_delete_policy_individual,policy_name,delete_policy_seconds FROM perfdata_host h left join perfdata_delete_policy p on h.raw_delete_policy_id=p.policy_id WHERE host_id = '%d'", ! policyinfo->iHostId); ! ! query(s_SQL->str); ! result_row = mysql_fetch_row(query_result); ! if(isNull(0) && isNull(2)) { ! getRawGroupPolicy(policyinfo); ! } else { ! policyinfo->iRawDelPolicy=iData(0); ! policyinfo->sPolicyName=strdup(sData(1)); ! policyinfo->iPolicySeconds=iData(2); ! // TODO: policyinfo->iPolicySource= ! } ! } Index: del_policy.h =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_mysql/del_policy.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** del_policy.h 26 Nov 2007 00:54:09 -0000 1.2 --- del_policy.h 10 Dec 2007 18:55:09 -0000 1.3 *************** *** 9,12 **** --- 9,25 ---- #define DEFAULT_DELETE_POLICY_DAYS 30 + #define DEL_POLICY_UNDEFINED -1 + #define DEL_POLICY_INFINITY -2 + + enum { + DEL_POLICY_SOURCE_METRIC, + DEL_POLICY_SOURCE_METRIC_GROUP, + DEL_POLICY_SOURCE_SERVICE, + DEL_POLICY_SOURCE_SERVICE_GROUP, + DEL_POLICY_SOURCE_HOST, + DEL_POLICY_SOURCE_HOST_GROUP, + DEL_POLICY_SOURCE_HOSTGROUP, + DEL_POLICY_SOURCE_HOSTGROUP_GROUP}; + typedef struct { char *sName; *************** *** 16,19 **** --- 29,44 ---- + // raw del policy info + typedef struct t_raw_policyinfo { + int iServiceId; + char *sServiceDesc; + int iHostId; + char *sPolicyName; + int iPolicySource; + int iPolicySeconds; + int iRawDelPolicy; + } t_raw_policyinfo; + + /* Working with perfdata_delete_policy records */ int isPolicyDefined(char *sPolicyName); *************** *** 27,31 **** char *getPolicyDesc(int iPolicy); ! int getRawHostPolicy(char *sHost); int getBinHostPolicy(char *sHost); --- 52,56 ---- char *getPolicyDesc(int iPolicy); ! void getRawHostPolicy(t_raw_policyinfo *policyinfo); int getBinHostPolicy(char *sHost); |
From: Florian G. <re...@us...> - 2007-12-09 20:40:43
|
Update of /cvsroot/perfparse/_perfparse/libpp_common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7457/libpp_common Modified Files: config_file.c libpp_common.h log.c Log Message: Add error log level and more purging data. Index: log.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_common/log.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** log.c 6 Jun 2007 09:53:14 -0000 1.3 --- log.c 9 Dec 2007 20:40:40 -0000 1.4 *************** *** 67,72 **** ! int pp_log (char *file, int line, int severity, char *fmt, ...) { va_list args; char message[LOG_MESSAGE_LENGTH]; --- 67,77 ---- ! int pp_log (char *file, int line, int log_level, char *fmt, ...) { + + if((log_level&config_get_value_as_integer(CONFIG_ITEM_ID_ERROR_LOG_LEVEL))==0) { + return; + } + va_list args; char message[LOG_MESSAGE_LENGTH]; *************** *** 83,86 **** --- 88,92 ---- pp_log_count++; + va_start (args, fmt); for (p = fmt; (p[0] != '\0') && (message_pos < LOG_MESSAGE_LENGTH); p++) *************** *** 142,148 **** fd = log_file_fopen(config_get_value_as_string(CONFIG_ITEM_ID_ERROR_LOG), t,config_get_value_as_boolean(CONFIG_ITEM_ID_ERROR_LOG_ROTATE)); if(!fd) fd = stderr; ! // todo: add option for severity in config #ifdef LOG_DEBUG_INFORMATION ! fprintf(fd, "%s [%12s:%-5d Pid: %-6ld severity: %d ] %s\n", log_date, file, line, (long)getpid(), severity, message); #else fprintf(fd, "%s [pid %-6ld] %s\n", log_date, (long)getpid(), message); --- 148,154 ---- fd = log_file_fopen(config_get_value_as_string(CONFIG_ITEM_ID_ERROR_LOG), t,config_get_value_as_boolean(CONFIG_ITEM_ID_ERROR_LOG_ROTATE)); if(!fd) fd = stderr; ! // todo: add option for log level in config #ifdef LOG_DEBUG_INFORMATION ! fprintf(fd, "%s [%12s:%-5d Pid: %-6ld log level: %d ] %s\n", log_date, file, line, (long)getpid(), log_level, message); #else fprintf(fd, "%s [pid %-6ld] %s\n", log_date, (long)getpid(), message); *************** *** 152,154 **** return (0); } - --- 158,159 ---- Index: libpp_common.h =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_common/libpp_common.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** libpp_common.h 6 Jun 2007 09:53:14 -0000 1.6 --- libpp_common.h 9 Dec 2007 20:40:40 -0000 1.7 *************** *** 53,59 **** #define CONFIG_FILE "perfparse.cfg" ! #define LOG_DEBUG 10 ! #define LOG_INFO 4 ! #define LOG_WARNING 3 #define LOG_ERROR 2 #define LOG_CRITICAL 1 --- 53,66 ---- #define CONFIG_FILE "perfparse.cfg" ! #define LOG_DEBUG 4096 ! #define LOG_DEBUG7 2048 ! #define LOG_DEBUG6 1024 ! #define LOG_DEBUG5 256 ! #define LOG_DEBUG_SQL 128 ! #define LOG_DEBUG3 64 ! #define LOG_DEBUG2 32 ! #define LOG_DEBUG1 16 ! #define LOG_INFO 8 ! #define LOG_WARNING 4 #define LOG_ERROR 2 #define LOG_CRITICAL 1 *************** *** 79,82 **** --- 86,90 ---- CONFIG_ITEM_ID_CONFIG_FILE, CONFIG_ITEM_ID_ERROR_LOG, + CONFIG_ITEM_ID_ERROR_LOG_LEVEL, CONFIG_ITEM_ID_ERROR_LOG_ROTATE, CONFIG_ITEM_ID_ERROR_LOG_KEEP_N_DAYS, Index: config_file.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_common/config_file.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** config_file.c 9 Apr 2007 22:39:09 -0000 1.4 --- config_file.c 9 Dec 2007 20:40:40 -0000 1.5 *************** *** 107,110 **** --- 107,111 ---- config_item_add(config_definition, CONFIG_ITEM_ID_CONFIG_FILE, "Config_File", "/" SYSCONFDIR "/" CONFIG_FILE , _("Config file"), _("File for Perfparse configuration"), "-c", "--config-file", TYPE_STRING, 0); config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG, "Error_Log", default_error_log, _("Perfparse log"), _("File where Perfparse logs messages"), "-e", "--error-log", TYPE_STRING, 1); + config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG_LEVEL, "Error_Log_Level", "255", _("Perfparse log level"), _("Error log level"), NULL, "--error-log-level", TYPE_INT, 1); config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG_ROTATE, "Error_Log_Rotate", "yes", _("Perfparse log rotate"), _("Rotate Perfparse log files"), NULL, NULL,TYPE_BOOLEAN, 1); config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG_KEEP_N_DAYS, "Error_Log_Keep_N_Days", "7", _("Keep N days of error log"), _("Keep N days of error log. Compress recent logs and remove too old ones"), NULL, NULL,TYPE_INT, 1); |
From: Florian G. <re...@us...> - 2007-12-09 20:40:40
|
Update of /cvsroot/perfparse/_perfparse/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7457/config Modified Files: perfparse.cfg.example Log Message: Add error log level and more purging data. Index: perfparse.cfg.example =================================================================== RCS file: /cvsroot/perfparse/_perfparse/config/perfparse.cfg.example,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** perfparse.cfg.example 28 Sep 2007 21:53:16 -0000 1.3 --- perfparse.cfg.example 9 Dec 2007 20:40:40 -0000 1.4 *************** *** 36,39 **** --- 36,41 ---- # Error handling : Error_Log = "perfparse.log" + # Error Log Level is a sum of bits: Fatal:1, Error:2, Warning:4, Info:8, Debug:16, several debug levels: 32,64,128,.... + Error_Log_Level = "255" Error_Log_Rotate = "Yes" Error_Log_Keep_N_Days = "7" |
From: Florian G. <re...@us...> - 2007-12-09 20:40:39
|
Update of /cvsroot/perfparse/_perfparse/perfparse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7457/perfparse Modified Files: perfparsed.c Log Message: Add error log level and more purging data. Index: perfparsed.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/perfparse/perfparsed.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** perfparsed.c 28 Sep 2007 21:53:16 -0000 1.7 --- perfparsed.c 9 Dec 2007 20:40:40 -0000 1.8 *************** *** 53,61 **** void daemonize (const char*lock_file) { - int pid; int i; int fd; char str[12]; pid = fork (); if (pid < 0) --- 53,62 ---- void daemonize (const char*lock_file) { int i; int fd; char str[12]; + pid_t pid,sid; + pp_log(__FILE__,__LINE__,LOG_DEBUG,_("daemonize: about to fork\n")); pid = fork (); if (pid < 0) *************** *** 66,84 **** if (pid > 0) { exit (EXIT_SUCCESS); } ! setsid (); ! ! pid = fork (); ! if (pid < 0) ! { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("daemonize failed (fork problem : errno=%d msg=%s)"),errno,strerror(errno)); exit(EXIT_FAILURE); } - if (pid > 0) - { - exit (EXIT_SUCCESS); - } for (i = getdtablesize (); i >= 0; --i) --- 67,80 ---- if (pid > 0) { + pp_log(__FILE__,__LINE__,LOG_DEBUG,_("daemonize: fork succeeded. Parent process exiting\n")); exit (EXIT_SUCCESS); } ! pp_log(__FILE__,__LINE__,LOG_DEBUG,_("daemonize: fork succeeded. Child process PID: %d\n"),getpid()); ! sid=setsid (); ! if(sid<0) { ! pp_log(__FILE__,__LINE__,LOG_FATAL,_("daemonize: problem creating a new session for daemon process\n")); exit(EXIT_FAILURE); } for (i = getdtablesize (); i >= 0; --i) *************** *** 96,101 **** fd = open (lock_file, O_RDWR | O_CREAT, 0640); ! if (fd < 0) exit (EXIT_FAILURE); if (lockf (fd, F_TLOCK, 0) < 0) { char tmp[20]; --- 92,99 ---- fd = open (lock_file, O_RDWR | O_CREAT, 0640); ! if (fd < 0) { ! pp_log(__FILE__,__LINE__,LOG_ERROR,_("daemonize: cannot create lockfile %s\n"),lock_file); exit (EXIT_FAILURE); + } if (lockf (fd, F_TLOCK, 0) < 0) { char tmp[20]; *************** *** 115,118 **** --- 113,117 ---- exit (EXIT_SUCCESS); } + snprintf (str, 12, "%ld\n", (long)getpid ()); write (fd, str, strlen (str)); *************** *** 205,212 **** service_log_source = config_get_value_as_string(CONFIG_ITEM_ID_SERVICE_LOG); if(service_log_source[0] && (0 > (open_log_source(service_log_source)))) { ! pp_log(__FILE__,__LINE__,LOG_ERROR,_("Could not open log source ('%s') configured in Service_Log"),service_log_source); exit(EXIT_FAILURE); } if((config_get_value_as_integer(CONFIG_ITEM_ID_SERVER_PORT) > 0) && (0 > log_source_new_server(config_get_value_as_integer(CONFIG_ITEM_ID_SERVER_PORT)))) { exit(EXIT_FAILURE); } --- 204,212 ---- service_log_source = config_get_value_as_string(CONFIG_ITEM_ID_SERVICE_LOG); if(service_log_source[0] && (0 > (open_log_source(service_log_source)))) { ! pp_log(__FILE__,__LINE__,LOG_ERROR,_("Could not open log source ('%s') configured in Service_Log"),service_log_source); exit(EXIT_FAILURE); } if((config_get_value_as_integer(CONFIG_ITEM_ID_SERVER_PORT) > 0) && (0 > log_source_new_server(config_get_value_as_integer(CONFIG_ITEM_ID_SERVER_PORT)))) { + pp_log(__FILE__,__LINE__,LOG_ERROR,_("Could not create perfparse server\n")); exit(EXIT_FAILURE); } |
From: Florian G. <re...@us...> - 2007-12-09 20:40:38
|
Update of /cvsroot/perfparse/_perfparse/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7457/modules Modified Files: storage_mysql.c storage_mysql.h Log Message: Add error log level and more purging data. Index: storage_mysql.h =================================================================== RCS file: /cvsroot/perfparse/_perfparse/modules/storage_mysql.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** storage_mysql.h 4 Sep 2007 07:51:42 -0000 1.5 --- storage_mysql.h 9 Dec 2007 20:40:40 -0000 1.6 *************** *** 33,36 **** --- 33,39 ---- #define STORAGE_MYSQL_VERSION "0.0.2" + #define DEL_POLICY_UNDEFINED -1 + #define DEL_POLICY_INFINITY -2 + int storage_mysql_init(void); Index: storage_mysql.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/modules/storage_mysql.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** storage_mysql.c 8 Dec 2007 21:25:30 -0000 1.15 --- storage_mysql.c 9 Dec 2007 20:40:40 -0000 1.16 *************** *** 409,421 **** // raw data ! typedef struct struct_sid_policyinfo { int iServiceId; int iHostId; ! char sPolicyName[21]; int iPolicySeconds; ! int iRawDelPolicy} sid_policyinfo; ! g_string_printf(s_SQL,"SELECT service_id,host_id,policy_name,delete_policy_seconds,raw_delete_policy_individual FROM perfdata_service s LEFT JOIN perfdata_delete_policy d ON s.raw_delete_policy_id=d.policy_id"); pp_log(__FILE__,__LINE__,LOG_DEBUG,"Closing mysql connection\n"); mysql_close(&db_mysql); --- 409,454 ---- // raw data ! typedef struct t_raw_policyinfo { int iServiceId; + char *sServiceDesc; int iHostId; ! char *sPolicyName; ! int iPolicySource; int iPolicySeconds; ! int iRawDelPolicy; ! } t_raw_policyinfo; ! t_raw_policyinfo *raw_policyinfo=NULL; ! ! g_string_printf(s_SQL,"SELECT service_id,service_description,host_id,policy_name,delete_policy_seconds,raw_delete_policy_individual FROM perfdata_service s LEFT JOIN perfdata_delete_policy d ON s.raw_delete_policy_id=d.policy_id"); ! query(s_SQL->str); ! ! while ((result_row = mysql_fetch_row(query_result))) { ! raw_policyinfo = (t_raw_policyinfo *)malloc(sizeof(t_raw_policyinfo)); ! raw_policyinfo->iServiceId = iData(0); ! raw_policyinfo->sServiceDesc=malloc(strlen(sData(1))+sizeof(char)); ! strncpy(raw_policyinfo->sServiceDesc,sData(1),strlen(sData(1))+1); ! raw_policyinfo->iHostId=iData(2); ! // todo: check if this policy matches and if not search for matching parent policy ! raw_policyinfo->sPolicyName=malloc(strlen(sData(3))+sizeof(char)); ! strncpy(raw_policyinfo->sPolicyName,sData(3),strlen(sData(3))+1); ! if(isNull(4)){ ! raw_policyinfo->iPolicySeconds=DEL_POLICY_UNDEFINED; ! } else { ! raw_policyinfo->iPolicySeconds=iData(4); ! } ! if(isNull(5)) { ! raw_policyinfo->iRawDelPolicy=DEL_POLICY_UNDEFINED; ! } else { ! raw_policyinfo->iRawDelPolicy=iData(5); ! } ! pp_log(__FILE__,__LINE__,LOG_DEBUG,"service_id %d policy info (%s,%d,%s,%d,%d) added to temporary list\n" ! ,raw_policyinfo->iServiceId,raw_policyinfo->sServiceDesc, ! raw_policyinfo->iHostId,raw_policyinfo->sPolicyName, ! raw_policyinfo->iPolicySeconds,raw_policyinfo->iRawDelPolicy); ! tmplist=g_slist_append(tmplist,raw_policyinfo); ! } + pp_log(__FILE__,__LINE__,LOG_DEBUG,"Closing mysql connection\n"); mysql_close(&db_mysql); |