mirror of https://github.com/Icinga/icinga2.git
parent
33cf660c04
commit
0f9d76d40b
|
@ -86,7 +86,7 @@ void CheckerComponent::Start(void)
|
||||||
|
|
||||||
void CheckerComponent::Stop(void)
|
void CheckerComponent::Stop(void)
|
||||||
{
|
{
|
||||||
Log(LogInformation, "checker", "Checker stopped.");
|
Log(LogInformation, "CheckerComponent", "Checker stopped.");
|
||||||
|
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
|
@ -135,7 +135,7 @@ void CheckerComponent::CheckThreadProc(void)
|
||||||
|
|
||||||
if (!forced) {
|
if (!forced) {
|
||||||
if (!checkable->IsReachable(DependencyCheckExecution)) {
|
if (!checkable->IsReachable(DependencyCheckExecution)) {
|
||||||
Log(LogNotice, "icinga", "Skipping check for object '" + checkable->GetName() + "': Dependency failed.");
|
Log(LogNotice, "CheckerComponent", "Skipping check for object '" + checkable->GetName() + "': Dependency failed.");
|
||||||
check = false;
|
check = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,18 +144,18 @@ void CheckerComponent::CheckThreadProc(void)
|
||||||
tie(host, service) = GetHostService(checkable);
|
tie(host, service) = GetHostService(checkable);
|
||||||
|
|
||||||
if (host && !service && (!checkable->GetEnableActiveChecks() || !IcingaApplication::GetInstance()->GetEnableHostChecks())) {
|
if (host && !service && (!checkable->GetEnableActiveChecks() || !IcingaApplication::GetInstance()->GetEnableHostChecks())) {
|
||||||
Log(LogNotice, "checker", "Skipping check for host '" + host->GetName() + "': active host checks are disabled");
|
Log(LogNotice, "CheckerComponent", "Skipping check for host '" + host->GetName() + "': active host checks are disabled");
|
||||||
check = false;
|
check = false;
|
||||||
}
|
}
|
||||||
if (host && service && (!checkable->GetEnableActiveChecks() || !IcingaApplication::GetInstance()->GetEnableServiceChecks())) {
|
if (host && service && (!checkable->GetEnableActiveChecks() || !IcingaApplication::GetInstance()->GetEnableServiceChecks())) {
|
||||||
Log(LogNotice, "checker", "Skipping check for service '" + service->GetName() + "': active service checks are disabled");
|
Log(LogNotice, "CheckerComponent", "Skipping check for service '" + service->GetName() + "': active service checks are disabled");
|
||||||
check = false;
|
check = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TimePeriod::Ptr tp = checkable->GetCheckPeriod();
|
TimePeriod::Ptr tp = checkable->GetCheckPeriod();
|
||||||
|
|
||||||
if (tp && !tp->IsInside(Utility::GetTime())) {
|
if (tp && !tp->IsInside(Utility::GetTime())) {
|
||||||
Log(LogNotice, "checker", "Skipping check for object '" + checkable->GetName() + "': not in check_period");
|
Log(LogNotice, "CheckerComponent", "Skipping check for object '" + checkable->GetName() + "': not in check_period");
|
||||||
check = false;
|
check = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ void CheckerComponent::CheckThreadProc(void)
|
||||||
checkable->SetForceNextCheck(false);
|
checkable->SetForceNextCheck(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(LogDebug, "checker", "Executing check for '" + checkable->GetName() + "'");
|
Log(LogDebug, "CheckerComponent", "Executing check for '" + checkable->GetName() + "'");
|
||||||
|
|
||||||
CheckerComponent::Ptr self = GetSelf();
|
CheckerComponent::Ptr self = GetSelf();
|
||||||
Utility::QueueAsyncCallback(boost::bind(&CheckerComponent::ExecuteCheckHelper, self, checkable));
|
Utility::QueueAsyncCallback(boost::bind(&CheckerComponent::ExecuteCheckHelper, self, checkable));
|
||||||
|
@ -230,7 +230,7 @@ void CheckerComponent::ExecuteCheckHelper(const Checkable::Ptr& checkable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(LogDebug, "checker", "Check finished for object '" + checkable->GetName() + "'");
|
Log(LogDebug, "CheckerComponent", "Check finished for object '" + checkable->GetName() + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckerComponent::ResultTimerHandler(void)
|
void CheckerComponent::ResultTimerHandler(void)
|
||||||
|
@ -244,7 +244,7 @@ void CheckerComponent::ResultTimerHandler(void)
|
||||||
<< (CIB::GetActiveHostChecksStatistics(5) + CIB::GetActiveServiceChecksStatistics(5)) / 5.0;
|
<< (CIB::GetActiveHostChecksStatistics(5) + CIB::GetActiveServiceChecksStatistics(5)) / 5.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(LogNotice, "checker", msgbuf.str());
|
Log(LogNotice, "CheckerComponent", msgbuf.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckerComponent::ObjectHandler(const DynamicObject::Ptr& object)
|
void CheckerComponent::ObjectHandler(const DynamicObject::Ptr& object)
|
||||||
|
|
|
@ -118,7 +118,7 @@ void CheckResultReader::ProcessCheckResultFile(const String& path) const
|
||||||
Host::Ptr host = Host::GetByName(attrs["host_name"]);
|
Host::Ptr host = Host::GetByName(attrs["host_name"]);
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
Log(LogWarning, "compat", "Ignoring checkresult file for host '" + attrs["host_name"] +
|
Log(LogWarning, "CheckResultReader", "Ignoring checkresult file for host '" + attrs["host_name"] +
|
||||||
"': Host does not exist.");
|
"': Host does not exist.");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -127,7 +127,7 @@ void CheckResultReader::ProcessCheckResultFile(const String& path) const
|
||||||
Service::Ptr service = host->GetServiceByShortName(attrs["service_description"]);
|
Service::Ptr service = host->GetServiceByShortName(attrs["service_description"]);
|
||||||
|
|
||||||
if (!service) {
|
if (!service) {
|
||||||
Log(LogWarning, "compat", "Ignoring checkresult file for host '" + attrs["host_name"] +
|
Log(LogWarning, "CheckResultReader", "Ignoring checkresult file for host '" + attrs["host_name"] +
|
||||||
"', service '" + attrs["service_description"] + "': Service does not exist.");
|
"', service '" + attrs["service_description"] + "': Service does not exist.");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -143,7 +143,7 @@ void CheckResultReader::ProcessCheckResultFile(const String& path) const
|
||||||
|
|
||||||
service->ProcessCheckResult(result);
|
service->ProcessCheckResult(result);
|
||||||
|
|
||||||
Log(LogDebug, "compat", "Processed checkresult file for host '" + attrs["host_name"] +
|
Log(LogDebug, "CheckResultReader", "Processed checkresult file for host '" + attrs["host_name"] +
|
||||||
"', service '" + attrs["service_description"] + "'");
|
"', service '" + attrs["service_description"] + "'");
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -321,7 +321,7 @@ void CompatLogger::FlappingHandler(const Checkable::Ptr& checkable, FlappingStat
|
||||||
flapping_state_str = "DISABLED";
|
flapping_state_str = "DISABLED";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log(LogCritical, "compat", "Unknown flapping state: " + Convert::ToString(flapping_state));
|
Log(LogCritical, "CompatLogger", "Unknown flapping state: " + Convert::ToString(flapping_state));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,7 +434,7 @@ void CompatLogger::ReopenFile(bool rotate)
|
||||||
if (rotate) {
|
if (rotate) {
|
||||||
String archiveFile = GetLogDir() + "/archives/icinga-" + Utility::FormatDateTime("%m-%d-%Y-%H", Utility::GetTime()) + ".log";
|
String archiveFile = GetLogDir() + "/archives/icinga-" + Utility::FormatDateTime("%m-%d-%Y-%H", Utility::GetTime()) + ".log";
|
||||||
|
|
||||||
Log(LogNotice, "compat", "Rotating compat log file '" + tempFile + "' -> '" + archiveFile + "'");
|
Log(LogNotice, "CompatLogger", "Rotating compat log file '" + tempFile + "' -> '" + archiveFile + "'");
|
||||||
(void) rename(tempFile.CStr(), archiveFile.CStr());
|
(void) rename(tempFile.CStr(), archiveFile.CStr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -442,7 +442,7 @@ void CompatLogger::ReopenFile(bool rotate)
|
||||||
m_OutputFile.open(tempFile.CStr(), std::ofstream::app);
|
m_OutputFile.open(tempFile.CStr(), std::ofstream::app);
|
||||||
|
|
||||||
if (!m_OutputFile.good()) {
|
if (!m_OutputFile.good()) {
|
||||||
Log(LogWarning, "icinga", "Could not open compat log file '" + tempFile + "' for writing. Log output will be lost.");
|
Log(LogWarning, "CompatLogger", "Could not open compat log file '" + tempFile + "' for writing. Log output will be lost.");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -536,7 +536,7 @@ void CompatLogger::ScheduleNextRotation(void)
|
||||||
|
|
||||||
time_t ts = mktime(&tmthen);
|
time_t ts = mktime(&tmthen);
|
||||||
|
|
||||||
Log(LogNotice, "compat", "Rescheduling rotation timer for compat log '"
|
Log(LogNotice, "CompatLogger", "Rescheduling rotation timer for compat log '"
|
||||||
+ GetName() + "' to '" + Utility::FormatDateTime("%Y/%m/%d %H:%M:%S %z", ts) + "'");
|
+ GetName() + "' to '" + Utility::FormatDateTime("%Y/%m/%d %H:%M:%S %z", ts) + "'");
|
||||||
m_RotationTimer->Reschedule(ts);
|
m_RotationTimer->Reschedule(ts);
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,13 +130,13 @@ void ExternalCommandListener::CommandPipeThread(const String& commandPath)
|
||||||
String command = line;
|
String command = line;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Log(LogInformation, "compat", "Executing external command: " + command);
|
Log(LogInformation, "ExternalCommandListener", "Executing external command: " + command);
|
||||||
|
|
||||||
ExternalCommandProcessor::Execute(command);
|
ExternalCommandProcessor::Execute(command);
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
std::ostringstream msgbuf;
|
std::ostringstream msgbuf;
|
||||||
msgbuf << "External command failed: " << DiagnosticInformation(ex);
|
msgbuf << "External command failed: " << DiagnosticInformation(ex);
|
||||||
Log(LogWarning, "compat", msgbuf.str());
|
Log(LogWarning, "ExternalCommandListener", msgbuf.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -693,7 +693,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
|
||||||
Checkable::Ptr parent = dep->GetParent();
|
Checkable::Ptr parent = dep->GetParent();
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
Log(LogDebug, "compat", "Missing parent for dependency '" + dep->GetName() + "'.");
|
Log(LogDebug, "StatusDataWriter", "Missing parent for dependency '" + dep->GetName() + "'.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -705,7 +705,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
|
||||||
|
|
||||||
if (!child) {
|
if (!child) {
|
||||||
continue;
|
continue;
|
||||||
Log(LogDebug, "compat", "Missing child for dependency '" + dep->GetName() + "'.");
|
Log(LogDebug, "StatusDataWriter", "Missing child for dependency '" + dep->GetName() + "'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Host::Ptr child_host;
|
Host::Ptr child_host;
|
||||||
|
@ -840,5 +840,5 @@ void StatusDataWriter::StatusTimerHandler(void)
|
||||||
<< boost::errinfo_file_name(statuspathtmp));
|
<< boost::errinfo_file_name(statuspathtmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(LogNotice, "compat", "Writing status.dat file took " + Utility::FormatDuration(Utility::GetTime() - start));
|
Log(LogNotice, "StatusDataWriter", "Writing status.dat file took " + Utility::FormatDuration(Utility::GetTime() - start));
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ void IdoMysqlConnection::Pause(void)
|
||||||
|
|
||||||
void IdoMysqlConnection::ExceptionHandler(boost::exception_ptr exp)
|
void IdoMysqlConnection::ExceptionHandler(boost::exception_ptr exp)
|
||||||
{
|
{
|
||||||
Log(LogWarning, "db_ido_mysql", "Exception during database operation: " + DiagnosticInformation(exp));
|
Log(LogWarning, "IdoMysqlConnection", "Exception during database operation: " + DiagnosticInformation(exp));
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_ConnectionMutex);
|
boost::mutex::scoped_lock lock(m_ConnectionMutex);
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ void IdoMysqlConnection::Reconnect(void)
|
||||||
|
|
||||||
std::ostringstream msgbuf;
|
std::ostringstream msgbuf;
|
||||||
msgbuf << "MySQL IDO instance id: " << static_cast<long>(m_InstanceID) << " (schema version: '" + version + "')";
|
msgbuf << "MySQL IDO instance id: " << static_cast<long>(m_InstanceID) << " (schema version: '" + version + "')";
|
||||||
Log(LogInformation, "db_ido_mysql", msgbuf.str());
|
Log(LogInformation, "IdoMysqlConnection", msgbuf.str());
|
||||||
|
|
||||||
/* set session time zone to utc */
|
/* set session time zone to utc */
|
||||||
Query("SET SESSION TIME_ZONE='+00:00'");
|
Query("SET SESSION TIME_ZONE='+00:00'");
|
||||||
|
@ -268,7 +268,7 @@ void IdoMysqlConnection::Reconnect(void)
|
||||||
/* deactivate all deleted configuration objects */
|
/* deactivate all deleted configuration objects */
|
||||||
BOOST_FOREACH(const DbObject::Ptr& dbobj, active_dbobjs) {
|
BOOST_FOREACH(const DbObject::Ptr& dbobj, active_dbobjs) {
|
||||||
if (dbobj->GetObject() == NULL) {
|
if (dbobj->GetObject() == NULL) {
|
||||||
Log(LogNotice, "db_ido", "Deactivate deleted object name1: '" + Convert::ToString(dbobj->GetName1() +
|
Log(LogNotice, "IdoMysqlConnection", "Deactivate deleted object name1: '" + Convert::ToString(dbobj->GetName1() +
|
||||||
"' name2: '" + Convert::ToString(dbobj->GetName2() + "'.")));
|
"' name2: '" + Convert::ToString(dbobj->GetName2() + "'.")));
|
||||||
DeactivateObject(dbobj);
|
DeactivateObject(dbobj);
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ IdoMysqlResult IdoMysqlConnection::Query(const String& query)
|
||||||
{
|
{
|
||||||
AssertOnWorkQueue();
|
AssertOnWorkQueue();
|
||||||
|
|
||||||
Log(LogDebug, "db_ido_mysql", "Query: " + query);
|
Log(LogDebug, "IdoMysqlConnection", "Query: " + query);
|
||||||
|
|
||||||
if (mysql_query(&m_Connection, query.CStr()) != 0)
|
if (mysql_query(&m_Connection, query.CStr()) != 0)
|
||||||
BOOST_THROW_EXCEPTION(
|
BOOST_THROW_EXCEPTION(
|
||||||
|
@ -619,7 +619,7 @@ void IdoMysqlConnection::InternalExecuteQuery(const DbQuery& query, DbQueryType
|
||||||
|
|
||||||
if (type == DbQueryInsert && query.Table == "notifications" && query.NotificationObject) { // FIXME remove hardcoded table name
|
if (type == DbQueryInsert && query.Table == "notifications" && query.NotificationObject) { // FIXME remove hardcoded table name
|
||||||
SetNotificationInsertID(query.NotificationObject, GetLastInsertID());
|
SetNotificationInsertID(query.NotificationObject, GetLastInsertID());
|
||||||
Log(LogDebug, "db_ido", "saving contactnotification notification_id=" + Convert::ToString(static_cast<long>(GetLastInsertID())));
|
Log(LogDebug, "IdoMysqlConnection", "saving contactnotification notification_id=" + Convert::ToString(static_cast<long>(GetLastInsertID())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ void IdoPgsqlConnection::Pause(void)
|
||||||
|
|
||||||
void IdoPgsqlConnection::ExceptionHandler(boost::exception_ptr exp)
|
void IdoPgsqlConnection::ExceptionHandler(boost::exception_ptr exp)
|
||||||
{
|
{
|
||||||
Log(LogWarning, "db_ido_pgsql", "Exception during database operation: " + DiagnosticInformation(exp));
|
Log(LogWarning, "IdoPgsqlConnection", "Exception during database operation: " + DiagnosticInformation(exp));
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_ConnectionMutex);
|
boost::mutex::scoped_lock lock(m_ConnectionMutex);
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ void IdoPgsqlConnection::Reconnect(void)
|
||||||
|
|
||||||
std::ostringstream msgbuf;
|
std::ostringstream msgbuf;
|
||||||
msgbuf << "pgSQL IDO instance id: " << static_cast<long>(m_InstanceID) << " (schema version: '" + version + "')";
|
msgbuf << "pgSQL IDO instance id: " << static_cast<long>(m_InstanceID) << " (schema version: '" + version + "')";
|
||||||
Log(LogInformation, "db_ido_pgsql", msgbuf.str());
|
Log(LogInformation, "IdoPgsqlConnection", msgbuf.str());
|
||||||
|
|
||||||
/* record connection */
|
/* record connection */
|
||||||
Query("INSERT INTO " + GetTablePrefix() + "conninfo " +
|
Query("INSERT INTO " + GetTablePrefix() + "conninfo " +
|
||||||
|
@ -272,7 +272,7 @@ void IdoPgsqlConnection::Reconnect(void)
|
||||||
/* deactivate all deleted configuration objects */
|
/* deactivate all deleted configuration objects */
|
||||||
BOOST_FOREACH(const DbObject::Ptr& dbobj, active_dbobjs) {
|
BOOST_FOREACH(const DbObject::Ptr& dbobj, active_dbobjs) {
|
||||||
if (dbobj->GetObject() == NULL) {
|
if (dbobj->GetObject() == NULL) {
|
||||||
Log(LogNotice, "db_ido", "Deactivate deleted object name1: '" + Convert::ToString(dbobj->GetName1() +
|
Log(LogNotice, "IdoPgsqlConnection", "Deactivate deleted object name1: '" + Convert::ToString(dbobj->GetName1() +
|
||||||
"' name2: '" + Convert::ToString(dbobj->GetName2() + "'.")));
|
"' name2: '" + Convert::ToString(dbobj->GetName2() + "'.")));
|
||||||
DeactivateObject(dbobj);
|
DeactivateObject(dbobj);
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ IdoPgsqlResult IdoPgsqlConnection::Query(const String& query)
|
||||||
{
|
{
|
||||||
AssertOnWorkQueue();
|
AssertOnWorkQueue();
|
||||||
|
|
||||||
Log(LogDebug, "db_ido_pgsql", "Query: " + query);
|
Log(LogDebug, "IdoPgsqlConnection", "Query: " + query);
|
||||||
|
|
||||||
PGresult *result = PQexec(m_Connection, query.CStr());
|
PGresult *result = PQexec(m_Connection, query.CStr());
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ DbReference IdoPgsqlConnection::GetSequenceValue(const String& table, const Stri
|
||||||
|
|
||||||
std::ostringstream msgbuf;
|
std::ostringstream msgbuf;
|
||||||
msgbuf << "Sequence Value: " << row->Get("id");
|
msgbuf << "Sequence Value: " << row->Get("id");
|
||||||
Log(LogDebug, "db_ido_pgsql", msgbuf.str());
|
Log(LogDebug, "IdoPgsqlConnection", msgbuf.str());
|
||||||
|
|
||||||
return DbReference(Convert::ToLong(row->Get("id")));
|
return DbReference(Convert::ToLong(row->Get("id")));
|
||||||
}
|
}
|
||||||
|
@ -630,7 +630,7 @@ void IdoPgsqlConnection::InternalExecuteQuery(const DbQuery& query, DbQueryType
|
||||||
if (type == DbQueryInsert && query.Table == "notifications" && query.NotificationObject) { // FIXME remove hardcoded table name
|
if (type == DbQueryInsert && query.Table == "notifications" && query.NotificationObject) { // FIXME remove hardcoded table name
|
||||||
String idField = "notification_id";
|
String idField = "notification_id";
|
||||||
SetNotificationInsertID(query.NotificationObject, GetSequenceValue(GetTablePrefix() + query.Table, idField));
|
SetNotificationInsertID(query.NotificationObject, GetSequenceValue(GetTablePrefix() + query.Table, idField));
|
||||||
Log(LogDebug, "db_ido", "saving contactnotification notification_id=" + Convert::ToString(static_cast<long>(GetSequenceValue(GetTablePrefix() + query.Table, idField))));
|
Log(LogDebug, "IdoPgsqlConnection", "saving contactnotification notification_id=" + Convert::ToString(static_cast<long>(GetSequenceValue(GetTablePrefix() + query.Table, idField))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,13 +53,13 @@ void Demo::DemoTimerHandler(void)
|
||||||
ApiListener::Ptr listener = ApiListener::GetInstance();
|
ApiListener::Ptr listener = ApiListener::GetInstance();
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener->RelayMessage(MessageOrigin(), DynamicObject::Ptr(), message, true);
|
listener->RelayMessage(MessageOrigin(), DynamicObject::Ptr(), message, true);
|
||||||
Log(LogInformation, "demo", "Sent demo::HelloWorld message");
|
Log(LogInformation, "Demo", "Sent demo::HelloWorld message");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Value Demo::DemoMessageHandler(const MessageOrigin& origin, const Dictionary::Ptr&)
|
Value Demo::DemoMessageHandler(const MessageOrigin& origin, const Dictionary::Ptr&)
|
||||||
{
|
{
|
||||||
Log(LogInformation, "demo", "Got demo message from '" + origin.FromClient->GetEndpoint()->GetName() + "'");
|
Log(LogInformation, "Demo", "Got demo message from '" + origin.FromClient->GetEndpoint()->GetName() + "'");
|
||||||
|
|
||||||
return Empty;
|
return Empty;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ bool AttributeFilter::Apply(const Table::Ptr& table, const Value& row)
|
||||||
boost::smatch what;
|
boost::smatch what;
|
||||||
bool ret = boost::regex_search(operand.GetData(), what, expr);
|
bool ret = boost::regex_search(operand.GetData(), what, expr);
|
||||||
|
|
||||||
//Log(LogDebug, "livestatus", "Attribute filter '" + m_Operand + " " + m_Operator + " " +
|
//Log(LogDebug, "LivestatusListener/AttributeFilter", "Attribute filter '" + m_Operand + " " + m_Operator + " " +
|
||||||
// static_cast<String>(value) + "' " + (ret ? "matches" : "doesn't match") + "." );
|
// static_cast<String>(value) + "' " + (ret ? "matches" : "doesn't match") + "." );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -77,7 +77,7 @@ bool AttributeFilter::Apply(const Table::Ptr& table, const Value& row)
|
||||||
boost::smatch what;
|
boost::smatch what;
|
||||||
bool ret = boost::regex_search(operand.GetData(), what, expr);
|
bool ret = boost::regex_search(operand.GetData(), what, expr);
|
||||||
|
|
||||||
//Log(LogDebug, "livestatus", "Attribute filter '" + m_Operand + " " + m_Operator + " " +
|
//Log(LogDebug, "LivestatusListener/AttributeFilter", "Attribute filter '" + m_Operand + " " + m_Operator + " " +
|
||||||
// static_cast<String>(value) + "' " + (ret ? "matches" : "doesn't match") + "." );
|
// static_cast<String>(value) + "' " + (ret ? "matches" : "doesn't match") + "." );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -74,7 +74,7 @@ void LivestatusListener::Start(void)
|
||||||
|
|
||||||
boost::thread thread(boost::bind(&LivestatusListener::ServerThreadProc, this, socket));
|
boost::thread thread(boost::bind(&LivestatusListener::ServerThreadProc, this, socket));
|
||||||
thread.detach();
|
thread.detach();
|
||||||
Log(LogInformation, "livestatus", "Created tcp socket listening on host '" + GetBindHost() + "' port '" + GetBindPort() + "'.");
|
Log(LogInformation, "LivestatusListener", "Created tcp socket listening on host '" + GetBindHost() + "' port '" + GetBindPort() + "'.");
|
||||||
}
|
}
|
||||||
else if (GetSocketType() == "unix") {
|
else if (GetSocketType() == "unix") {
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
@ -93,10 +93,10 @@ void LivestatusListener::Start(void)
|
||||||
|
|
||||||
boost::thread thread(boost::bind(&LivestatusListener::ServerThreadProc, this, socket));
|
boost::thread thread(boost::bind(&LivestatusListener::ServerThreadProc, this, socket));
|
||||||
thread.detach();
|
thread.detach();
|
||||||
Log(LogInformation, "livestatus", "Created unix socket in '" + GetSocketPath() + "'.");
|
Log(LogInformation, "LivestatusListener", "Created unix socket in '" + GetSocketPath() + "'.");
|
||||||
#else
|
#else
|
||||||
/* no unix sockets on windows */
|
/* no unix sockets on windows */
|
||||||
Log(LogCritical, "livestatus", "Unix sockets are not supported on Windows.");
|
Log(LogCritical, "LivestatusListener", "Unix sockets are not supported on Windows.");
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ void LivestatusListener::ServerThreadProc(const Socket::Ptr& server)
|
||||||
for (;;) {
|
for (;;) {
|
||||||
Socket::Ptr client = server->Accept();
|
Socket::Ptr client = server->Accept();
|
||||||
|
|
||||||
Log(LogNotice, "livestatus", "Client connected");
|
Log(LogNotice, "LivestatusListener", "Client connected");
|
||||||
|
|
||||||
Utility::QueueAsyncCallback(boost::bind(&LivestatusListener::ClientHandler, this, client));
|
Utility::QueueAsyncCallback(boost::bind(&LivestatusListener::ClientHandler, this, client));
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ String LogTable::GetName(void) const
|
||||||
|
|
||||||
void LogTable::FetchRows(const AddRowFunction& addRowFn)
|
void LogTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
Log(LogNotice, "livestatus", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil));
|
Log(LogNotice, "LivestatusListener/LogTable", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil));
|
||||||
|
|
||||||
/* create log file index */
|
/* create log file index */
|
||||||
LogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex);
|
LogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex);
|
||||||
|
|
|
@ -68,7 +68,7 @@ void LogUtility::CreateLogIndexFileHandler(const String& path, std::map<time_t,
|
||||||
|
|
||||||
stream.close();
|
stream.close();
|
||||||
|
|
||||||
Log(LogDebug, "livestatus", "Indexing log file: '" + path + "' with timestamp start: '" + Convert::ToString(ts_start) + "'.");
|
Log(LogDebug, "LivestatusListener/LogUtility", "Indexing log file: '" + path + "' with timestamp start: '" + Convert::ToString(ts_start) + "'.");
|
||||||
|
|
||||||
index[ts_start] = path;
|
index[ts_start] = path;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ void LogUtility::CreateLogCache(std::map<time_t, String> index, HistoryTable *ta
|
||||||
|
|
||||||
/* no attributes available - invalid log line */
|
/* no attributes available - invalid log line */
|
||||||
if (!log_entry_attrs) {
|
if (!log_entry_attrs) {
|
||||||
Log(LogDebug, "livestatus", "Skipping invalid log line: '" + line + "'.");
|
Log(LogDebug, "LivestatusListener/LogUtility", "Skipping invalid log line: '" + line + "'.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ Dictionary::Ptr LogUtility::GetAttributes(const String& text)
|
||||||
*/
|
*/
|
||||||
unsigned long time = atoi(text.SubStr(1, 11).CStr());
|
unsigned long time = atoi(text.SubStr(1, 11).CStr());
|
||||||
|
|
||||||
Log(LogDebug, "livestatus", "Processing log line: '" + text + "'.");
|
Log(LogDebug, "LivestatusListener/LogUtility", "Processing log line: '" + text + "'.");
|
||||||
bag->Set("time", time);
|
bag->Set("time", time);
|
||||||
|
|
||||||
size_t colon = text.FindFirstOf(':');
|
size_t colon = text.FindFirstOf(':');
|
||||||
|
|
|
@ -62,7 +62,7 @@ Query::Query(const std::vector<String>& lines, const String& compat_log_path)
|
||||||
BOOST_FOREACH(const String& line, lines) {
|
BOOST_FOREACH(const String& line, lines) {
|
||||||
msg += line + "\n";
|
msg += line + "\n";
|
||||||
}
|
}
|
||||||
Log(LogDebug, "livestatus", msg);
|
Log(LogDebug, "LivestatusListener/Query", msg);
|
||||||
|
|
||||||
m_CompatLogPath = compat_log_path;
|
m_CompatLogPath = compat_log_path;
|
||||||
|
|
||||||
|
@ -202,10 +202,10 @@ Query::Query(const std::vector<String>& lines, const String& compat_log_path)
|
||||||
|
|
||||||
if (header == "Or" || header == "StatsOr") {
|
if (header == "Or" || header == "StatsOr") {
|
||||||
filter = make_shared<OrFilter>();
|
filter = make_shared<OrFilter>();
|
||||||
Log(LogDebug, "livestatus", "Add OR filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available.");
|
Log(LogDebug, "LivestatusListener/Query", "Add OR filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available.");
|
||||||
} else {
|
} else {
|
||||||
filter = make_shared<AndFilter>();
|
filter = make_shared<AndFilter>();
|
||||||
Log(LogDebug, "livestatus", "Add AND filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available.");
|
Log(LogDebug, "LivestatusListener/Query", "Add AND filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num > deq.size()) {
|
if (num > deq.size()) {
|
||||||
|
@ -217,7 +217,7 @@ Query::Query(const std::vector<String>& lines, const String& compat_log_path)
|
||||||
|
|
||||||
while (num > 0 && num--) {
|
while (num > 0 && num--) {
|
||||||
filter->AddSubFilter(deq.back());
|
filter->AddSubFilter(deq.back());
|
||||||
Log(LogDebug, "livestatus", "Add " + Convert::ToString(num) + " filter.");
|
Log(LogDebug, "LivestatusListener/Query", "Add " + Convert::ToString(num) + " filter.");
|
||||||
deq.pop_back();
|
deq.pop_back();
|
||||||
if (&deq == &stats)
|
if (&deq == &stats)
|
||||||
aggregators.pop_back();
|
aggregators.pop_back();
|
||||||
|
@ -340,7 +340,7 @@ Filter::Ptr Query::ParseFilter(const String& params, unsigned long& from, unsign
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(LogDebug, "livestatus", "Parsed filter with attr: '" + attr + "' op: '" + op + "' val: '" + val + "'.");
|
Log(LogDebug, "LivestatusListener/Query", "Parsed filter with attr: '" + attr + "' op: '" + op + "' val: '" + val + "'.");
|
||||||
|
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
@ -393,7 +393,7 @@ void Query::PrintCsvArray(std::ostream& fp, const Array::Ptr& array, int level)
|
||||||
|
|
||||||
void Query::ExecuteGetHelper(const Stream::Ptr& stream)
|
void Query::ExecuteGetHelper(const Stream::Ptr& stream)
|
||||||
{
|
{
|
||||||
Log(LogInformation, "livestatus", "Table: " + m_Table);
|
Log(LogInformation, "LivestatusListener/Query", "Table: " + m_Table);
|
||||||
|
|
||||||
Table::Ptr table = Table::GetByName(m_Table, m_CompatLogPath, m_LogTimeFrom, m_LogTimeUntil);
|
Table::Ptr table = Table::GetByName(m_Table, m_CompatLogPath, m_LogTimeFrom, m_LogTimeUntil);
|
||||||
|
|
||||||
|
@ -498,14 +498,14 @@ void Query::ExecuteCommandHelper(const Stream::Ptr& stream)
|
||||||
l_ExternalCommands++;
|
l_ExternalCommands++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log(LogInformation, "livestatus", "Executing command: " + m_Command);
|
Log(LogInformation, "LivestatusListener/Query", "Executing command: " + m_Command);
|
||||||
ExternalCommandProcessor::Execute(m_Command);
|
ExternalCommandProcessor::Execute(m_Command);
|
||||||
SendResponse(stream, LivestatusErrorOK, "");
|
SendResponse(stream, LivestatusErrorOK, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Query::ExecuteErrorHelper(const Stream::Ptr& stream)
|
void Query::ExecuteErrorHelper(const Stream::Ptr& stream)
|
||||||
{
|
{
|
||||||
Log(LogDebug, "livestatus", "ERROR: Code: '" + Convert::ToString(m_ErrorCode) + "' Message: '" + m_ErrorMessage + "'.");
|
Log(LogDebug, "LivestatusListener/Query", "ERROR: Code: '" + Convert::ToString(m_ErrorCode) + "' Message: '" + m_ErrorMessage + "'.");
|
||||||
SendResponse(stream, m_ErrorCode, m_ErrorMessage);
|
SendResponse(stream, m_ErrorCode, m_ErrorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,7 +521,7 @@ void Query::SendResponse(const Stream::Ptr& stream, int code, const String& data
|
||||||
std::ostringstream info;
|
std::ostringstream info;
|
||||||
info << "Exception thrown while writing to the livestatus socket: " << std::endl
|
info << "Exception thrown while writing to the livestatus socket: " << std::endl
|
||||||
<< DiagnosticInformation(ex);
|
<< DiagnosticInformation(ex);
|
||||||
Log(LogCritical, "livestatus", info.str());
|
Log(LogCritical, "LivestatusListener/Query", info.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -541,14 +541,14 @@ void Query::PrintFixed16(const Stream::Ptr& stream, int code, const String& data
|
||||||
std::ostringstream info;
|
std::ostringstream info;
|
||||||
info << "Exception thrown while writing to the livestatus socket: " << std::endl
|
info << "Exception thrown while writing to the livestatus socket: " << std::endl
|
||||||
<< DiagnosticInformation(ex);
|
<< DiagnosticInformation(ex);
|
||||||
Log(LogCritical, "livestatus", info.str());
|
Log(LogCritical, "LivestatusListener/Query", info.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Query::Execute(const Stream::Ptr& stream)
|
bool Query::Execute(const Stream::Ptr& stream)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Log(LogInformation, "livestatus", "Executing livestatus query: " + m_Verb);
|
Log(LogInformation, "LivestatusListener/Query", "Executing livestatus query: " + m_Verb);
|
||||||
|
|
||||||
if (m_Verb == "GET")
|
if (m_Verb == "GET")
|
||||||
ExecuteGetHelper(stream);
|
ExecuteGetHelper(stream);
|
||||||
|
|
|
@ -117,7 +117,7 @@ void StateHistTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, in
|
||||||
|
|
||||||
state_hist_service_states->Add(state_hist_bag);
|
state_hist_service_states->Add(state_hist_bag);
|
||||||
|
|
||||||
Log(LogDebug, "livestatus", "statehist: Adding new object '" + checkable->GetName() + "' to services cache.");
|
Log(LogDebug, "LivestatusListener/StateHistTable", "statehist: Adding new object '" + checkable->GetName() + "' to services cache.");
|
||||||
} else {
|
} else {
|
||||||
state_hist_service_states = m_CheckablesCache[checkable];
|
state_hist_service_states = m_CheckablesCache[checkable];
|
||||||
state_hist_bag = state_hist_service_states->Get(state_hist_service_states->GetLength()-1); /* fetch latest state from history */
|
state_hist_bag = state_hist_service_states->Get(state_hist_service_states->GetLength()-1); /* fetch latest state from history */
|
||||||
|
@ -173,7 +173,7 @@ void StateHistTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, in
|
||||||
|
|
||||||
state_hist_service_states->Add(state_hist_bag_new);
|
state_hist_service_states->Add(state_hist_bag_new);
|
||||||
|
|
||||||
Log(LogDebug, "livestatus", "statehist: State change detected for object '" +
|
Log(LogDebug, "LivestatusListener/StateHistTable", "statehist: State change detected for object '" +
|
||||||
checkable->GetName() + "' in '" + log_line + "'.");
|
checkable->GetName() + "' in '" + log_line + "'.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -252,7 +252,7 @@ String StateHistTable::GetName(void) const
|
||||||
|
|
||||||
void StateHistTable::FetchRows(const AddRowFunction& addRowFn)
|
void StateHistTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
Log(LogNotice, "livestatus", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil));
|
Log(LogNotice, "LivestatusListener/StateHistTable", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil));
|
||||||
|
|
||||||
/* create log file index */
|
/* create log file index */
|
||||||
LogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex);
|
LogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex);
|
||||||
|
|
|
@ -105,7 +105,7 @@ void NotificationComponent::NotificationTimerHandler(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Log(LogInformation, "notification", "Sending reminder notification for object '" + checkable->GetName() + "'");
|
Log(LogInformation, "NotificationComponent", "Sending reminder notification for object '" + checkable->GetName() + "'");
|
||||||
notification->BeginExecuteNotification(NotificationProblem, checkable->GetLastCheckResult(), false);
|
notification->BeginExecuteNotification(NotificationProblem, checkable->GetLastCheckResult(), false);
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
std::ostringstream msgbuf;
|
std::ostringstream msgbuf;
|
||||||
|
@ -113,7 +113,7 @@ void NotificationComponent::NotificationTimerHandler(void)
|
||||||
<< GetName() << "': " << DiagnosticInformation(ex);
|
<< GetName() << "': " << DiagnosticInformation(ex);
|
||||||
String message = msgbuf.str();
|
String message = msgbuf.str();
|
||||||
|
|
||||||
Log(LogWarning, "icinga", message);
|
Log(LogWarning, "NotificationComponent", message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,16 +77,16 @@ void GraphiteWriter::ReconnectTimerHandler(void)
|
||||||
try {
|
try {
|
||||||
if (m_Stream) {
|
if (m_Stream) {
|
||||||
m_Stream->Write("\n", 1);
|
m_Stream->Write("\n", 1);
|
||||||
Log(LogNotice, "perfdata", "GraphiteWriter already connected on socket on host '" + GetHost() + "' port '" + GetPort() + "'.");
|
Log(LogNotice, "GraphiteWriter", "GraphiteWriter already connected on socket on host '" + GetHost() + "' port '" + GetPort() + "'.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
Log(LogWarning, "perfdata", "GraphiteWriter socket on host '" + GetHost() + "' port '" + GetPort() + "' gone. Attempting to reconnect.");
|
Log(LogWarning, "GraphiteWriter", "GraphiteWriter socket on host '" + GetHost() + "' port '" + GetPort() + "' gone. Attempting to reconnect.");
|
||||||
}
|
}
|
||||||
|
|
||||||
TcpSocket::Ptr socket = make_shared<TcpSocket>();
|
TcpSocket::Ptr socket = make_shared<TcpSocket>();
|
||||||
|
|
||||||
Log(LogNotice, "perfdata", "GraphiteWriter: Reconnect to tcp socket on host '" + GetHost() + "' port '" + GetPort() + "'.");
|
Log(LogNotice, "GraphiteWriter", "GraphiteWriter: Reconnect to tcp socket on host '" + GetHost() + "' port '" + GetPort() + "'.");
|
||||||
socket->Connect(GetHost(), GetPort());
|
socket->Connect(GetHost(), GetPort());
|
||||||
|
|
||||||
m_Stream = make_shared<NetworkStream>(socket);
|
m_Stream = make_shared<NetworkStream>(socket);
|
||||||
|
@ -163,7 +163,7 @@ void GraphiteWriter::SendMetric(const String& prefix, const String& name, double
|
||||||
msgbuf << prefix << "." << name << " " << value << " " << static_cast<long>(Utility::GetTime()) << "\n";
|
msgbuf << prefix << "." << name << " " << value << " " << static_cast<long>(Utility::GetTime()) << "\n";
|
||||||
|
|
||||||
String metric = msgbuf.str();
|
String metric = msgbuf.str();
|
||||||
Log(LogDebug, "perfdata", "GraphiteWriter: Add to metric list:'" + metric + "'.");
|
Log(LogDebug, "GraphiteWriter", "GraphiteWriter: Add to metric list:'" + metric + "'.");
|
||||||
|
|
||||||
ObjectLock olock(this);
|
ObjectLock olock(this);
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ void GraphiteWriter::SendMetric(const String& prefix, const String& name, double
|
||||||
msgbuf << "Exception thrown while writing to the Graphite socket: " << std::endl
|
msgbuf << "Exception thrown while writing to the Graphite socket: " << std::endl
|
||||||
<< DiagnosticInformation(ex);
|
<< DiagnosticInformation(ex);
|
||||||
|
|
||||||
Log(LogCritical, "perfdata", msgbuf.str());
|
Log(LogCritical, "GraphiteWriter", msgbuf.str());
|
||||||
|
|
||||||
m_Stream.reset();
|
m_Stream.reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ void PerfdataWriter::RotateFile(std::ofstream& output, const String& temp_path,
|
||||||
output.open(temp_path.CStr());
|
output.open(temp_path.CStr());
|
||||||
|
|
||||||
if (!output.good())
|
if (!output.good())
|
||||||
Log(LogWarning, "icinga", "Could not open perfdata file '" + temp_path + "' for writing. Perfdata will be lost.");
|
Log(LogWarning, "PerfdataWriter", "Could not open perfdata file '" + temp_path + "' for writing. Perfdata will be lost.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerfdataWriter::RotationTimerHandler(void)
|
void PerfdataWriter::RotationTimerHandler(void)
|
||||||
|
|
Loading…
Reference in New Issue