From: Florian G. <re...@us...> - 2008-02-19 22:25:10
|
Update of /cvsroot/perfparse/_perfparse/perfparse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9255/perfparse Modified Files: storage.c Log Message: prepare for more gentle sql error handling Index: storage.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/perfparse/storage.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** storage.c 13 Feb 2008 22:50:32 -0000 1.10 --- storage.c 19 Feb 2008 22:25:14 -0000 1.11 *************** *** 3,7 **** * storage.c - Parse Nagios data and store in relational database. * ! * Copyright (c) 2004-2007 Yves Mettier (yme...@li...) * Florian Gleixner * --- 3,7 ---- * storage.c - Parse Nagios data and store in relational database. * ! * Copyright (c) 2004-2008 Yves Mettier (yme...@li...) * Florian Gleixner * *************** *** 193,197 **** int r = this->module->store_line(this->module,log_line); if(0 != r) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Could not store a line with storage module '%s' (check permissions, connection parameters...)"), this->module->id); #ifdef PERFPARSED exit(EXIT_FAILURE); --- 193,197 ---- int r = this->module->store_line(this->module,log_line); if(0 != r) { ! pp_log_fl(LOG_ERROR, _("Could not store a line with storage module '%s' (check permissions, connection parameters...)"), this->module->id); #ifdef PERFPARSED exit(EXIT_FAILURE); *************** *** 233,237 **** } #ifdef PERFPARSED ! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed stopped\n")); #endif } --- 233,237 ---- } #ifdef PERFPARSED ! pp_log_fl(LOG_INFO, _("Perfparsed stopped\n")); #endif } *************** *** 261,264 **** --- 261,265 ---- #ifdef PERFPARSED int storage_periodic_cleanup(void) { + pp_log_func; storage_module_element_t *this; long h; *************** *** 282,286 **** switch(pid = fork()) { case -1: ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Perfparsed : periodic cleanup cannot start (fork failed)\n")); break; case 0: --- 283,287 ---- switch(pid = fork()) { case -1: ! pp_log_fl(LOG_ERROR, _("Perfparsed : periodic cleanup cannot start (fork failed)\n")); break; case 0: *************** *** 291,295 **** } } ! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup\n")); if(config_get_value_as_boolean(CONFIG_ITEM_ID_ERROR_LOG_ROTATE)) { /* Error log */ --- 292,296 ---- } } ! pp_log_fl(LOG_INFO, _("Perfparsed : periodic cleanup\n")); if(config_get_value_as_boolean(CONFIG_ITEM_ID_ERROR_LOG_ROTATE)) { /* Error log */ *************** *** 297,301 **** dir = g_path_get_dirname(config_get_value_as_string(CONFIG_ITEM_ID_ERROR_LOG)); pattern = g_path_get_basename(config_get_value_as_string(CONFIG_ITEM_ID_ERROR_LOG)); ! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of errorlog\n")); check_dir_for_files_to_remove_or_compress(config_get_value_as_integer(CONFIG_ITEM_ID_ERROR_LOG_KEEP_N_DAYS),dir,pattern); g_free(dir); --- 298,302 ---- dir = g_path_get_dirname(config_get_value_as_string(CONFIG_ITEM_ID_ERROR_LOG)); pattern = g_path_get_basename(config_get_value_as_string(CONFIG_ITEM_ID_ERROR_LOG)); ! pp_log_fl(LOG_INFO, _("Perfparsed : periodic cleanup of errorlog\n")); check_dir_for_files_to_remove_or_compress(config_get_value_as_integer(CONFIG_ITEM_ID_ERROR_LOG_KEEP_N_DAYS),dir,pattern); g_free(dir); *************** *** 304,322 **** if(config_get_value_as_boolean(CONFIG_ITEM_ID_DROP_FILE_ROTATE)) { /* Drop file */ ! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup of dropfile\n")); check_dir_for_files_to_remove_or_compress(config_get_value_as_integer(CONFIG_ITEM_ID_DROP_FILE_KEEP_N_DAYS),config_get_value_as_string(CONFIG_ITEM_ID_DROP_FILE),NULL); } /* 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); --- 305,323 ---- if(config_get_value_as_boolean(CONFIG_ITEM_ID_DROP_FILE_ROTATE)) { /* Drop file */ ! pp_log_fl(LOG_INFO, _("Perfparsed : periodic cleanup of dropfile\n")); check_dir_for_files_to_remove_or_compress(config_get_value_as_integer(CONFIG_ITEM_ID_DROP_FILE_KEEP_N_DAYS),config_get_value_as_string(CONFIG_ITEM_ID_DROP_FILE),NULL); } /* Module periodic_cleanup procedures */ ! pp_log_fl(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_fl(LOG_INFO, _("Perfparsed : periodic cleanup of storage module %s\n"),this->module->id); this->module->periodic_cleanup(this->module); ! pp_log_fl(LOG_INFO, _("Perfparsed : periodic cleanup of storage module %s finished\n"),this->module->id); }else { ! pp_log_fl(LOG_INFO, _("Perfparsed : periodic cleanup of storage module %s not supported or module disabled\n"),this->module->id); } } ! pp_log_fl(LOG_INFO, _("Perfparsed : periodic cleanup of storage modules finished\n")); if(config_get_value_as_boolean(CONFIG_ITEM_ID_DAEMONIZE)) { exit(EXIT_SUCCESS); *************** *** 333,336 **** --- 334,338 ---- */ void storage_dump_status(void) { + pp_log_func; char*file; FILE*fd; *************** *** 348,352 **** if(NULL == (fd = fopen(file,"w"))) { ! pp_log(__FILE__,__LINE__,LOG_ERROR,_("Could not dump modules status\n")); return; } else { --- 350,354 ---- if(NULL == (fd = fopen(file,"w"))) { ! pp_log_fl(LOG_ERROR,_("Could not dump modules status\n")); return; } else { |