double cpuClock = 0.0;
bool jsonTrace = false;
+char* getinterfaceip()
+{
+ char hostname[256];
+ char *IP;
+ struct hostent *host_entry;
+ int retVal;
+ retVal = gethostname(hostname, sizeof(hostname));
+ if ( retVal == -1 )
+ return NULL;
+ host_entry = gethostbyname(hostname);
+ if ( host_entry == NULL )
+ return NULL;
+ IP = inet_ntoa(*((struct in_addr*) host_entry->h_addr_list[0]));
+ return IP;
+}
+
static int enable_log_change_notify(const char* fileName)
{
#if !(defined(UNIT_TEST) || defined(MODULE_TEST))
if( errno == EAGAIN ) {
} else {
- fprintf( stderr, "### CRIT ### config listener read err: %s\n", strerror( errno ) );
+ printf( "### CRIT ### config listener read err: %s\n", strerror( errno ) );
}
continue;
#endif
if (strstr(podName, "alpha") != NULL) {
metric = "E2TAlpha";
}
+ //Get eth0 interface IP
+ char* host = getinterfaceip();
+ string hostip = host;
sctpParams.prometheusFamily = &BuildCounter()
.Name(metric.c_str())
// Build E2T instance level metrics
buildE2TPrometheusCounters(sctpParams);
- string prometheusPath = sctpParams.prometheusPort + "," + "[::]:" + sctpParams.prometheusPort;
+ string prometheusPath;
+ if (hostip.empty())
+ prometheusPath = sctpParams.prometheusPort + "," + "[::]:" + sctpParams.prometheusPort;
+ else
+ prometheusPath = hostip + ":" + sctpParams.prometheusPort;
+
if (mdclog_level_get() >= MDCLOG_DEBUG) {
mdclog_write(MDCLOG_DEBUG, "Start Prometheus Pull mode on %s", prometheusPath.c_str());
}
continue;
}
mdclog_write(MDCLOG_ERR, "Epoll wait failed, errno = %s", strerror(errno));
+ if(events)
+ {
+ free(events);
+ }
return;
#endif
}
} else if (rmrMessageBuffer.rcvMessage->state != 0) {
mdclog_write(MDCLOG_ERR, "Failed to send RIC_HEALTH_CHECK_RESP, on RMR state = %d ( %s)",
rmrMessageBuffer.rcvMessage->state, translateRmrErrorMessages(rmrMessageBuffer.rcvMessage->state).c_str());
- } else if (loglevel >= MDCLOG_DEBUG && ++counter % 100 == 0) {
+ } else if (loglevel >= MDCLOG_DEBUG && (++counter % 100 == 0)) {
mdclog_write(MDCLOG_DEBUG, "Got %d RIC_HEALTH_CHECK_REQ Request send : OK", counter);
}