Changeset 6701
- Timestamp:
- 10/03/08 10:53:39 (2 months ago)
- Location:
- trunk/centstorage
- Files:
-
- 8 modified
-
centstorage (modified) (3 diffs)
-
includes/Conf.h (modified) (3 diffs)
-
modules/recup_perf_datas/insertValInMySQLDataBase.c (modified) (1 diff)
-
modules/recup_perf_datas/interval.c (modified) (1 diff)
-
modules/rrd/interval.c (modified) (1 diff)
-
modules/rrd/interval.h (modified) (1 diff)
-
src/Conf.c (modified) (1 diff)
-
src/centstorage.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/centstorage/centstorage
r6604 r6701 84 84 85 85 prefix=/usr/local/centreon 86 Bin=/usr/local/centreon/bin/centstorage 87 centstorageLogDir=/usr/local/centreon/log 86 Bin=${prefix}/bin/centstorage 87 88 # log directory 89 centstorageLogDir=${prefix}/log 90 centstorageDemLog=${centstorageLogDir}/centstorage.log 91 92 # running (pid file) 88 93 centstorageRunDir=/var/run/centreon 89 #centstorageVarDir=${prefix}/var/90 94 centstorageRunFile=${centstorageRunDir}/centstorage.pid 91 centstorageDemLog=${centstorageLogDir}/centstorage.log 95 96 #lock file 92 97 centstorageLockDir=/var/lock 93 98 centstorageLockFile=centstorage.lock … … 97 102 if [ ! -f $centstorageBin ]; then 98 103 echo "Executable file $centstorageBin not found. Exiting." 99 exit 1100 fi101 102 # Check that centstorage.cfg exists.103 if [ ! -f $centstorageCfgFile ]; then104 echo "Configuration file $centstorageCfgFile not found. Exiting."105 104 exit 1 106 105 fi … … 119 118 echo "Removing centstorage pid file" 120 119 else 120 echo "$centstorageRunFile already running" 121 121 exit 1 122 122 fi -
trunk/centstorage/includes/Conf.h
r6655 r6701 70 70 #define DEFAULT_LOG_LEVEL 0 71 71 72 #define DEFAULT_PID_FILE "/var/run/centreon/centstorage.pid" 73 72 74 #define XPATH_LOG_FILE(root) "/"root"/logging/logFile/text()" 73 75 #define XPATH_LOG_LEVEL(root) "/"root"/logging/level/text()" … … 92 94 #define XPATH_DB_CONF_USER(root) "/"root"/DataBases/confDB/user/text()" 93 95 #define XPATH_DB_CONF_PASS(root) "/"root"/DataBases/confDB/pass/text()" 96 97 #define XPATH_PID_FILE(root) "/"root"/PidFile/text()" 94 98 95 99 /* this structure contains all the value needed to connect a client to a … … 158 162 /* informations about configuration file */ 159 163 char *confFile; 164 char *pidFile; 165 short defPidFile; 160 166 int timeout; 161 167 unsigned short unit; -
trunk/centstorage/modules/recup_perf_datas/insertValInMySQLDataBase.c
r6694 r6701 148 148 } 149 149 150 if (!strncmp( "meta_", svce, 5) )151 { 152 index_id = insertMetaIndexDataMySQL(svce, &mysql, &rped_conf_db_connection,150 if (!strncmp( "meta_", svce, 5) || !strncmp( "qos_", svce, 4)) 151 { 152 index_id = insertMetaIndexDataMySQL(svce, &mysql, (MYSQL **)&rped_conf_db_connection, 153 153 log, confModule->timeRetry); 154 154 if (!index_id) -
trunk/centstorage/modules/recup_perf_datas/interval.c
r6694 r6701 86 86 return selectInterval(type, request, log, timeRetry); 87 87 } 88 else if (!strncmp(" osl_", queryresult[3], 4))88 else if (!strncmp("qos_", queryresult[3], 4)) 89 89 { 90 90 /* second possibility : service_description begins with "osl_" */ -
trunk/centstorage/modules/rrd/interval.c
r6694 r6701 88 88 *conf_db_connection, MOD_NAME); 89 89 } 90 else if (!strncmp(" osl_", queryresult[3], 4))90 else if (!strncmp("qos_", queryresult[3], 4)) 91 91 { 92 /* second possibility : service_description begins with " osl_" */92 /* second possibility : service_description begins with "qos_" */ 93 93 94 94 int oslId = atoi(queryresult[3] + 4); -
trunk/centstorage/modules/rrd/interval.h
r6625 r6701 35 35 #define SELECT_CHECK_INTER_META "SELECT normal_check_interval FROM meta_service WHERE meta_id=" 36 36 #define ERROR_SELECT_INTERVAL "Cannot select interval" 37 #define SELECT_CHECK_INTER_OSL "SELECT normal_check_interval FROM osl WHERE osl_id="37 #define SELECT_CHECK_INTER_OSL "SELECT normal_check_interval FROM qos WHERE qos_id=" 38 38 #define MYSQL_RESULT "mysql_result(MYSQL *) failed" 39 39 -
trunk/centstorage/src/Conf.c
r6625 r6701 240 240 free(tmp); 241 241 242 tmp = getParam(XPATH_PID_FILE(ROOT_ELEMENT), xmlConfContext, doc); 243 conf->pidFile = (tmp ? tmp : DEFAULT_PID_FILE); 244 conf->defPidFile = (tmp ? FALSE : TRUE); 245 242 246 loadBaseConf(xmlConfContext, doc); 243 247 loadBasePerf(xmlConfContext, doc); -
trunk/centstorage/src/centstorage.c
r6625 r6701 61 61 logger("Exit CentStorage"); 62 62 exit(EXIT_FAILURE); 63 } 64 65 void initVal(void) 66 { 67 conf = x_malloc(sizeof(*conf)); 68 conf->confFile = DEFAULT_CONF_FILE; 69 conf->timeout = 0; 70 conf->logs = x_malloc(sizeof(logging_t)); 71 conf->logs->log_file = NULL; 72 conf->logs->log = 0; 73 conf->logs->defLogFile = 1; 74 conf->logs->logFileOpened = 0; 63 75 } 64 76 … … 162 174 int main(int argc, char **argv) 163 175 { 164 int retVal;165 176 char *logging; 166 177 FILE *PID; … … 169 180 mtrace(); 170 181 171 PID = fopen("./centstorage.pid", "w");172 fprintf(PID, "%d", getpid());173 fclose(PID);174 175 182 /* printing welcome message */ 176 183 printf("%s\n\n", WELCOME_MESSAGE); 177 184 178 185 /* values initialisation */ 179 conf = x_malloc(sizeof(*conf)); 180 conf->confFile = DEFAULT_CONF_FILE; 181 182 conf->timeout = 0; 183 184 conf->logs = x_malloc(sizeof(logging_t)); 185 conf->logs->log_file = NULL; 186 conf->logs->log = 0; 187 conf->logs->defLogFile = 1; 188 conf->logs->logFileOpened = 0; 186 initVal(); 189 187 190 188 /* checking arguments */ … … 193 191 194 192 /* loading configuration */ 195 retVal = loadConf(conf->confFile); 196 if (retVal == -1) 193 if (loadConf(conf->confFile) == -1) 197 194 loadDefaultConfiguration(); 195 196 PID = fopen(conf->pidFile, "w"); 197 if (!PID) 198 return -1; 199 fprintf(PID, "%d", getpid()); 200 fclose(PID); 201 if (!conf->defPidFile) 202 free(conf->pidFile); 198 203 199 204 /* opening logging file */ … … 210 215 { 211 216 conf->logs->logFileOpened = 1; 212 if ( logger(CENTSTORAGE_START) == -1)213 fprintf(stderr, "%s.\n", ERROR_INFOS_LOGS);217 if (conf->logs->log) 218 logger(CENTSTORAGE_START); 214 219 } 215 220 } … … 230 235 free(conf->logs->log_file); 231 236 237 unlink(conf->pidFile); 232 238 free(conf->logs); 233 239 free(conf);
