Update of /cvsroot/perfparse/_perfparse/perfparse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29306/perfparse Modified Files: log_reader.c perfparse-common.c perfparse-log2any.c perfparsed.c server_parser.c storage.c storage_history.c Log Message: enhance error logging Index: server_parser.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/perfparse/server_parser.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** server_parser.c 23 Dec 2006 00:03:46 -0000 1.2 --- server_parser.c 6 Jun 2007 09:53:14 -0000 1.3 *************** *** 3,7 **** * server_parser.c - Parse Nagios data and store in relational database. * ! * Copyright (c) 2004 Yves Mettier (yme...@li...) * $Id$ * --- 3,9 ---- * server_parser.c - Parse Nagios data and store in relational database. * ! * Copyright (c) 2004-2007 Yves Mettier (yme...@li...) ! * Florian Gleixner ! * * $Id$ * *************** *** 222,226 **** if(tm_start <= 0) tm_start += tm_end; switch((pid=fork())) { ! case -1: pp_log(__FILE__,__LINE__,_("Could not fork")); exit(EXIT_FAILURE); case 0: line = history_get_lines_first(tm_start,tm_end,str[0],str[1],str[2]); --- 224,228 ---- if(tm_start <= 0) tm_start += tm_end; switch((pid=fork())) { ! case -1: pp_log(__FILE__,__LINE__,LOG_ERROR,_("Could not fork")); exit(EXIT_FAILURE); case 0: line = history_get_lines_first(tm_start,tm_end,str[0],str[1],str[2]); Index: perfparsed.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/perfparse/perfparsed.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** perfparsed.c 23 Dec 2006 00:03:46 -0000 1.4 --- perfparsed.c 6 Jun 2007 09:53:14 -0000 1.5 *************** *** 3,7 **** * perfparsed.c - Parse Nagios data and store in relational database. * ! * Copyright (c) 2004 Yves Mettier (yme...@li...) * $Id$ * --- 3,9 ---- * perfparsed.c - Parse Nagios data and store in relational database. * ! * Copyright (c) 2004-2007 Yves Mettier (yme...@li...) ! * Florian Gleixner ! * * $Id$ * *************** *** 59,63 **** if (pid < 0) { ! pp_log(__FILE__,__LINE__, _("daemonize failed (fork problem : errno=%d msg=%s)"),errno,strerror(errno)); exit(EXIT_FAILURE); } --- 61,65 ---- if (pid < 0) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("daemonize failed (fork problem : errno=%d msg=%s)"),errno,strerror(errno)); exit(EXIT_FAILURE); } *************** *** 72,76 **** if (pid < 0) { ! pp_log(__FILE__,__LINE__, _("daemonize failed (fork problem : errno=%d msg=%s)"),errno,strerror(errno)); exit(EXIT_FAILURE); } --- 74,78 ---- if (pid < 0) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("daemonize failed (fork problem : errno=%d msg=%s)"),errno,strerror(errno)); exit(EXIT_FAILURE); } *************** *** 89,93 **** umask (022); if(0 != chdir (LOCALSTATEDIR)) { ! pp_log(__FILE__,__LINE__, _("daemonize failed (could not chdir('%s') : errno=%d msg=%s)"),LOCALSTATEDIR, errno,strerror(errno)); exit(EXIT_FAILURE); } --- 91,95 ---- umask (022); if(0 != chdir (LOCALSTATEDIR)) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("daemonize failed (could not chdir('%s') : errno=%d msg=%s)"),LOCALSTATEDIR, errno,strerror(errno)); exit(EXIT_FAILURE); } *************** *** 107,114 **** pid = strtol(tmp,NULL,10); if((0 == pid) && (EINVAL == errno)) { ! pp_log(__FILE__,__LINE__, _("File '%s' is corrupted"),lock_file); exit (EXIT_FAILURE); } ! pp_log(__FILE__,__LINE__, _("Perfparsed already running with PID %d"),pid); exit (EXIT_SUCCESS); } --- 109,116 ---- pid = strtol(tmp,NULL,10); if((0 == pid) && (EINVAL == errno)) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("File '%s' is corrupted"),lock_file); exit (EXIT_FAILURE); } ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Perfparsed already running with PID %d"),pid); exit (EXIT_SUCCESS); } *************** *** 165,173 **** if(!strcmp(config_get_value_as_string(CONFIG_ITEM_ID_SERVICE_LOG),"-")) { ! pp_log(__FILE__,__LINE__,_("Stdin not authorized as the perf data input source")); exit(EXIT_FAILURE); } if(config_get_value_as_string(CONFIG_ITEM_ID_SERVICE_LOG)[0] == '>') { ! pp_log(__FILE__,__LINE__,_("Client socket not authorized as the perf data input source")); exit(EXIT_FAILURE); } --- 167,175 ---- if(!strcmp(config_get_value_as_string(CONFIG_ITEM_ID_SERVICE_LOG),"-")) { ! pp_log(__FILE__,__LINE__,LOG_ERROR,_("Stdin not authorized as the perf data input source")); exit(EXIT_FAILURE); } if(config_get_value_as_string(CONFIG_ITEM_ID_SERVICE_LOG)[0] == '>') { ! pp_log(__FILE__,__LINE__,LOG_ERROR,_("Client socket not authorized as the perf data input source")); exit(EXIT_FAILURE); } *************** *** 176,184 **** if(config_get_value_as_boolean(CONFIG_ITEM_ID_DAEMONIZE) && (config_option == CONFIG_OPTION_NONE)) { daemonize(config_get_value_as_string(CONFIG_ITEM_ID_DAEMON_LOCK)); ! pp_log(__FILE__,__LINE__, _("Perfparsed successfully daemonized (pid=%ld)"),getpid()); } if(0 == storage_init(NULL)) { ! pp_log(__FILE__,__LINE__,_("No module was loaded. Check the Storage_Module_Load config option.")); exit(EXIT_FAILURE); } --- 178,186 ---- if(config_get_value_as_boolean(CONFIG_ITEM_ID_DAEMONIZE) && (config_option == CONFIG_OPTION_NONE)) { daemonize(config_get_value_as_string(CONFIG_ITEM_ID_DAEMON_LOCK)); ! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed successfully daemonized (pid=%ld)"),getpid()); } if(0 == storage_init(NULL)) { ! pp_log(__FILE__,__LINE__,LOG_WARNING,_("No module was loaded. Check the Storage_Module_Load config option.")); exit(EXIT_FAILURE); } *************** *** 201,205 **** 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__,_("Could not open log source ('%s') configured in Service_Log"),service_log_source); exit(EXIT_FAILURE); } --- 203,207 ---- 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); } *************** *** 243,247 **** break; default : ! pp_log(__FILE__,__LINE__,_("This is a bug. This code should never be executed")); } } --- 245,249 ---- break; default : ! pp_log(__FILE__,__LINE__,LOG_FATAL,_("This is a bug. This code should never be executed")); } } *************** *** 251,255 **** while(0 < waitpid(-1,NULL,WNOHANG)); } ! pp_log(__FILE__,__LINE__,_("This is a bug. This code should never be executed")); close_all_log_sources(); log_reader_remove_signal_handler(); --- 253,257 ---- while(0 < waitpid(-1,NULL,WNOHANG)); } ! pp_log(__FILE__,__LINE__,LOG_FATAL,_("This is a bug. This code should never be executed")); close_all_log_sources(); log_reader_remove_signal_handler(); Index: storage.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/perfparse/storage.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** storage.c 5 Jun 2007 22:46:59 -0000 1.4 --- storage.c 6 Jun 2007 09:53:14 -0000 1.5 *************** *** 3,7 **** * storage.c - Parse Nagios data and store in relational database. * ! * Copyright (c) 2004 Yves Mettier (yme...@li...) * * $Id$ --- 3,8 ---- * storage.c - Parse Nagios data and store in relational database. * ! * Copyright (c) 2004-2007 Yves Mettier (yme...@li...) ! * Florian Gleixner * * $Id$ *************** *** 60,64 **** libpath = g_strdup_printf("%s/libpp_storage_%s." SHLIBEXT,config_get_value_as_string(CONFIG_ITEM_ID_STORAGE_MODULES_DIR),storage_name); if(NULL == (storage_module_handle = dlopen(libpath, RTLD_LAZY))) { ! pp_log(__FILE__,__LINE__, _("storage_%s module failed to load (msg='%s')\n"),storage_name, dlerror()); exit(EXIT_FAILURE); } --- 61,65 ---- libpath = g_strdup_printf("%s/libpp_storage_%s." SHLIBEXT,config_get_value_as_string(CONFIG_ITEM_ID_STORAGE_MODULES_DIR),storage_name); if(NULL == (storage_module_handle = dlopen(libpath, RTLD_LAZY))) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("storage_%s module failed to load (msg='%s')\n"),storage_name, dlerror()); exit(EXIT_FAILURE); } *************** *** 67,71 **** storage_module_init_cb = dlsym(storage_module_handle, "storage_module_init"); if(NULL == storage_module_init_cb) { ! pp_log(__FILE__,__LINE__, _("storage_%s module failed to initialize\n"),storage_name); exit(EXIT_FAILURE); } --- 68,72 ---- storage_module_init_cb = dlsym(storage_module_handle, "storage_module_init"); if(NULL == storage_module_init_cb) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("storage_%s module failed to initialize\n"),storage_name); exit(EXIT_FAILURE); } *************** *** 73,77 **** sm_new = storage_module_init_cb(); if(NULL == sm_new) { ! pp_log(__FILE__,__LINE__, _("storage_%s module failed to initialize itself\n"),storage_name); exit(EXIT_FAILURE); } --- 74,78 ---- sm_new = storage_module_init_cb(); if(NULL == sm_new) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("storage_%s module failed to initialize itself\n"),storage_name); exit(EXIT_FAILURE); } *************** *** 79,83 **** if(NULL == (sme=malloc(sizeof(storage_module_element_t)))) { ! pp_log(__FILE__,__LINE__, _("Not enough memory (malloc failed)\n")); exit(EXIT_FAILURE); } --- 80,84 ---- if(NULL == (sme=malloc(sizeof(storage_module_element_t)))) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Not enough memory (malloc failed)\n")); exit(EXIT_FAILURE); } *************** *** 94,98 **** storage_modules->prev = NULL; } ! pp_log(__FILE__,__LINE__, _("storage_%s module successfully loaded\n"),storage_name); } --- 95,99 ---- storage_modules->prev = NULL; } ! pp_log(__FILE__,__LINE__,LOG_INFO, _("storage_%s module successfully loaded\n"),storage_name); } *************** *** 173,177 **** int r = this->module->store_line(this->module,log_line); if(0 != r) { ! pp_log(__FILE__,__LINE__, _("Could not store a line with storage module '%s' (check permissions, connection parameters...)"), this->module->id); #ifdef PERFPARSED exit(EXIT_FAILURE); --- 174,178 ---- 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); *************** *** 211,215 **** } #ifdef PERFPARSED ! pp_log(__FILE__,__LINE__, _("Perfparsed stopped\n")); #endif } --- 212,216 ---- } #ifdef PERFPARSED ! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed stopped\n")); #endif } *************** *** 258,262 **** switch(pid = fork()) { case -1: ! pp_log(__FILE__,__LINE__, _("Perfparsed : periodic cleanup cannot start (fork failed)\n")); break; case 0: --- 259,263 ---- switch(pid = fork()) { case -1: ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Perfparsed : periodic cleanup cannot start (fork failed)\n")); break; case 0: *************** *** 267,271 **** } } ! pp_log(__FILE__,__LINE__, _("Perfparsed : periodic cleanup\n")); if(config_get_value_as_boolean(CONFIG_ITEM_ID_ERROR_LOG_ROTATE)) { /* Error log */ --- 268,272 ---- } } ! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup\n")); if(config_get_value_as_boolean(CONFIG_ITEM_ID_ERROR_LOG_ROTATE)) { /* Error log */ *************** *** 273,277 **** 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__, _("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); --- 274,278 ---- 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); *************** *** 280,292 **** if(config_get_value_as_boolean(CONFIG_ITEM_ID_DROP_FILE_ROTATE)) { /* Drop file */ ! pp_log(__FILE__,__LINE__, _("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 */ for(this=storage_modules; this; this = this->next) { ! pp_log(__FILE__,__LINE__, _("Perfparsed : periodic cleanup of storage modules\n")); if(this->module->enabled && this->module->periodic_cleanup) this->module->periodic_cleanup(this->module); } ! pp_log(__FILE__,__LINE__, _("Perfparsed : periodic cleanup finished\n")); if(config_get_value_as_boolean(CONFIG_ITEM_ID_DAEMONIZE)) { exit(EXIT_SUCCESS); --- 281,293 ---- 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 */ 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) this->module->periodic_cleanup(this->module); } ! pp_log(__FILE__,__LINE__,LOG_INFO, _("Perfparsed : periodic cleanup finished\n")); if(config_get_value_as_boolean(CONFIG_ITEM_ID_DAEMONIZE)) { exit(EXIT_SUCCESS); *************** *** 318,322 **** if(NULL == (fd = fopen(file,"w"))) { ! pp_log(__FILE__,__LINE__,_("Could not dump modules status\n")); return; } else { --- 319,323 ---- if(NULL == (fd = fopen(file,"w"))) { ! pp_log(__FILE__,__LINE__,LOG_ERROR,_("Could not dump modules status\n")); return; } else { Index: log_reader.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/perfparse/log_reader.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** log_reader.c 13 Mar 2007 21:59:50 -0000 1.5 --- log_reader.c 6 Jun 2007 09:53:14 -0000 1.6 *************** *** 3,7 **** * log_reader.c - Reads Log from file, socket or pipe. * ! * Copyright (c) 2004 Yves Mettier (yme...@li...) * $Id$ * --- 3,9 ---- * log_reader.c - Reads Log from file, socket or pipe. * ! * Copyright (c) 2004-2007 Yves Mettier (yme...@li...) ! * Florian Gleixner ! * * $Id$ * *************** *** 91,99 **** switch(errno) { case EBADF: ! pp_log(__FILE__,__LINE__,_("fd is not a valid file descriptor or is not open for writing.")); exit(EXIT_FAILURE); break; default: ! pp_log(__FILE__,__LINE__,_("Unknown error!")); exit(EXIT_FAILURE); break; --- 93,101 ---- switch(errno) { case EBADF: ! pp_log(__FILE__,__LINE__,LOG_ERROR,_("fd is not a valid file descriptor or is not open for writing.")); exit(EXIT_FAILURE); break; default: ! pp_log(__FILE__,__LINE__,LOG_ERROR,_("Unknown error!")); exit(EXIT_FAILURE); break; *************** *** 179,191 **** config_item_id_service_log_position_mark_path = config_get_value_as_string(CONFIG_ITEM_ID_SERVICE_LOG_POSITION_MARK_PATH); if(!strcmp(config_item_id_service_log_position_mark_path, "")) { ! pp_log(__FILE__,__LINE__, _("No position mark path was specified. Either disable saving the position or specify a mark path.")); exit(EXIT_FAILURE); } if(stat(config_item_id_service_log_position_mark_path, &buf)) { ! pp_log(__FILE__,__LINE__, _("Dir '%s' is not available (errno=%d; msg='%s')"), config_item_id_service_log_position_mark_path, errno, strerror(errno)); return(-1); } if(!(buf.st_mode & S_IFDIR)) { ! pp_log(__FILE__,__LINE__, _("Dir '%s' is not a directory"), config_item_id_service_log_position_mark_path); return(-1); } --- 181,193 ---- config_item_id_service_log_position_mark_path = config_get_value_as_string(CONFIG_ITEM_ID_SERVICE_LOG_POSITION_MARK_PATH); if(!strcmp(config_item_id_service_log_position_mark_path, "")) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("No position mark path was specified. Either disable saving the position or specify a mark path.")); exit(EXIT_FAILURE); } if(stat(config_item_id_service_log_position_mark_path, &buf)) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Dir '%s' is not available (errno=%d; msg='%s')"), config_item_id_service_log_position_mark_path, errno, strerror(errno)); return(-1); } if(!(buf.st_mode & S_IFDIR)) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Dir '%s' is not a directory"), config_item_id_service_log_position_mark_path); return(-1); } *************** *** 198,202 **** fd = fopen(config_item_id_service_log_position_mark_file, "r"); if(NULL == fd) { ! pp_log(__FILE__,__LINE__,_("Could not open '%s'"), config_item_id_service_log_position_mark_file); return(-1); } --- 200,204 ---- fd = fopen(config_item_id_service_log_position_mark_file, "r"); if(NULL == fd) { ! pp_log(__FILE__,__LINE__,LOG_ERROR,_("Could not open '%s'"), config_item_id_service_log_position_mark_file); return(-1); } *************** *** 208,212 **** log_fd[n]->file_pos = -1; fclose(fd); ! pp_log(__FILE__,__LINE__,_("Could not read log file position in '%s'"), config_item_id_service_log_position_mark_file); return(-1); } --- 210,214 ---- log_fd[n]->file_pos = -1; fclose(fd); ! pp_log(__FILE__,__LINE__,LOG_ERROR,_("Could not read log file position in '%s'"), config_item_id_service_log_position_mark_file); return(-1); } *************** *** 219,223 **** log_fd[n]->file_last_line_hash = -1; fclose(fd); ! pp_log(__FILE__,__LINE__,_("Could not read log line hash in '%s'"), config_item_id_service_log_position_mark_file); return(-1); } --- 221,225 ---- log_fd[n]->file_last_line_hash = -1; fclose(fd); ! pp_log(__FILE__,__LINE__,LOG_ERROR,_("Could not read log line hash in '%s'"), config_item_id_service_log_position_mark_file); return(-1); } *************** *** 238,250 **** config_item_id_service_log_position_mark_path = config_get_value_as_string(CONFIG_ITEM_ID_SERVICE_LOG_POSITION_MARK_PATH); if(!strcmp(config_item_id_service_log_position_mark_path, "")) { ! pp_log(__FILE__,__LINE__, _("No position mark path was specified. Either disable saving the position or specify a mark path.")); exit(EXIT_FAILURE); } if(stat(config_item_id_service_log_position_mark_path, &buf)) { ! pp_log(__FILE__,__LINE__, _("Dir '%s' is not available (errno=%d; msg='%s')"), config_item_id_service_log_position_mark_path, errno, strerror(errno)); return(-1); } if(!(buf.st_mode & S_IFDIR)) { ! pp_log(__FILE__,__LINE__, _("Dir '%s' is not a directory"), config_item_id_service_log_position_mark_path); return(-1); } --- 240,252 ---- config_item_id_service_log_position_mark_path = config_get_value_as_string(CONFIG_ITEM_ID_SERVICE_LOG_POSITION_MARK_PATH); if(!strcmp(config_item_id_service_log_position_mark_path, "")) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("No position mark path was specified. Either disable saving the position or specify a mark path.")); exit(EXIT_FAILURE); } if(stat(config_item_id_service_log_position_mark_path, &buf)) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Dir '%s' is not available (errno=%d; msg='%s')"), config_item_id_service_log_position_mark_path, errno, strerror(errno)); return(-1); } if(!(buf.st_mode & S_IFDIR)) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Dir '%s' is not a directory"), config_item_id_service_log_position_mark_path); return(-1); } *************** *** 257,261 **** fd = fopen(config_item_id_service_log_position_mark_file, "w"); if(NULL == fd) { ! pp_log(__FILE__,__LINE__,_("Could not open '%s' for writing"), config_item_id_service_log_position_mark_file); return(-1); } --- 259,263 ---- fd = fopen(config_item_id_service_log_position_mark_file, "w"); if(NULL == fd) { ! pp_log(__FILE__,__LINE__,LOG_ERROR,_("Could not open '%s' for writing"), config_item_id_service_log_position_mark_file); return(-1); } *************** *** 279,287 **** log_fd_len +=5; log_fd = realloc(log_fd, (log_fd_len)*sizeof(log_fd_t*)); ! if(NULL == log_fd) { pp_log(__FILE__,__LINE__, _("Not enough memory")); exit(EXIT_FAILURE); } for(j=i; j<log_fd_len; j++) log_fd[j] = NULL; } log_fd[i] = malloc(sizeof(log_fd_t)); ! if(NULL == log_fd[i]) { pp_log(__FILE__,__LINE__, _("Not enough memory")); exit(EXIT_FAILURE); } log_fd[i]->buffer = g_string_new(""); --- 281,289 ---- log_fd_len +=5; log_fd = realloc(log_fd, (log_fd_len)*sizeof(log_fd_t*)); ! if(NULL == log_fd) { pp_log(__FILE__,__LINE__,LOG_ERROR, _("Not enough memory")); exit(EXIT_FAILURE); } for(j=i; j<log_fd_len; j++) log_fd[j] = NULL; } log_fd[i] = malloc(sizeof(log_fd_t)); ! if(NULL == log_fd[i]) { pp_log(__FILE__,__LINE__,LOG_ERROR, _("Not enough memory")); exit(EXIT_FAILURE); } log_fd[i]->buffer = g_string_new(""); *************** *** 311,315 **** if(NULL == p) { ! pp_log(__FILE__,__LINE__, _("Could not parse host:port server address ('%s')"), filename+1); free(host); return(-1); --- 313,317 ---- if(NULL == p) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Could not parse host:port server address ('%s')"), filename+1); free(host); return(-1); *************** *** 318,322 **** port = strtol(p+1,NULL,10); if(port <= 0) { ! pp_log(__FILE__,__LINE__, _("Could not parse host:port server address ('%s')"), filename+1); free(host); return(-1); --- 320,324 ---- port = strtol(p+1,NULL,10); if(port <= 0) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Could not parse host:port server address ('%s')"), filename+1); free(host); return(-1); *************** *** 327,331 **** if ((address = gethostbyname (host)) == NULL) { ! pp_log(__FILE__,__LINE__, _("Could not find host '%s'."), host); free(host); return(-1); --- 329,333 ---- if ((address = gethostbyname (host)) == NULL) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Could not find host '%s'."), host); free(host); return(-1); *************** *** 338,342 **** if ((log_fd[i]->fd = socket (AF_INET, SOCK_STREAM, 6)) == -1) { ! pp_log(__FILE__,__LINE__, _("Could not create a new socket to host '%s'."), host); free(host); log_fd[i]->fd = -1; --- 340,344 ---- if ((log_fd[i]->fd = socket (AF_INET, SOCK_STREAM, 6)) == -1) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Could not create a new socket to host '%s'."), host); free(host); log_fd[i]->fd = -1; *************** *** 348,352 **** if ((client_sockaddr_in = malloc (sizeof (struct sockaddr_in))) == NULL) { ! pp_log(__FILE__,__LINE__, _("Could not allocate memory for new socket to host '%s'."), host); free(host); log_fd[i]->fd = -1; --- 350,354 ---- if ((client_sockaddr_in = malloc (sizeof (struct sockaddr_in))) == NULL) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Could not allocate memory for new socket to host '%s'."), host); free(host); log_fd[i]->fd = -1; *************** *** 364,368 **** { free (client_sockaddr_in); ! pp_log(__FILE__,__LINE__, _("Could not connect the socket to the server '%s'."), host); free(host); log_fd[i]->fd = -1; --- 366,370 ---- { free (client_sockaddr_in); ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Could not connect the socket to the server '%s'."), host); free(host); log_fd[i]->fd = -1; *************** *** 384,392 **** log_fd[i]->fd = mkfifo(filename+1, 0660); if(0 != log_fd[i]->fd) { ! pp_log(__FILE__,__LINE__, _("Could not create fifo '%s'"), filename+1); return(-1); } } else if(!(buf.st_mode & S_IFIFO)) { ! pp_log(__FILE__,__LINE__, _("'%s' exists and is not a pipe"), filename+1); return(-1); } --- 386,394 ---- log_fd[i]->fd = mkfifo(filename+1, 0660); if(0 != log_fd[i]->fd) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Could not create fifo '%s'"), filename+1); return(-1); } } else if(!(buf.st_mode & S_IFIFO)) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("'%s' exists and is not a pipe"), filename+1); return(-1); } *************** *** 394,398 **** log_fd[i]->fd = open(filename+1, O_RDWR); if(log_fd[i]->fd < 0 ) { ! pp_log(__FILE__,__LINE__, _("Could not open ('%s')"), filename+1); return(-1); } --- 396,400 ---- log_fd[i]->fd = open(filename+1, O_RDWR); if(log_fd[i]->fd < 0 ) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Could not open ('%s')"), filename+1); return(-1); } *************** *** 405,409 **** log_fd[i]->fd = open(filename, O_RDONLY); if(log_fd[i]->fd < 0 ) { ! pp_log(__FILE__,__LINE__, _("Could not open ('%s')"), filename); return(-1); } --- 407,411 ---- log_fd[i]->fd = open(filename, O_RDONLY); if(log_fd[i]->fd < 0 ) { ! pp_log(__FILE__,__LINE__,LOG_ERROR, _("Could not open ('%s')"), filename); return(-1); } *************** *** 426,432 **** lseek(log_fd[i]->fd,0,SEEK_SET); } else { ! #ifdef DEBUG ! pp_log(__FILE__, __LINE__, _("Start reading log file from file pos %d"), log_fd[i]->file_pos); ! #endif } g_string_free(buffer,TRUE); --- 428,432 ---- lseek(log_fd[i]->fd,0,SEEK_SET); } else { ! pp_log(__FILE__, __LINE__,LOG_INFO, _("Start reading log file from file pos %d"), log_fd[i]->file_pos); } g_string_free(buffer,TRUE); *************** *** 459,463 **** if ((log_fd[i]->fd = socket (PF_INET, SOCK_STREAM, 0)) < 0) { ! pp_log (__FILE__, __LINE__, _("Could not create socket")); exit (EXIT_FAILURE); } --- 459,463 ---- if ((log_fd[i]->fd = socket (PF_INET, SOCK_STREAM, 0)) < 0) { ! pp_log (__FILE__, __LINE__,LOG_ERROR, _("Could not create socket")); exit (EXIT_FAILURE); } *************** *** 471,480 **** if (bind (log_fd[i]->fd, (struct sockaddr *) &sockname, sizeof (struct sockaddr_in)) < 0) { ! pp_log (__FILE__, __LINE__, _("Failure on bind()")); exit (EXIT_FAILURE); } if (listen (log_fd[i]->fd, FD_SETSIZE) < 0) { /* Because we use select(), we can not accept more connections than FD_SET_SIZE */ ! pp_log (__FILE__, __LINE__, _("Failure on listen()")); exit (EXIT_FAILURE); } --- 471,480 ---- if (bind (log_fd[i]->fd, (struct sockaddr *) &sockname, sizeof (struct sockaddr_in)) < 0) { ! pp_log (__FILE__, __LINE__,LOG_ERROR, _("Failure on bind()")); exit (EXIT_FAILURE); } if (listen (log_fd[i]->fd, FD_SETSIZE) < 0) { /* Because we use select(), we can not accept more connections than FD_SET_SIZE */ ! pp_log (__FILE__, __LINE__,LOG_ERROR, _("Failure on listen()")); exit (EXIT_FAILURE); } *************** *** 577,581 **** } close_all_log_sources(); ! pp_log(__FILE__,__LINE__, _("Caught signal (%s)"),gettext(sigstr[sigstrid])); exit(EXIT_FAILURE); } --- 577,581 ---- } close_all_log_sources(); ! pp_log(__FILE__,__LINE__,LOG_WARNING, _("Caught signal (%s)"),gettext(sigstr[sigstrid])); exit(EXIT_FAILURE); } Index: storage_history.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/perfparse/storage_history.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** storage_history.c 26 Sep 2005 14:36:33 -0000 1.1.1.1 --- storage_history.c 6 Jun 2007 09:53:14 -0000 1.2 *************** *** 3,8 **** * storage_history.c - Parse Nagios data and store in relational database. * ! * Copyright (c) 2004 Yves Mettier (yme...@li...) ! * Last Modified: 2004-10-27 * * License: --- 3,9 ---- * storage_history.c - Parse Nagios data and store in relational database. * ! * Copyright (c) 2004-2007 Yves Mettier (yme...@li...) ! * Florian Gleixner ! * Last Modified: $Id$ * * License: Index: perfparse-log2any.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/perfparse/perfparse-log2any.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** perfparse-log2any.c 24 Aug 2006 15:27:36 -0000 1.3 --- perfparse-log2any.c 6 Jun 2007 09:53:14 -0000 1.4 *************** *** 3,7 **** * perfparse-log2any.c - Parse Nagios data and store in relational database. * ! * Copyright (c) 2004 Yves Mettier (yme...@li...) * * $Id$ --- 3,8 ---- * perfparse-log2any.c - Parse Nagios data and store in relational database. * ! * Copyright (c) 2004-2007 Yves Mettier (yme...@li...) ! * Florian Gleixner * * $Id$ *************** *** 156,165 **** if(config_get_value_as_string(CONFIG_ITEM_ID_SERVICE_LOG)[0] == '|') { ! pp_log(__FILE__,__LINE__,_("FIFO not authorized as the perf data input source")); exit(EXIT_FAILURE); } if(0 == storage_init(argv[0])) { ! pp_log(__FILE__,__LINE__,_("No module was loaded. Check the Storage_Module_Load config option.")); exit(EXIT_FAILURE); } --- 157,166 ---- if(config_get_value_as_string(CONFIG_ITEM_ID_SERVICE_LOG)[0] == '|') { ! pp_log(__FILE__,__LINE__,LOG_ERROR,_("FIFO not authorized as the perf data input source")); exit(EXIT_FAILURE); } if(0 == storage_init(argv[0])) { ! pp_log(__FILE__,__LINE__,LOG_WARNING,_("No module was loaded. Check the Storage_Module_Load config option.")); exit(EXIT_FAILURE); } Index: perfparse-common.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/perfparse/perfparse-common.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** perfparse-common.c 24 Aug 2006 12:27:25 -0000 1.2 --- perfparse-common.c 6 Jun 2007 09:53:14 -0000 1.3 *************** *** 3,7 **** * perfparse-common.c - Parse Nagios data and store in relational database. * ! * Copyright (c) 2004 Yves Mettier (yme...@li...) * * $Id$ --- 3,8 ---- * perfparse-common.c - Parse Nagios data and store in relational database. * ! * Copyright (c) 2004-2007 Yves Mettier (yme...@li...) ! * Florian Gleixner * * $Id$ |