Merge branch 'fix/rename-log-lib-name-6346' into next

Fixes #6346
This commit is contained in:
Michael Friedrich 2014-05-28 14:42:13 +02:00
commit fdc2ef6190
70 changed files with 452 additions and 451 deletions

View File

@ -86,7 +86,7 @@ void CheckerComponent::Start(void)
void CheckerComponent::Stop(void)
{
Log(LogInformation, "checker", "Checker stopped.");
Log(LogInformation, "CheckerComponent", "Checker stopped.");
{
boost::mutex::scoped_lock lock(m_Mutex);
@ -135,7 +135,7 @@ void CheckerComponent::CheckThreadProc(void)
if (!forced) {
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;
}
@ -144,18 +144,18 @@ void CheckerComponent::CheckThreadProc(void)
tie(host, service) = GetHostService(checkable);
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;
}
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;
}
TimePeriod::Ptr tp = checkable->GetCheckPeriod();
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;
}
}
@ -181,7 +181,7 @@ void CheckerComponent::CheckThreadProc(void)
checkable->SetForceNextCheck(false);
}
Log(LogDebug, "checker", "Executing check for '" + checkable->GetName() + "'");
Log(LogDebug, "CheckerComponent", "Executing check for '" + checkable->GetName() + "'");
CheckerComponent::Ptr self = GetSelf();
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)
@ -244,7 +244,7 @@ void CheckerComponent::ResultTimerHandler(void)
<< (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)

View File

@ -118,7 +118,7 @@ void CheckResultReader::ProcessCheckResultFile(const String& path) const
Host::Ptr host = Host::GetByName(attrs["host_name"]);
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.");
return;
@ -127,7 +127,7 @@ void CheckResultReader::ProcessCheckResultFile(const String& path) const
Service::Ptr service = host->GetServiceByShortName(attrs["service_description"]);
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.");
return;
@ -143,7 +143,7 @@ void CheckResultReader::ProcessCheckResultFile(const String& path) const
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"] + "'");
{

View File

@ -321,7 +321,7 @@ void CompatLogger::FlappingHandler(const Checkable::Ptr& checkable, FlappingStat
flapping_state_str = "DISABLED";
break;
default:
Log(LogCritical, "compat", "Unknown flapping state: " + Convert::ToString(flapping_state));
Log(LogCritical, "CompatLogger", "Unknown flapping state: " + Convert::ToString(flapping_state));
return;
}
@ -434,7 +434,7 @@ void CompatLogger::ReopenFile(bool rotate)
if (rotate) {
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());
}
}
@ -442,7 +442,7 @@ void CompatLogger::ReopenFile(bool rotate)
m_OutputFile.open(tempFile.CStr(), std::ofstream::app);
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;
}
@ -536,7 +536,7 @@ void CompatLogger::ScheduleNextRotation(void)
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) + "'");
m_RotationTimer->Reschedule(ts);
}

View File

@ -130,13 +130,13 @@ void ExternalCommandListener::CommandPipeThread(const String& commandPath)
String command = line;
try {
Log(LogInformation, "compat", "Executing external command: " + command);
Log(LogInformation, "ExternalCommandListener", "Executing external command: " + command);
ExternalCommandProcessor::Execute(command);
} catch (const std::exception& ex) {
std::ostringstream msgbuf;
msgbuf << "External command failed: " << DiagnosticInformation(ex);
Log(LogWarning, "compat", msgbuf.str());
Log(LogWarning, "ExternalCommandListener", msgbuf.str());
}
}

View File

@ -693,7 +693,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
Checkable::Ptr parent = dep->GetParent();
if (!parent) {
Log(LogDebug, "compat", "Missing parent for dependency '" + dep->GetName() + "'.");
Log(LogDebug, "StatusDataWriter", "Missing parent for dependency '" + dep->GetName() + "'.");
continue;
}
@ -705,7 +705,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
if (!child) {
continue;
Log(LogDebug, "compat", "Missing child for dependency '" + dep->GetName() + "'.");
Log(LogDebug, "StatusDataWriter", "Missing child for dependency '" + dep->GetName() + "'.");
}
Host::Ptr child_host;
@ -840,5 +840,5 @@ void StatusDataWriter::StatusTimerHandler(void)
<< 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));
}

View File

@ -94,7 +94,7 @@ void IdoMysqlConnection::Pause(void)
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);
@ -228,7 +228,7 @@ void IdoMysqlConnection::Reconnect(void)
std::ostringstream msgbuf;
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 */
Query("SET SESSION TIME_ZONE='+00:00'");
@ -268,7 +268,7 @@ void IdoMysqlConnection::Reconnect(void)
/* deactivate all deleted configuration objects */
BOOST_FOREACH(const DbObject::Ptr& dbobj, active_dbobjs) {
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() + "'.")));
DeactivateObject(dbobj);
}
@ -284,7 +284,7 @@ IdoMysqlResult IdoMysqlConnection::Query(const String& query)
{
AssertOnWorkQueue();
Log(LogDebug, "db_ido_mysql", "Query: " + query);
Log(LogDebug, "IdoMysqlConnection", "Query: " + query);
if (mysql_query(&m_Connection, query.CStr()) != 0)
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
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())));
}
}

View File

@ -96,7 +96,7 @@ void IdoPgsqlConnection::Pause(void)
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);
@ -232,7 +232,7 @@ void IdoPgsqlConnection::Reconnect(void)
std::ostringstream msgbuf;
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 */
Query("INSERT INTO " + GetTablePrefix() + "conninfo " +
@ -272,7 +272,7 @@ void IdoPgsqlConnection::Reconnect(void)
/* deactivate all deleted configuration objects */
BOOST_FOREACH(const DbObject::Ptr& dbobj, active_dbobjs) {
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() + "'.")));
DeactivateObject(dbobj);
}
@ -288,7 +288,7 @@ IdoPgsqlResult IdoPgsqlConnection::Query(const String& query)
{
AssertOnWorkQueue();
Log(LogDebug, "db_ido_pgsql", "Query: " + query);
Log(LogDebug, "IdoPgsqlConnection", "Query: " + query);
PGresult *result = PQexec(m_Connection, query.CStr());
@ -330,7 +330,7 @@ DbReference IdoPgsqlConnection::GetSequenceValue(const String& table, const Stri
std::ostringstream msgbuf;
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")));
}
@ -630,7 +630,7 @@ void IdoPgsqlConnection::InternalExecuteQuery(const DbQuery& query, DbQueryType
if (type == DbQueryInsert && query.Table == "notifications" && query.NotificationObject) { // FIXME remove hardcoded table name
String idField = "notification_id";
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))));
}
}

View File

@ -53,13 +53,13 @@ void Demo::DemoTimerHandler(void)
ApiListener::Ptr listener = ApiListener::GetInstance();
if (listener) {
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&)
{
Log(LogInformation, "demo", "Got demo message from '" + origin.FromClient->GetEndpoint()->GetName() + "'");
Log(LogInformation, "Demo", "Got demo message from '" + origin.FromClient->GetEndpoint()->GetName() + "'");
return Empty;
}

View File

@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software Foundation
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
mkclass_target(listener.ti listener.thpp)
mkclass_target(livestatuslistener.ti livestatuslistener.thpp)
mkembedconfig_target(livestatus-type.conf livestatus-type.cpp)
@ -24,8 +24,9 @@ add_library(livestatus SHARED aggregator.cpp andfilter.cpp attributefilter.cpp
commentstable.cpp contactgroupstable.cpp contactstable.cpp countaggregator.cpp
downtimestable.cpp endpointstable.cpp filter.cpp historytable.cpp
hostgroupstable.cpp hoststable.cpp invavgaggregator.cpp invsumaggregator.cpp
listener.cpp listener.thpp logutility.cpp logtable.cpp maxaggregator.cpp
minaggregator.cpp negatefilter.cpp orfilter.cpp query.cpp
livestatuslistener.cpp livestatuslistener.thpp livestatusquery.cpp
livestatuslogutility.cpp logtable.cpp maxaggregator.cpp
minaggregator.cpp negatefilter.cpp orfilter.cpp
servicegroupstable.cpp servicestable.cpp statehisttable.cpp
statustable.cpp stdaggregator.cpp sumaggregator.cpp table.cpp
timeperiodstable.cpp livestatus-type.cpp)

View File

@ -65,7 +65,7 @@ bool AttributeFilter::Apply(const Table::Ptr& table, const Value& row)
boost::smatch what;
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") + "." );
return ret;
@ -77,7 +77,7 @@ bool AttributeFilter::Apply(const Table::Ptr& table, const Value& row)
boost::smatch what;
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") + "." );
return ret;

View File

@ -17,7 +17,7 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
#include "livestatus/listener.hpp"
#include "livestatus/livestatuslistener.hpp"
#include "config/configcompilercontext.hpp"
#include "base/utility.hpp"
#include "base/objectlock.hpp"
@ -74,7 +74,7 @@ void LivestatusListener::Start(void)
boost::thread thread(boost::bind(&LivestatusListener::ServerThreadProc, this, socket));
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") {
#ifndef _WIN32
@ -93,10 +93,10 @@ void LivestatusListener::Start(void)
boost::thread thread(boost::bind(&LivestatusListener::ServerThreadProc, this, socket));
thread.detach();
Log(LogInformation, "livestatus", "Created unix socket in '" + GetSocketPath() + "'.");
Log(LogInformation, "LivestatusListener", "Created unix socket in '" + GetSocketPath() + "'.");
#else
/* 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;
#endif
}
@ -123,7 +123,7 @@ void LivestatusListener::ServerThreadProc(const Socket::Ptr& server)
for (;;) {
Socket::Ptr client = server->Accept();
Log(LogNotice, "livestatus", "Client connected");
Log(LogNotice, "LivestatusListener", "Client connected");
Utility::QueueAsyncCallback(boost::bind(&LivestatusListener::ClientHandler, this, client));
}
@ -155,7 +155,7 @@ void LivestatusListener::ClientHandler(const Socket::Ptr& client)
if (lines.empty())
break;
Query::Ptr query = make_shared<Query>(lines, GetCompatLogPath());
LivestatusQuery::Ptr query = make_shared<LivestatusQuery>(lines, GetCompatLogPath());
if (!query->Execute(stream))
break;
}

View File

@ -20,8 +20,8 @@
#ifndef LIVESTATUSLISTENER_H
#define LIVESTATUSLISTENER_H
#include "livestatus/listener.thpp"
#include "livestatus/query.hpp"
#include "livestatus/livestatuslistener.thpp"
#include "livestatus/livestatusquery.hpp"
#include "base/socket.hpp"
#include <boost/thread/thread.hpp>

View File

@ -17,7 +17,7 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
#include "livestatus/logutility.hpp"
#include "livestatus/livestatuslogutility.hpp"
#include "icinga/service.hpp"
#include "icinga/host.hpp"
#include "icinga/user.hpp"
@ -38,13 +38,13 @@
using namespace icinga;
void LogUtility::CreateLogIndex(const String& path, std::map<time_t, String>& index)
void LivestatusLogUtility::CreateLogIndex(const String& path, std::map<time_t, String>& index)
{
Utility::Glob(path + "/icinga.log", boost::bind(&LogUtility::CreateLogIndexFileHandler, _1, boost::ref(index)), GlobFile);
Utility::Glob(path + "/archives/*.log", boost::bind(&LogUtility::CreateLogIndexFileHandler, _1, boost::ref(index)), GlobFile);
Utility::Glob(path + "/icinga.log", boost::bind(&LivestatusLogUtility::CreateLogIndexFileHandler, _1, boost::ref(index)), GlobFile);
Utility::Glob(path + "/archives/*.log", boost::bind(&LivestatusLogUtility::CreateLogIndexFileHandler, _1, boost::ref(index)), GlobFile);
}
void LogUtility::CreateLogIndexFileHandler(const String& path, std::map<time_t, String>& index)
void LivestatusLogUtility::CreateLogIndexFileHandler(const String& path, std::map<time_t, String>& index)
{
std::ifstream stream;
stream.open(path.CStr(), std::ifstream::in);
@ -68,12 +68,12 @@ void LogUtility::CreateLogIndexFileHandler(const String& path, std::map<time_t,
stream.close();
Log(LogDebug, "livestatus", "Indexing log file: '" + path + "' with timestamp start: '" + Convert::ToString(ts_start) + "'.");
Log(LogDebug, "LivestatusLogUtility", "Indexing log file: '" + path + "' with timestamp start: '" + Convert::ToString(ts_start) + "'.");
index[ts_start] = path;
}
void LogUtility::CreateLogCache(std::map<time_t, String> index, HistoryTable *table,
void LivestatusLogUtility::CreateLogCache(std::map<time_t, String> index, HistoryTable *table,
time_t from, time_t until, const AddRowFunction& addRowFn)
{
ASSERT(table);
@ -100,11 +100,11 @@ void LogUtility::CreateLogCache(std::map<time_t, String> index, HistoryTable *ta
if (line.empty())
continue; /* Ignore empty lines */
Dictionary::Ptr log_entry_attrs = LogUtility::GetAttributes(line);
Dictionary::Ptr log_entry_attrs = LivestatusLogUtility::GetAttributes(line);
/* no attributes available - invalid log line */
if (!log_entry_attrs) {
Log(LogDebug, "livestatus", "Skipping invalid log line: '" + line + "'.");
Log(LogDebug, "LivestatusLogUtility", "Skipping invalid log line: '" + line + "'.");
continue;
}
@ -118,7 +118,7 @@ void LogUtility::CreateLogCache(std::map<time_t, String> index, HistoryTable *ta
}
}
Dictionary::Ptr LogUtility::GetAttributes(const String& text)
Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
{
Dictionary::Ptr bag = make_shared<Dictionary>();
@ -127,7 +127,7 @@ Dictionary::Ptr LogUtility::GetAttributes(const String& text)
*/
unsigned long time = atoi(text.SubStr(1, 11).CStr());
Log(LogDebug, "livestatus", "Processing log line: '" + text + "'.");
Log(LogDebug, "LivestatusLogUtility", "Processing log line: '" + text + "'.");
bag->Set("time", time);
size_t colon = text.FindFirstOf(':');

View File

@ -17,8 +17,8 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
#ifndef LOGUTILITY_H
#define LOGUTILITY_H
#ifndef LIVESTATUSLOGUTILITY_H
#define LIVESTATUSLOGUTILITY_H
#include "livestatus/historytable.hpp"
@ -60,7 +60,7 @@ enum LogEntryClass {
/**
* @ingroup livestatus
*/
class LogUtility
class LivestatusLogUtility
{
public:
@ -70,9 +70,9 @@ public:
static Dictionary::Ptr GetAttributes(const String& text);
private:
LogUtility(void);
LivestatusLogUtility(void);
};
}
#endif /* LOGUTILITY_H */
#endif /* LIVESTATUSLOGUTILITY_H */

View File

@ -17,7 +17,7 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
#include "livestatus/query.hpp"
#include "livestatus/livestatusquery.hpp"
#include "livestatus/countaggregator.hpp"
#include "livestatus/sumaggregator.hpp"
#include "livestatus/minaggregator.hpp"
@ -47,7 +47,7 @@ using namespace icinga;
static int l_ExternalCommands = 0;
static boost::mutex l_QueryMutex;
Query::Query(const std::vector<String>& lines, const String& compat_log_path)
LivestatusQuery::LivestatusQuery(const std::vector<String>& lines, const String& compat_log_path)
: m_KeepAlive(false), m_OutputFormat("csv"), m_ColumnHeaders(true),
m_LogTimeFrom(0), m_LogTimeUntil(static_cast<long>(Utility::GetTime()))
{
@ -62,7 +62,7 @@ Query::Query(const std::vector<String>& lines, const String& compat_log_path)
BOOST_FOREACH(const String& line, lines) {
msg += line + "\n";
}
Log(LogDebug, "livestatus", msg);
Log(LogDebug, "LivestatusQuery", msg);
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") {
filter = make_shared<OrFilter>();
Log(LogDebug, "livestatus", "Add OR filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available.");
Log(LogDebug, "LivestatusQuery", "Add OR filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available.");
} else {
filter = make_shared<AndFilter>();
Log(LogDebug, "livestatus", "Add AND filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available.");
Log(LogDebug, "LivestatusQuery", "Add AND filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available.");
}
if (num > deq.size()) {
@ -217,7 +217,7 @@ Query::Query(const std::vector<String>& lines, const String& compat_log_path)
while (num > 0 && num--) {
filter->AddSubFilter(deq.back());
Log(LogDebug, "livestatus", "Add " + Convert::ToString(num) + " filter.");
Log(LogDebug, "LivestatusQuery", "Add " + Convert::ToString(num) + " filter.");
deq.pop_back();
if (&deq == &stats)
aggregators.pop_back();
@ -269,14 +269,14 @@ Query::Query(const std::vector<String>& lines, const String& compat_log_path)
m_Aggregators.swap(aggregators);
}
int Query::GetExternalCommands(void)
int LivestatusQuery::GetExternalCommands(void)
{
boost::mutex::scoped_lock lock(l_QueryMutex);
return l_ExternalCommands;
}
Filter::Ptr Query::ParseFilter(const String& params, unsigned long& from, unsigned long& until)
Filter::Ptr LivestatusQuery::ParseFilter(const String& params, unsigned long& from, unsigned long& until)
{
/*
* time >= 1382696656
@ -340,12 +340,12 @@ 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, "LivestatusQuery", "Parsed filter with attr: '" + attr + "' op: '" + op + "' val: '" + val + "'.");
return filter;
}
void Query::PrintResultSet(std::ostream& fp, const Array::Ptr& rs)
void LivestatusQuery::PrintResultSet(std::ostream& fp, const Array::Ptr& rs)
{
if (m_OutputFormat == "csv") {
ObjectLock olock(rs);
@ -373,7 +373,7 @@ void Query::PrintResultSet(std::ostream& fp, const Array::Ptr& rs)
}
}
void Query::PrintCsvArray(std::ostream& fp, const Array::Ptr& array, int level)
void LivestatusQuery::PrintCsvArray(std::ostream& fp, const Array::Ptr& array, int level)
{
bool first = true;
@ -391,9 +391,9 @@ void Query::PrintCsvArray(std::ostream& fp, const Array::Ptr& array, int level)
}
}
void Query::ExecuteGetHelper(const Stream::Ptr& stream)
void LivestatusQuery::ExecuteGetHelper(const Stream::Ptr& stream)
{
Log(LogInformation, "livestatus", "Table: " + m_Table);
Log(LogInformation, "LivestatusQuery", "Table: " + m_Table);
Table::Ptr table = Table::GetByName(m_Table, m_CompatLogPath, m_LogTimeFrom, m_LogTimeUntil);
@ -490,7 +490,7 @@ void Query::ExecuteGetHelper(const Stream::Ptr& stream)
SendResponse(stream, LivestatusErrorOK, result.str());
}
void Query::ExecuteCommandHelper(const Stream::Ptr& stream)
void LivestatusQuery::ExecuteCommandHelper(const Stream::Ptr& stream)
{
{
boost::mutex::scoped_lock lock(l_QueryMutex);
@ -498,18 +498,18 @@ void Query::ExecuteCommandHelper(const Stream::Ptr& stream)
l_ExternalCommands++;
}
Log(LogInformation, "livestatus", "Executing command: " + m_Command);
Log(LogInformation, "LivestatusQuery", "Executing command: " + m_Command);
ExternalCommandProcessor::Execute(m_Command);
SendResponse(stream, LivestatusErrorOK, "");
}
void Query::ExecuteErrorHelper(const Stream::Ptr& stream)
void LivestatusQuery::ExecuteErrorHelper(const Stream::Ptr& stream)
{
Log(LogDebug, "livestatus", "ERROR: Code: '" + Convert::ToString(m_ErrorCode) + "' Message: '" + m_ErrorMessage + "'.");
Log(LogDebug, "LivestatusQuery", "ERROR: Code: '" + Convert::ToString(m_ErrorCode) + "' Message: '" + m_ErrorMessage + "'.");
SendResponse(stream, m_ErrorCode, m_ErrorMessage);
}
void Query::SendResponse(const Stream::Ptr& stream, int code, const String& data)
void LivestatusQuery::SendResponse(const Stream::Ptr& stream, int code, const String& data)
{
if (m_ResponseHeader == "fixed16")
PrintFixed16(stream, code, data);
@ -521,12 +521,12 @@ void Query::SendResponse(const Stream::Ptr& stream, int code, const String& data
std::ostringstream info;
info << "Exception thrown while writing to the livestatus socket: " << std::endl
<< DiagnosticInformation(ex);
Log(LogCritical, "livestatus", info.str());
Log(LogCritical, "LivestatusQuery", info.str());
}
}
}
void Query::PrintFixed16(const Stream::Ptr& stream, int code, const String& data)
void LivestatusQuery::PrintFixed16(const Stream::Ptr& stream, int code, const String& data)
{
ASSERT(code >= 100 && code <= 999);
@ -541,14 +541,14 @@ void Query::PrintFixed16(const Stream::Ptr& stream, int code, const String& data
std::ostringstream info;
info << "Exception thrown while writing to the livestatus socket: " << std::endl
<< DiagnosticInformation(ex);
Log(LogCritical, "livestatus", info.str());
Log(LogCritical, "LivestatusQuery", info.str());
}
}
bool Query::Execute(const Stream::Ptr& stream)
bool LivestatusQuery::Execute(const Stream::Ptr& stream)
{
try {
Log(LogInformation, "livestatus", "Executing livestatus query: " + m_Verb);
Log(LogInformation, "LivestatusQuery", "Executing livestatus query: " + m_Verb);
if (m_Verb == "GET")
ExecuteGetHelper(stream);

View File

@ -17,8 +17,8 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
#ifndef QUERY_H
#define QUERY_H
#ifndef LIVESTATUSQUERY_H
#define LIVESTATUSQUERY_H
#include "livestatus/filter.hpp"
#include "livestatus/aggregator.hpp"
@ -42,12 +42,12 @@ enum LivestatusError
/**
* @ingroup livestatus
*/
class Query : public Object
class LivestatusQuery : public Object
{
public:
DECLARE_PTR_TYPEDEFS(Query);
DECLARE_PTR_TYPEDEFS(LivestatusQuery);
Query(const std::vector<String>& lines, const String& compat_log_path);
LivestatusQuery(const std::vector<String>& lines, const String& compat_log_path);
bool Execute(const Stream::Ptr& stream);
@ -97,4 +97,4 @@ private:
}
#endif /* QUERY_H */
#endif /* LIVESTATUSQUERY_H */

View File

@ -18,7 +18,7 @@
******************************************************************************/
#include "livestatus/logtable.hpp"
#include "livestatus/logutility.hpp"
#include "livestatus/livestatuslogutility.hpp"
#include "livestatus/hoststable.hpp"
#include "livestatus/servicestable.hpp"
#include "livestatus/contactstable.hpp"
@ -91,16 +91,16 @@ String LogTable::GetName(void) const
void LogTable::FetchRows(const AddRowFunction& addRowFn)
{
Log(LogNotice, "livestatus", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil));
Log(LogDebug, "LogTable", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil));
/* create log file index */
LogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex);
LivestatusLogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex);
/* generate log cache */
LogUtility::CreateLogCache(m_LogFileIndex, this, m_TimeFrom, m_TimeUntil, addRowFn);
LivestatusLogUtility::CreateLogCache(m_LogFileIndex, this, m_TimeFrom, m_TimeUntil, addRowFn);
}
/* gets called in LogUtility::CreateLogCache */
/* gets called in LivestatusLogUtility::CreateLogCache */
void LogTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, int line_count, int lineno, const AddRowFunction& addRowFn)
{
/* additional attributes only for log table */

View File

@ -18,7 +18,7 @@
******************************************************************************/
#include "livestatus/statehisttable.hpp"
#include "livestatus/logutility.hpp"
#include "livestatus/livestatuslogutility.hpp"
#include "livestatus/hoststable.hpp"
#include "livestatus/servicestable.hpp"
#include "livestatus/contactstable.hpp"
@ -117,7 +117,7 @@ void StateHistTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, in
state_hist_service_states->Add(state_hist_bag);
Log(LogDebug, "livestatus", "statehist: Adding new object '" + checkable->GetName() + "' to services cache.");
Log(LogDebug, "StateHistTable", "statehist: Adding new object '" + checkable->GetName() + "' to services cache.");
} else {
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 */
@ -173,7 +173,7 @@ void StateHistTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, in
state_hist_service_states->Add(state_hist_bag_new);
Log(LogDebug, "livestatus", "statehist: State change detected for object '" +
Log(LogDebug, "StateHistTable", "statehist: State change detected for object '" +
checkable->GetName() + "' in '" + log_line + "'.");
}
break;
@ -252,13 +252,13 @@ String StateHistTable::GetName(void) const
void StateHistTable::FetchRows(const AddRowFunction& addRowFn)
{
Log(LogNotice, "livestatus", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil));
Log(LogDebug, "StateHistTable", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil));
/* create log file index */
LogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex);
LivestatusLogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex);
/* generate log cache */
LogUtility::CreateLogCache(m_LogFileIndex, this, m_TimeFrom, m_TimeUntil, addRowFn);
LivestatusLogUtility::CreateLogCache(m_LogFileIndex, this, m_TimeFrom, m_TimeUntil, addRowFn);
Checkable::Ptr checkable;

View File

@ -18,7 +18,7 @@
******************************************************************************/
#include "livestatus/statustable.hpp"
#include "livestatus/listener.hpp"
#include "livestatus/livestatuslistener.hpp"
#include "icinga/icingaapplication.hpp"
#include "icinga/cib.hpp"
#include "icinga/host.hpp"
@ -152,12 +152,12 @@ Value StatusTable::ServiceChecksRateAccessor(const Value&)
Value StatusTable::ExternalCommandsAccessor(const Value&)
{
return Query::GetExternalCommands();
return LivestatusQuery::GetExternalCommands();
}
Value StatusTable::ExternalCommandsRateAccessor(const Value&)
{
return (Query::GetExternalCommands() / (Utility::GetTime() - Application::GetStartTime()));
return (LivestatusQuery::GetExternalCommands() / (Utility::GetTime() - Application::GetStartTime()));
}
Value StatusTable::NagiosPidAccessor(const Value&)

View File

@ -105,7 +105,7 @@ void NotificationComponent::NotificationTimerHandler(void)
}
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);
} catch (const std::exception& ex) {
std::ostringstream msgbuf;
@ -113,7 +113,7 @@ void NotificationComponent::NotificationTimerHandler(void)
<< GetName() << "': " << DiagnosticInformation(ex);
String message = msgbuf.str();
Log(LogWarning, "icinga", message);
Log(LogWarning, "NotificationComponent", message);
}
}
}

View File

@ -77,16 +77,16 @@ void GraphiteWriter::ReconnectTimerHandler(void)
try {
if (m_Stream) {
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;
}
} 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>();
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());
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";
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);
@ -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
<< DiagnosticInformation(ex);
Log(LogCritical, "perfdata", msgbuf.str());
Log(LogCritical, "GraphiteWriter", msgbuf.str());
m_Stream.reset();
}

View File

@ -122,7 +122,7 @@ void PerfdataWriter::RotateFile(std::ofstream& output, const String& temp_path,
output.open(temp_path.CStr());
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)

View File

@ -149,9 +149,9 @@ void Application::SetResourceLimits(void)
rl.rlim_max = rl.rlim_cur;
if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
Log(LogNotice, "base", "Could not adjust resource limit for open file handles (RLIMIT_NOFILE)");
Log(LogNotice, "Application", "Could not adjust resource limit for open file handles (RLIMIT_NOFILE)");
# else /* RLIMIT_NOFILE */
Log(LogNotice, "base", "System does not support adjusting the resource limit for open file handles (RLIMIT_NOFILE)");
Log(LogNotice, "Application", "System does not support adjusting the resource limit for open file handles (RLIMIT_NOFILE)");
# endif /* RLIMIT_NOFILE */
# ifdef RLIMIT_NPROC
@ -159,9 +159,9 @@ void Application::SetResourceLimits(void)
rl.rlim_max = rl.rlim_cur;
if (setrlimit(RLIMIT_NPROC, &rl) < 0)
Log(LogNotice, "base", "Could not adjust resource limit for number of processes (RLIMIT_NPROC)");
Log(LogNotice, "Application", "Could not adjust resource limit for number of processes (RLIMIT_NPROC)");
# else /* RLIMIT_NPROC */
Log(LogNotice, "base", "System does not support adjusting the resource limit for number of processes (RLIMIT_NPROC)");
Log(LogNotice, "Application", "System does not support adjusting the resource limit for number of processes (RLIMIT_NPROC)");
# endif /* RLIMIT_NPROC */
# ifdef RLIMIT_STACK
@ -181,7 +181,7 @@ void Application::SetResourceLimits(void)
rl.rlim_max = rl.rlim_cur;
if (setrlimit(RLIMIT_STACK, &rl) < 0)
Log(LogNotice, "base", "Could not adjust resource limit for stack size (RLIMIT_STACK)");
Log(LogNotice, "Application", "Could not adjust resource limit for stack size (RLIMIT_STACK)");
else {
char **new_argv = static_cast<char **>(malloc(sizeof(char *) * (argc + 2)));
@ -209,7 +209,7 @@ void Application::SetResourceLimits(void)
}
}
# else /* RLIMIT_STACK */
Log(LogNotice, "base", "System does not support adjusting the resource limit for stack size (RLIMIT_STACK)");
Log(LogNotice, "Application", "System does not support adjusting the resource limit for stack size (RLIMIT_STACK)");
# endif /* RLIMIT_STACK */
#endif /* _WIN32 */
}
@ -250,7 +250,7 @@ mainloop:
Utility::Sleep(2.5);
if (m_RequestReopenLogs) {
Log(LogNotice, "base", "Reopening log files");
Log(LogNotice, "Application", "Reopening log files");
m_RequestReopenLogs = false;
OnReopenLogs();
}
@ -264,7 +264,7 @@ mainloop:
msgbuf << "We jumped "
<< (timeDiff < 0 ? "forward" : "backward")
<< " in time: " << abs(timeDiff) << " seconds";
Log(LogInformation, "base", msgbuf.str());
Log(LogInformation, "Application", msgbuf.str());
Timer::AdjustTimers(-timeDiff);
}
@ -285,7 +285,7 @@ mainloop:
goto mainloop;
}
Log(LogInformation, "base", "Shutting down Icinga...");
Log(LogInformation, "Application", "Shutting down Icinga...");
DynamicObject::StopObjects();
Application::GetInstance()->OnShutdown();
@ -307,13 +307,13 @@ void Application::OnShutdown(void)
static void ReloadProcessCallback(const ProcessResult& pr)
{
if (pr.ExitStatus != 0)
Log(LogCritical, "base", "Found error in config: reloading aborted");
Log(LogCritical, "Application", "Found error in config: reloading aborted");
l_Restarting = false;
}
pid_t Application::StartReloadProcess(void)
{
Log(LogInformation, "base", "Got reload command: Starting new instance.");
Log(LogInformation, "Application", "Got reload command: Starting new instance.");
// prepare arguments
Array::Ptr args = make_shared<Array>();
@ -683,7 +683,7 @@ void Application::UpdatePidFile(const String& filename, pid_t pid)
lock.l_whence = SEEK_SET;
if (fcntl(fd, F_SETLK, &lock) < 0) {
Log(LogCritical, "base", "Could not lock PID file. Make sure that only one instance of the application is running.");
Log(LogCritical, "Application", "Could not lock PID file. Make sure that only one instance of the application is running.");
_exit(EXIT_FAILURE);
}

View File

@ -229,7 +229,7 @@ Value DynamicObject::InvokeMethod(const String& method,
void DynamicObject::DumpObjects(const String& filename, int attributeTypes)
{
Log(LogInformation, "base", "Dumping program state to file '" + filename + "'");
Log(LogInformation, "DynamicObject", "Dumping program state to file '" + filename + "'");
String tempFilename = filename + ".tmp";
@ -297,7 +297,7 @@ void DynamicObject::RestoreObject(const String& message, int attributeTypes)
ASSERT(!object->IsActive());
#ifdef _DEBUG
Log(LogDebug, "base", "Restoring object '" + name + "' of type '" + type + "'.");
Log(LogDebug, "DynamicObject", "Restoring object '" + name + "' of type '" + type + "'.");
#endif /* _DEBUG */
Dictionary::Ptr update = persistentObject->Get("update");
Deserialize(object, update, false, attributeTypes);
@ -306,7 +306,7 @@ void DynamicObject::RestoreObject(const String& message, int attributeTypes)
void DynamicObject::RestoreObjects(const String& filename, int attributeTypes)
{
Log(LogInformation, "base", "Restoring program state from file '" + filename + "'");
Log(LogInformation, "DynamicObject", "Restoring program state from file '" + filename + "'");
std::fstream fp;
fp.open(filename.CStr(), std::ios_base::in);
@ -329,7 +329,7 @@ void DynamicObject::RestoreObjects(const String& filename, int attributeTypes)
std::ostringstream msgbuf;
msgbuf << "Restored " << restored << " objects";
Log(LogInformation, "base", msgbuf.str());
Log(LogInformation, "DynamicObject", msgbuf.str());
}
void DynamicObject::StopObjects(void)

View File

@ -426,7 +426,7 @@ void Process::Run(const boost::function<void(const ProcessResult&)>& callback)
m_FD = outReadPipe;
m_PID = pi.dwProcessId;
Log(LogNotice, "base", "Running command '" + m_Arguments +
Log(LogNotice, "Process", "Running command '" + m_Arguments +
"': PID " + Convert::ToString(m_PID));
#else /* _WIN32 */
@ -531,7 +531,7 @@ void Process::Run(const boost::function<void(const ProcessResult&)>& callback)
m_PID = m_Process;
Log(LogNotice, "base", "Running command '" + boost::algorithm::join(m_Arguments, "', '") +
Log(LogNotice, "Process", "Running command '" + boost::algorithm::join(m_Arguments, "', '") +
"': PID " + Convert::ToString(m_PID));
m_Arguments.clear();
@ -582,7 +582,7 @@ bool Process::DoEvents(void)
double timeout = m_Result.ExecutionStart + m_Timeout;
if (timeout < Utility::GetTime()) {
Log(LogNotice, "base", "Killing process '" + Convert::ToString(m_PID) + " after timeout of " + Convert::ToString(m_Timeout) + " seconds");
Log(LogNotice, "Process", "Killing process '" + Convert::ToString(m_PID) + " after timeout of " + Convert::ToString(m_Timeout) + " seconds");
m_OutputStream << "<Timeout exceeded.>";
#ifdef _WIN32
@ -630,7 +630,7 @@ bool Process::DoEvents(void)
DWORD exitcode;
GetExitCodeProcess(m_Process, &exitcode);
Log(LogNotice, "base", "PID " + Convert::ToString(m_PID) + " terminated with exit code " + Convert::ToString(exitcode));
Log(LogNotice, "Process", "PID " + Convert::ToString(m_PID) + " terminated with exit code " + Convert::ToString(exitcode));
#else /* _WIN32 */
int status, exitcode;
if (waitpid(m_Process, &status, 0) != m_Process) {
@ -642,9 +642,9 @@ bool Process::DoEvents(void)
if (WIFEXITED(status)) {
exitcode = WEXITSTATUS(status);
Log(LogNotice, "base", "PID " + Convert::ToString(m_PID) + " terminated with exit code " + Convert::ToString(exitcode));
Log(LogNotice, "Process", "PID " + Convert::ToString(m_PID) + " terminated with exit code " + Convert::ToString(exitcode));
} else if (WIFSIGNALED(status)) {
Log(LogNotice, "base", "PID " + Convert::ToString(m_PID) + " was terminated by signal " + Convert::ToString(WTERMSIG(status)));
Log(LogNotice, "Process", "PID " + Convert::ToString(m_PID) + " was terminated by signal " + Convert::ToString(WTERMSIG(status)));
std::ostringstream outputbuf;
outputbuf << "<Terminated by signal " << WTERMSIG(status) << ".>";

View File

@ -136,9 +136,9 @@ void ThreadPool::WorkerThread::ThreadProc(Queue& queue)
msgbuf << "Exception thrown in event handler: " << std::endl
<< DiagnosticInformation(ex);
Log(LogCritical, "base", msgbuf.str());
Log(LogCritical, "ThreadPool", msgbuf.str());
} catch (...) {
Log(LogCritical, "base", "Exception of unknown type thrown in event handler.");
Log(LogCritical, "ThreadPool", "Exception of unknown type thrown in event handler.");
}
double et = Utility::GetTime();
@ -178,7 +178,7 @@ void ThreadPool::WorkerThread::ThreadProc(Queue& queue)
msgbuf << "Event call took " << (et - st) << "s";
# endif /* RUSAGE_THREAD */
Log(LogWarning, "base", msgbuf.str());
Log(LogWarning, "ThreadPool", msgbuf.str());
}
#endif /* _DEBUG */
}
@ -289,7 +289,7 @@ void ThreadPool::ManagerThreadProc(void)
if (tthreads != 0) {
std::ostringstream msgbuf;
msgbuf << "Thread pool; current: " << alive << "; adjustment: " << tthreads;
Log(LogNotice, "base", msgbuf.str());
Log(LogNotice, "ThreadPool", msgbuf.str());
}
for (int i = 0; i < -tthreads; i++)
@ -319,7 +319,7 @@ void ThreadPool::ManagerThreadProc(void)
<< (long)(total_avg_latency * 1000 / (sizeof(m_Queues) / sizeof(m_Queues[0]))) << "ms"
<< "; Threads: " << total_alive
<< "; Pool utilization: " << (total_utilization / (sizeof(m_Queues) / sizeof(m_Queues[0]))) << "%";
Log(LogNotice, "base", msgbuf.str());
Log(LogNotice, "ThreadPool", msgbuf.str());
}
}
}
@ -331,7 +331,7 @@ void ThreadPool::Queue::SpawnWorker(boost::thread_group& group)
{
for (size_t i = 0; i < sizeof(Threads) / sizeof(Threads[0]); i++) {
if (Threads[i].State == ThreadDead) {
Log(LogDebug, "base", "Spawning worker thread.");
Log(LogDebug, "ThreadPool", "Spawning worker thread.");
Threads[i] = WorkerThread(ThreadIdle);
Threads[i].Thread = group.create_thread(boost::bind(&ThreadPool::WorkerThread::ThreadProc, boost::ref(Threads[i]), boost::ref(*this)));
@ -348,7 +348,7 @@ void ThreadPool::Queue::KillWorker(boost::thread_group& group)
{
for (size_t i = 0; i < sizeof(Threads) / sizeof(Threads[0]); i++) {
if (Threads[i].State == ThreadIdle && !Threads[i].Zombie) {
Log(LogDebug, "base", "Killing worker thread.");
Log(LogDebug, "ThreadPool", "Killing worker thread.");
group.remove_thread(Threads[i].Thread);
Threads[i].Thread->detach();

View File

@ -368,7 +368,7 @@ Utility::LoadExtensionLibrary(const String& library)
path = "lib" + library + ".so";
#endif /* _WIN32 */
Log(LogInformation, "base", "Loading library '" + path + "'");
Log(LogInformation, "Utility", "Loading library '" + path + "'");
#ifdef _WIN32
HMODULE hModule = LoadLibrary(path.CStr());

View File

@ -124,7 +124,7 @@ void WorkQueue::StatusTimerHandler(void)
{
boost::mutex::scoped_lock lock(m_Mutex);
Log(LogNotice, "base", "WQ #" + Convert::ToString(m_ID) + " items: " + Convert::ToString(m_Items.size()));
Log(LogNotice, "WorkQueue", "#" + Convert::ToString(m_ID) + " items: " + Convert::ToString(m_Items.size()));
}
void WorkQueue::WorkerThreadProc(void)

View File

@ -52,7 +52,7 @@ Value AExpression::Evaluate(const Dictionary::Ptr& locals) const
if (m_Operator != &AExpression::OpLiteral) {
std::ostringstream msgbuf;
ShowCodeFragment(msgbuf, m_DebugInfo, false);
Log(LogDebug, "config", "Executing:\n" + msgbuf.str());
Log(LogDebug, "AExpression", "Executing:\n" + msgbuf.str());
}
#endif /* _DEBUG */

View File

@ -200,7 +200,7 @@ void ConfigCompiler::CompileFile(const String& path, const String& zone)
<< boost::errinfo_errno(errno)
<< boost::errinfo_file_name(path));
Log(LogInformation, "config", "Compiling config file: " + path);
Log(LogInformation, "ConfigCompiler", "Compiling config file: " + path);
return CompileStream(path, &stream, zone);
}
@ -225,7 +225,7 @@ void ConfigCompiler::CompileText(const String& path, const String& text, const S
*/
void ConfigCompiler::AddIncludeSearchDir(const String& dir)
{
Log(LogInformation, "config", "Adding include search dir: " + dir);
Log(LogInformation, "ConfigCompiler", "Adding include search dir: " + dir);
m_IncludeSearchDirs.push_back(dir);
}

View File

@ -161,7 +161,7 @@ DynamicObject::Ptr ConfigItem::Commit(void)
ASSERT(!OwnsLock());
#ifdef _DEBUG
Log(LogDebug, "base", "Commit called for ConfigItem Type=" + GetType() + ", Name=" + GetName());
Log(LogDebug, "ConfigItem", "Commit called for ConfigItem Type=" + GetType() + ", Name=" + GetName());
#endif /* _DEBUG */
/* Make sure the type is valid. */
@ -271,7 +271,7 @@ bool ConfigItem::ValidateItems(void)
ParallelWorkQueue upq;
Log(LogInformation, "config", "Validating config items (step 1)...");
Log(LogInformation, "ConfigItem", "Validating config items (step 1)...");
BOOST_FOREACH(const ItemMap::value_type& kv, m_Items) {
upq.Enqueue(boost::bind(&ConfigItem::ValidateItem, kv.second));
@ -282,7 +282,7 @@ bool ConfigItem::ValidateItems(void)
if (ConfigCompilerContext::GetInstance()->HasErrors())
return false;
Log(LogInformation, "config", "Committing config items");
Log(LogInformation, "ConfigItem", "Committing config items");
BOOST_FOREACH(const ItemMap::value_type& kv, m_Items) {
upq.Enqueue(boost::bind(&ConfigItem::Commit, kv.second));
@ -298,7 +298,7 @@ bool ConfigItem::ValidateItems(void)
objects.push_back(object);
}
Log(LogInformation, "config", "Triggering OnConfigLoaded signal for config items");
Log(LogInformation, "ConfigItem", "Triggering OnConfigLoaded signal for config items");
BOOST_FOREACH(const DynamicObject::Ptr& object, objects) {
upq.Enqueue(boost::bind(&DynamicObject::OnConfigLoaded, object));
@ -306,16 +306,16 @@ bool ConfigItem::ValidateItems(void)
upq.Join();
Log(LogInformation, "config", "Evaluating 'object' rules (step 1)...");
Log(LogInformation, "ConfigItem", "Evaluating 'object' rules (step 1)...");
ObjectRule::EvaluateRules(false);
Log(LogInformation, "config", "Evaluating 'apply' rules...");
Log(LogInformation, "ConfigItem", "Evaluating 'apply' rules...");
ApplyRule::EvaluateRules(true);
Log(LogInformation, "config", "Evaluating 'object' rules (step 2)...");
Log(LogInformation, "ConfigItem", "Evaluating 'object' rules (step 2)...");
ObjectRule::EvaluateRules(true);
Log(LogInformation, "config", "Validating config items (step 2)...");
Log(LogInformation, "ConfigItem", "Validating config items (step 2)...");
BOOST_FOREACH(const ItemMap::value_type& kv, m_Items) {
upq.Enqueue(boost::bind(&ConfigItem::ValidateItem, kv.second));
@ -330,7 +330,7 @@ bool ConfigItem::ValidateItems(void)
BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) {
int count = std::distance(type->GetObjects().first, type->GetObjects().second);
if (count > 0)
Log(LogInformation, "config", "Checked " + Convert::ToString(count) + " " + type->GetName() + "(s).");
Log(LogInformation, "ConfigItem", "Checked " + Convert::ToString(count) + " " + type->GetName() + "(s).");
}
return !ConfigCompilerContext::GetInstance()->HasErrors();
@ -345,10 +345,10 @@ bool ConfigItem::ActivateItems(void)
try {
DynamicObject::RestoreObjects(Application::GetStatePath());
} catch (const std::exception& ex) {
Log(LogCritical, "config", "Failed to restore state file: " + DiagnosticInformation(ex));
Log(LogCritical, "ConfigItem", "Failed to restore state file: " + DiagnosticInformation(ex));
}
Log(LogInformation, "config", "Triggering Start signal for config items");
Log(LogInformation, "ConfigItem", "Triggering Start signal for config items");
ParallelWorkQueue upq;
@ -358,7 +358,7 @@ bool ConfigItem::ActivateItems(void)
continue;
#ifdef _DEBUG
Log(LogDebug, "config", "Activating object '" + object->GetName() + "' of type '" + object->GetType()->GetName() + "'");
Log(LogDebug, "ConfigItem", "Activating object '" + object->GetName() + "' of type '" + object->GetType()->GetName() + "'");
#endif /* _DEBUG */
upq.Enqueue(boost::bind(&DynamicObject::Activate, object));
}
@ -374,7 +374,7 @@ bool ConfigItem::ActivateItems(void)
}
#endif /* _DEBUG */
Log(LogInformation, "config", "Activated all objects.");
Log(LogInformation, "ConfigItem", "Activated all objects.");
return true;
}

View File

@ -49,7 +49,7 @@ void DbConnection::Resume(void)
{
DynamicObject::Resume();
Log(LogInformation, "db_ido", "Resuming IDO connection: " + GetName());
Log(LogInformation, "DbConnection", "Resuming IDO connection: " + GetName());
m_CleanUpTimer = make_shared<Timer>();
m_CleanUpTimer->SetInterval(60);
@ -61,7 +61,7 @@ void DbConnection::Pause(void)
{
DynamicObject::Pause();
Log(LogInformation, "db_ido", "Pausing IDO connection: " + GetName());
Log(LogInformation, "DbConnection", "Pausing IDO connection: " + GetName());
m_CleanUpTimer.reset();
@ -141,13 +141,13 @@ void DbConnection::ProgramStatusHandler(void)
if (!vars)
return;
Log(LogDebug, "db_ido", "Dumping global vars for icinga application");
Log(LogDebug, "DbConnection", "Dumping global vars for icinga application");
ObjectLock olock(vars);
BOOST_FOREACH(const Dictionary::Pair& kv, vars) {
if (!kv.first.IsEmpty()) {
Log(LogDebug, "db_ido", "icinga application customvar key: '" + kv.first + "' value: '" + Convert::ToString(kv.second) + "'");
Log(LogDebug, "DbConnection", "icinga application customvar key: '" + kv.first + "' value: '" + Convert::ToString(kv.second) + "'");
Dictionary::Ptr fields4 = make_shared<Dictionary>();
fields4->Set("varname", Convert::ToString(kv.first));
@ -198,7 +198,7 @@ void DbConnection::CleanUpHandler(void)
continue;
CleanUpExecuteQuery(tables[i].name, tables[i].time_column, now - max_age);
Log(LogNotice, "db_ido", "Cleanup (" + tables[i].name + "): " + Convert::ToString(max_age) +
Log(LogNotice, "DbConnection", "Cleanup (" + tables[i].name + "): " + Convert::ToString(max_age) +
" now: " + Convert::ToString(now) +
" old: " + Convert::ToString(now - max_age));
}

View File

@ -278,11 +278,11 @@ void DbEvents::AddCommentHistory(const Checkable::Ptr& checkable, const Comment:
void DbEvents::AddCommentInternal(const Checkable::Ptr& checkable, const Comment::Ptr& comment, bool historical)
{
if (!comment) {
Log(LogWarning, "db_ido", "comment does not exist. not adding it.");
Log(LogWarning, "DbEvents", "comment does not exist. not adding it.");
return;
}
Log(LogDebug, "db_ido", "adding service comment (id = " + Convert::ToString(comment->GetLegacyId()) + ") for '" + checkable->GetName() + "'");
Log(LogDebug, "DbEvents", "adding service comment (id = " + Convert::ToString(comment->GetLegacyId()) + ") for '" + checkable->GetName() + "'");
/* add the service comment */
AddCommentByType(checkable, comment, historical);
@ -307,7 +307,7 @@ void DbEvents::AddCommentByType(const DynamicObject::Ptr& object, const Comment:
fields1->Set("comment_type", 1);
fields1->Set("internal_comment_id", comment->GetLegacyId());
} else {
Log(LogDebug, "db_ido", "unknown object type for adding comment.");
Log(LogDebug, "DbEvents", "unknown object type for adding comment.");
return;
}
@ -340,7 +340,7 @@ void DbEvents::AddCommentByType(const DynamicObject::Ptr& object, const Comment:
void DbEvents::RemoveComments(const Checkable::Ptr& checkable)
{
Log(LogDebug, "db_ido", "removing service comments for '" + checkable->GetName() + "'");
Log(LogDebug, "DbEvents", "removing service comments for '" + checkable->GetName() + "'");
DbQuery query1;
query1.Table = "comments";
@ -354,11 +354,11 @@ void DbEvents::RemoveComments(const Checkable::Ptr& checkable)
void DbEvents::RemoveComment(const Checkable::Ptr& checkable, const Comment::Ptr& comment)
{
if (!comment) {
Log(LogWarning, "db_ido", "comment does not exist. not deleting it.");
Log(LogWarning, "DbEvents", "comment does not exist. not deleting it.");
return;
}
Log(LogDebug, "db_ido", "removing service comment (id = " + Convert::ToString(comment->GetLegacyId()) + ") for '" + checkable->GetName() + "'");
Log(LogDebug, "DbEvents", "removing service comment (id = " + Convert::ToString(comment->GetLegacyId()) + ") for '" + checkable->GetName() + "'");
/* Status */
DbQuery query1;
@ -423,11 +423,11 @@ void DbEvents::AddDowntimeHistory(const Checkable::Ptr& checkable, const Downtim
void DbEvents::AddDowntimeInternal(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime, bool historical)
{
if (!downtime) {
Log(LogWarning, "db_ido", "downtime does not exist. not adding it.");
Log(LogWarning, "DbEvents", "downtime does not exist. not adding it.");
return;
}
Log(LogDebug, "db_ido", "adding service downtime (id = " + Convert::ToString(downtime->GetLegacyId()) + ") for '" + checkable->GetName() + "'");
Log(LogDebug, "DbEvents", "adding service downtime (id = " + Convert::ToString(downtime->GetLegacyId()) + ") for '" + checkable->GetName() + "'");
/* add the downtime */
AddDowntimeByType(checkable, downtime, historical);}
@ -446,7 +446,7 @@ void DbEvents::AddDowntimeByType(const Checkable::Ptr& checkable, const Downtime
fields1->Set("downtime_type", 1);
fields1->Set("internal_downtime_id", downtime->GetLegacyId());
} else {
Log(LogDebug, "db_ido", "unknown object type for adding downtime.");
Log(LogDebug, "DbEvents", "unknown object type for adding downtime.");
return;
}
@ -485,7 +485,7 @@ void DbEvents::AddDowntimeByType(const Checkable::Ptr& checkable, const Downtime
void DbEvents::RemoveDowntimes(const Checkable::Ptr& checkable)
{
Log(LogDebug, "db_ido", "removing service downtimes for '" + checkable->GetName() + "'");
Log(LogDebug, "DbEvents", "removing service downtimes for '" + checkable->GetName() + "'");
DbQuery query1;
query1.Table = "scheduleddowntime";
@ -499,11 +499,11 @@ void DbEvents::RemoveDowntimes(const Checkable::Ptr& checkable)
void DbEvents::RemoveDowntime(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime)
{
if (!downtime) {
Log(LogWarning, "db_ido", "downtime does not exist. not adding it.");
Log(LogWarning, "DbEvents", "downtime does not exist. not adding it.");
return;
}
Log(LogDebug, "db_ido", "removing service downtime (id = " + Convert::ToString(downtime->GetLegacyId()) + ") for '" + checkable->GetName() + "'");
Log(LogDebug, "DbEvents", "removing service downtime (id = " + Convert::ToString(downtime->GetLegacyId()) + ") for '" + checkable->GetName() + "'");
/* Status */
DbQuery query1;
@ -543,11 +543,11 @@ void DbEvents::RemoveDowntime(const Checkable::Ptr& checkable, const Downtime::P
void DbEvents::TriggerDowntime(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime)
{
if (!downtime) {
Log(LogWarning, "db_ido", "downtime does not exist. not updating it.");
Log(LogWarning, "DbEvents", "downtime does not exist. not updating it.");
return;
}
Log(LogDebug, "db_ido", "updating triggered service downtime (id = " + Convert::ToString(downtime->GetLegacyId()) + ") for '" + checkable->GetName() + "'");
Log(LogDebug, "DbEvents", "updating triggered service downtime (id = " + Convert::ToString(downtime->GetLegacyId()) + ") for '" + checkable->GetName() + "'");
double now = Utility::GetTime();
std::pair<unsigned long, unsigned long> time_bag = CompatUtility::ConvertTimestamp(now);
@ -629,7 +629,7 @@ void DbEvents::TriggerDowntime(const Checkable::Ptr& checkable, const Downtime::
void DbEvents::AddAcknowledgementHistory(const Checkable::Ptr& checkable, const String& author, const String& comment,
AcknowledgementType type, double expiry)
{
Log(LogDebug, "db_ido", "add acknowledgement history for '" + checkable->GetName() + "'");
Log(LogDebug, "DbEvents", "add acknowledgement history for '" + checkable->GetName() + "'");
double now = Utility::GetTime();
std::pair<unsigned long, unsigned long> time_bag = CompatUtility::ConvertTimestamp(now);
@ -669,14 +669,14 @@ void DbEvents::AddAcknowledgementHistory(const Checkable::Ptr& checkable, const
void DbEvents::AddAcknowledgement(const Checkable::Ptr& checkable, AcknowledgementType type)
{
Log(LogDebug, "db_ido", "add acknowledgement for '" + checkable->GetName() + "'");
Log(LogDebug, "DbEvents", "add acknowledgement for '" + checkable->GetName() + "'");
AddAcknowledgementInternal(checkable, type, true);
}
void DbEvents::RemoveAcknowledgement(const Checkable::Ptr& checkable)
{
Log(LogDebug, "db_ido", "remove acknowledgement for '" + checkable->GetName() + "'");
Log(LogDebug, "DbEvents", "remove acknowledgement for '" + checkable->GetName() + "'");
AddAcknowledgementInternal(checkable, AcknowledgementNone, false);
}
@ -716,7 +716,7 @@ void DbEvents::AddAcknowledgementInternal(const Checkable::Ptr& checkable, Ackno
void DbEvents::AddNotificationHistory(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const std::set<User::Ptr>& users, NotificationType type,
const CheckResult::Ptr& cr, const String& author, const String& text)
{
Log(LogDebug, "db_ido", "add notification history for '" + checkable->GetName() + "'");
Log(LogDebug, "DbEvents", "add notification history for '" + checkable->GetName() + "'");
/* start and end happen at the same time */
double now = Utility::GetTime();
@ -768,7 +768,7 @@ void DbEvents::AddNotificationHistory(const Notification::Ptr& notification, con
/* filtered users */
BOOST_FOREACH(const User::Ptr& user, users) {
Log(LogDebug, "db_ido", "add contact notification history for service '" + checkable->GetName() + "' and user '" + user->GetName() + "'.");
Log(LogDebug, "DbEvents", "add contact notification history for service '" + checkable->GetName() + "' and user '" + user->GetName() + "'.");
Dictionary::Ptr fields2 = make_shared<Dictionary>();
fields2->Set("contact_object_id", user);
@ -788,7 +788,7 @@ void DbEvents::AddNotificationHistory(const Notification::Ptr& notification, con
/* statehistory */
void DbEvents::AddStateChangeHistory(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type)
{
Log(LogDebug, "db_ido", "add state change history for '" + checkable->GetName() + "'");
Log(LogDebug, "DbEvents", "add state change history for '" + checkable->GetName() + "'");
double now = Utility::GetTime();
std::pair<unsigned long, unsigned long> time_bag = CompatUtility::ConvertTimestamp(now);
@ -897,7 +897,7 @@ void DbEvents::AddCheckResultLogHistory(const Checkable::Ptr& checkable, const C
type = LogEntryTypeServiceCritical;
break;
default:
Log(LogCritical, "db_ido", "Unknown service state: " + Convert::ToString(state_after));
Log(LogCritical, "DbEvents", "Unknown service state: " + Convert::ToString(state_after));
return;
}
} else {
@ -922,7 +922,7 @@ void DbEvents::AddCheckResultLogHistory(const Checkable::Ptr& checkable, const C
type = LogEntryTypeHostDown;
break;
default:
Log(LogCritical, "db_ido", "Unknown host state: " + Convert::ToString(state_after));
Log(LogCritical, "DbEvents", "Unknown host state: " + Convert::ToString(state_after));
return;
}
@ -1076,7 +1076,7 @@ void DbEvents::AddFlappingLogHistory(const Checkable::Ptr& checkable, FlappingSt
flapping_state_str = "DISABLED";
break;
default:
Log(LogCritical, "db_ido", "Unknown flapping state: " + Convert::ToString(flapping_state));
Log(LogCritical, "DbEvents", "Unknown flapping state: " + Convert::ToString(flapping_state));
return;
}
@ -1106,7 +1106,7 @@ void DbEvents::AddFlappingLogHistory(const Checkable::Ptr& checkable, FlappingSt
void DbEvents::AddLogHistory(const Checkable::Ptr& checkable, String buffer, LogEntryType type)
{
Log(LogDebug, "db_ido", "add log entry history for '" + checkable->GetName() + "'");
Log(LogDebug, "DbEvents", "add log entry history for '" + checkable->GetName() + "'");
double now = Utility::GetTime();
std::pair<unsigned long, unsigned long> time_bag = CompatUtility::ConvertTimestamp(now);
@ -1139,7 +1139,7 @@ void DbEvents::AddLogHistory(const Checkable::Ptr& checkable, String buffer, Log
/* flappinghistory */
void DbEvents::AddFlappingHistory(const Checkable::Ptr& checkable, FlappingState flapping_state)
{
Log(LogDebug, "db_ido", "add flapping history for '" + checkable->GetName() + "'");
Log(LogDebug, "DbEvents", "add flapping history for '" + checkable->GetName() + "'");
double now = Utility::GetTime();
std::pair<unsigned long, unsigned long> time_bag = CompatUtility::ConvertTimestamp(now);
@ -1167,7 +1167,7 @@ void DbEvents::AddFlappingHistory(const Checkable::Ptr& checkable, FlappingState
fields1->Set("reason_type", 2);
break;
default:
Log(LogDebug, "db_ido", "Unhandled flapping state: " + Convert::ToString(flapping_state));
Log(LogDebug, "DbEvents", "Unhandled flapping state: " + Convert::ToString(flapping_state));
return;
}
@ -1199,7 +1199,7 @@ void DbEvents::AddServiceCheckHistory(const Checkable::Ptr& checkable, const Che
if (!cr)
return;
Log(LogDebug, "db_ido", "add service check history for '" + checkable->GetName() + "'");
Log(LogDebug, "DbEvents", "add service check history for '" + checkable->GetName() + "'");
Host::Ptr host;
Service::Ptr service;
@ -1263,7 +1263,7 @@ void DbEvents::AddServiceCheckHistory(const Checkable::Ptr& checkable, const Che
/* eventhandlers */
void DbEvents::AddEventHandlerHistory(const Checkable::Ptr& checkable)
{
Log(LogDebug, "db_ido", "add eventhandler history for '" + checkable->GetName() + "'");
Log(LogDebug, "DbEvents", "add eventhandler history for '" + checkable->GetName() + "'");
double now = Utility::GetTime();
std::pair<unsigned long, unsigned long> time_bag = CompatUtility::ConvertTimestamp(now);
@ -1305,7 +1305,7 @@ void DbEvents::AddEventHandlerHistory(const Checkable::Ptr& checkable)
/* externalcommands */
void DbEvents::AddExternalCommandHistory(double time, const String& command, const std::vector<String>& arguments)
{
Log(LogDebug, "db_ido", "add external command history");
Log(LogDebug, "DbEvents", "add external command history");
DbQuery query1;
query1.Table = "externalcommands";

View File

@ -127,7 +127,7 @@ void DbObject::SendStatusUpdate(void)
if (GetType()->GetTable() != "endpoint") {
String node = IcingaApplication::GetInstance()->GetNodeName();
Log(LogDebug, "db_ido", "Endpoint node: '" + node + "' status update for '" + GetObject()->GetName() + "'");
Log(LogDebug, "DbObject", "Endpoint node: '" + node + "' status update for '" + GetObject()->GetName() + "'");
Endpoint::Ptr endpoint = Endpoint::GetByName(node);
if (endpoint)
@ -160,7 +160,7 @@ void DbObject::SendVarsConfigUpdate(void)
Dictionary::Ptr vars = CompatUtility::GetCustomAttributeConfig(custom_var_object);
if (vars) {
Log(LogDebug, "db_ido", "Updating object vars for '" + custom_var_object->GetName() + "'");
Log(LogDebug, "DbObject", "Updating object vars for '" + custom_var_object->GetName() + "'");
ObjectLock olock (vars);
@ -168,7 +168,7 @@ void DbObject::SendVarsConfigUpdate(void)
if (!kv.first.IsEmpty()) {
int overridden = custom_var_object->IsVarOverridden(kv.first) ? 1 : 0;
Log(LogDebug, "db_ido", "object customvar key: '" + kv.first + "' value: '" + Convert::ToString(kv.second) +
Log(LogDebug, "DbObject", "object customvar key: '" + kv.first + "' value: '" + Convert::ToString(kv.second) +
"' overridden: " + Convert::ToString(overridden));
Dictionary::Ptr fields = make_shared<Dictionary>();
@ -202,7 +202,7 @@ void DbObject::SendVarsStatusUpdate(void)
Dictionary::Ptr vars = CompatUtility::GetCustomAttributeConfig(custom_var_object);
if (vars) {
Log(LogDebug, "db_ido", "Updating object vars for '" + custom_var_object->GetName() + "'");
Log(LogDebug, "DbObject", "Updating object vars for '" + custom_var_object->GetName() + "'");
ObjectLock olock (vars);
@ -210,7 +210,7 @@ void DbObject::SendVarsStatusUpdate(void)
if (!kv.first.IsEmpty()) {
int overridden = custom_var_object->IsVarOverridden(kv.first) ? 1 : 0;
Log(LogDebug, "db_ido", "object customvar key: '" + kv.first + "' value: '" + Convert::ToString(kv.second) +
Log(LogDebug, "DbObject", "object customvar key: '" + kv.first + "' value: '" + Convert::ToString(kv.second) +
"' overridden: " + Convert::ToString(overridden));
Dictionary::Ptr fields = make_shared<Dictionary>();
@ -322,7 +322,7 @@ void DbObject::VarsChangedHandler(const CustomVarObject::Ptr& object)
{
DbObject::Ptr dbobj = GetOrCreateByObject(object);
Log(LogDebug, "db_ido", "Vars changed for object '" + object->GetName() + "'");
Log(LogDebug, "DbObject", "Vars changed for object '" + object->GetName() + "'");
if (!dbobj)
return;

View File

@ -62,7 +62,7 @@ Dictionary::Ptr EndpointDbObject::GetStatusFields(void) const
Dictionary::Ptr fields = make_shared<Dictionary>();
Endpoint::Ptr endpoint = static_pointer_cast<Endpoint>(GetObject());
Log(LogDebug, "db_ido", "update status for endpoint '" + endpoint->GetName() + "'");
Log(LogDebug, "EndpointDbObject", "update status for endpoint '" + endpoint->GetName() + "'");
fields->Set("identity", endpoint->GetName());
fields->Set("node", IcingaApplication::GetInstance()->GetNodeName());
@ -75,7 +75,7 @@ void EndpointDbObject::UpdateConnectedStatus(const Endpoint::Ptr& endpoint)
{
bool connected = EndpointIsConnected(endpoint);
Log(LogDebug, "db_ido", "update is_connected=" + Convert::ToString(connected ? 1 : 0) + " for endpoint '" + endpoint->GetName() + "'");
Log(LogDebug, "EndpointDbObject", "update is_connected=" + Convert::ToString(connected ? 1 : 0) + " for endpoint '" + endpoint->GetName() + "'");
DbQuery query1;
query1.Table = "endpointstatus";

View File

@ -184,7 +184,7 @@ void HostDbObject::OnConfigUpdate(void)
if (!parent)
continue;
Log(LogDebug, "db_ido", "host parents: " + parent->GetName());
Log(LogDebug, "HostDbObject", "host parents: " + parent->GetName());
/* parents: host_id, parent_host_object_id */
Dictionary::Ptr fields1 = make_shared<Dictionary>();
@ -201,19 +201,19 @@ void HostDbObject::OnConfigUpdate(void)
}
/* host dependencies */
Log(LogDebug, "db_ido", "host dependencies for '" + host->GetName() + "'");
Log(LogDebug, "HostDbObject", "host dependencies for '" + host->GetName() + "'");
BOOST_FOREACH(const Dependency::Ptr& dep, host->GetDependencies()) {
Checkable::Ptr parent = dep->GetParent();
if (!parent) {
Log(LogDebug, "db_ido", "Missing parent for dependency '" + dep->GetName() + "'.");
Log(LogDebug, "HostDbObject", "Missing parent for dependency '" + dep->GetName() + "'.");
continue;
}
int state_filter = dep->GetStateFilter();
Log(LogDebug, "db_ido", "parent host: " + parent->GetName());
Log(LogDebug, "HostDbObject", "parent host: " + parent->GetName());
Dictionary::Ptr fields2 = make_shared<Dictionary>();
fields2->Set("host_object_id", parent);
@ -232,10 +232,10 @@ void HostDbObject::OnConfigUpdate(void)
OnQuery(query2);
}
Log(LogDebug, "db_ido", "host contacts: " + host->GetName());
Log(LogDebug, "HostDbObject", "host contacts: " + host->GetName());
BOOST_FOREACH(const User::Ptr& user, CompatUtility::GetCheckableNotificationUsers(host)) {
Log(LogDebug, "db_ido", "host contacts: " + user->GetName());
Log(LogDebug, "HostDbObject", "host contacts: " + user->GetName());
Dictionary::Ptr fields_contact = make_shared<Dictionary>();
fields_contact->Set("host_id", DbValue::FromObjectInsertID(host));
@ -250,10 +250,10 @@ void HostDbObject::OnConfigUpdate(void)
OnQuery(query_contact);
}
Log(LogDebug, "db_ido", "host contactgroups: " + host->GetName());
Log(LogDebug, "HostDbObject", "host contactgroups: " + host->GetName());
BOOST_FOREACH(const UserGroup::Ptr& usergroup, CompatUtility::GetCheckableNotificationUserGroups(host)) {
Log(LogDebug, "db_ido", "host contactgroups: " + usergroup->GetName());
Log(LogDebug, "HostDbObject", "host contactgroups: " + usergroup->GetName());
Dictionary::Ptr fields_contact = make_shared<Dictionary>();
fields_contact->Set("host_id", DbValue::FromObjectInsertID(host));

View File

@ -177,17 +177,17 @@ void ServiceDbObject::OnConfigUpdate(void)
Service::Ptr service = static_pointer_cast<Service>(GetObject());
/* service dependencies */
Log(LogDebug, "db_ido", "service dependencies for '" + service->GetName() + "'");
Log(LogDebug, "ServiceDbObject", "service dependencies for '" + service->GetName() + "'");
BOOST_FOREACH(const Dependency::Ptr& dep, service->GetDependencies()) {
Checkable::Ptr parent = dep->GetParent();
if (!parent) {
Log(LogDebug, "db_ido", "Missing parent for dependency '" + dep->GetName() + "'.");
Log(LogDebug, "ServiceDbObject", "Missing parent for dependency '" + dep->GetName() + "'.");
continue;
}
Log(LogDebug, "db_ido", "service parents: " + parent->GetName());
Log(LogDebug, "ServiceDbObject", "service parents: " + parent->GetName());
int state_filter = dep->GetStateFilter();
@ -212,10 +212,10 @@ void ServiceDbObject::OnConfigUpdate(void)
}
/* service contacts, contactgroups */
Log(LogDebug, "db_ido", "service contacts: " + service->GetName());
Log(LogDebug, "ServiceDbObject", "service contacts: " + service->GetName());
BOOST_FOREACH(const User::Ptr& user, CompatUtility::GetCheckableNotificationUsers(service)) {
Log(LogDebug, "db_ido", "service contacts: " + user->GetName());
Log(LogDebug, "ServiceDbObject", "service contacts: " + user->GetName());
Dictionary::Ptr fields_contact = make_shared<Dictionary>();
fields_contact->Set("service_id", DbValue::FromObjectInsertID(service));
@ -230,10 +230,10 @@ void ServiceDbObject::OnConfigUpdate(void)
OnQuery(query_contact);
}
Log(LogDebug, "db_ido", "service contactgroups: " + service->GetName());
Log(LogDebug, "ServiceDbObject", "service contactgroups: " + service->GetName());
BOOST_FOREACH(const UserGroup::Ptr& usergroup, CompatUtility::GetCheckableNotificationUserGroups(service)) {
Log(LogDebug, "db_ido", "service contactgroups: " + usergroup->GetName());
Log(LogDebug, "ServiceDbObject", "service contactgroups: " + usergroup->GetName());
Dictionary::Ptr fields_contact = make_shared<Dictionary>();
fields_contact->Set("service_id", DbValue::FromObjectInsertID(service));

View File

@ -85,7 +85,7 @@ void UserDbObject::OnConfigUpdate(void)
User::Ptr user = static_pointer_cast<User>(GetObject());
/* contact addresses */
Log(LogDebug, "db_ido", "contact addresses for '" + user->GetName() + "'");
Log(LogDebug, "UserDbObject", "contact addresses for '" + user->GetName() + "'");
Dictionary::Ptr vars = user->GetVars();

View File

@ -32,7 +32,7 @@ REGISTER_TYPE(Hello);
*/
int Hello::Main(void)
{
Log(LogInformation, "hello", "Hello World!");
Log(LogInformation, "Hello", "Hello World!");
return 0;
}

View File

@ -32,7 +32,7 @@ Value API::GetAnswerToEverything(const Dictionary::Ptr& params)
if (params)
text = params->Get("text");
Log(LogInformation, "icinga", "Hello from the Icinga 2 API: " + text);
Log(LogInformation, "API", "Hello from the Icinga 2 API: " + text);
return 42;
}

View File

@ -400,7 +400,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
olock.Unlock();
// Log(LogDebug, "icinga", "Flapping: Checkable " + GetName() +
// Log(LogDebug, "Checkable", "Flapping: Checkable " + GetName() +
// " was: " + Convert::ToString(was_flapping) +
// " is: " + Convert::ToString(is_flapping) +
// " threshold: " + Convert::ToString(GetFlappingThreshold()) +
@ -416,10 +416,10 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
if (hardChange) {
OnStateChange(GetSelf(), cr, StateTypeHard, origin);
Log(LogNotice, "icinga", "State Change: Checkable " + GetName() + " hard state change from " + old_state_str + " to " + new_state_str + " detected.");
Log(LogNotice, "Checkable", "State Change: Checkable " + GetName() + " hard state change from " + old_state_str + " to " + new_state_str + " detected.");
} else if (stateChange) {
OnStateChange(GetSelf(), cr, StateTypeSoft, origin);
Log(LogNotice, "icinga", "State Change: Checkable " + GetName() + " soft state change from " + old_state_str + " to " + new_state_str + " detected.");
Log(LogNotice, "Checkable", "State Change: Checkable " + GetName() + " soft state change from " + old_state_str + " to " + new_state_str + " detected.");
}
if (GetStateType() == StateTypeSoft || hardChange || recovery)
@ -431,12 +431,12 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
if (!was_flapping && is_flapping) {
OnNotificationsRequested(GetSelf(), NotificationFlappingStart, cr, "", "");
Log(LogNotice, "icinga", "Flapping: Checkable " + GetName() + " started flapping (" + Convert::ToString(GetFlappingThreshold()) + "% < " + Convert::ToString(GetFlappingCurrent()) + "%).");
Log(LogNotice, "Checkable", "Flapping: Checkable " + GetName() + " started flapping (" + Convert::ToString(GetFlappingThreshold()) + "% < " + Convert::ToString(GetFlappingCurrent()) + "%).");
OnFlappingChanged(GetSelf(), FlappingStarted);
} else if (was_flapping && !is_flapping) {
OnNotificationsRequested(GetSelf(), NotificationFlappingEnd, cr, "", "");
Log(LogNotice, "icinga", "Flapping: Checkable " + GetName() + " stopped flapping (" + Convert::ToString(GetFlappingThreshold()) + "% >= " + Convert::ToString(GetFlappingCurrent()) + "%).");
Log(LogNotice, "Checkable", "Flapping: Checkable " + GetName() + " stopped flapping (" + Convert::ToString(GetFlappingThreshold()) + "% >= " + Convert::ToString(GetFlappingCurrent()) + "%).");
OnFlappingChanged(GetSelf(), FlappingStopped);
} else if (send_notification)
OnNotificationsRequested(GetSelf(), recovery ? NotificationRecovery : NotificationProblem, cr, "", "");
@ -501,7 +501,7 @@ void Checkable::UpdateStatistics(const CheckResult::Ptr& cr, CheckableType type)
else
CIB::UpdatePassiveServiceChecksStatistics(ts, 1);
} else {
Log(LogWarning, "icinga", "Unknown checkable type for statistic update.");
Log(LogWarning, "Checkable", "Unknown checkable type for statistic update.");
}
}

View File

@ -166,7 +166,7 @@ Comment::Ptr Checkable::GetCommentByID(const String& id)
void Checkable::AddCommentsToCache(void)
{
#ifdef _DEBUG
Log(LogDebug, "icinga", "Updating Checkable comments cache.");
Log(LogDebug, "Checkable", "Updating Checkable comments cache.");
#endif /* _DEBUG */
Dictionary::Ptr comments = GetComments();

View File

@ -63,7 +63,7 @@ std::set<Dependency::Ptr> Checkable::GetReverseDependencies(void) const
bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency, int rstack) const
{
if (rstack > 20) {
Log(LogWarning, "icinga", "Too many nested dependencies for service '" + GetName() + "': Dependency failed.");
Log(LogWarning, "Checkable", "Too many nested dependencies for service '" + GetName() + "': Dependency failed.");
return false;
}

View File

@ -104,7 +104,7 @@ String Checkable::AddDowntime(const String& author, const String& comment,
l_DowntimesCache[uid] = GetSelf();
}
Log(LogNotice, "icinga", "Added downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) +
Log(LogNotice, "Checkable", "Added downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) +
"' between '" + Utility::FormatDateTime("%Y-%m-%d %H:%M:%S", startTime) + "' and '" + Utility::FormatDateTime("%Y-%m-%d %H:%M:%S", endTime) + "'.");
OnDowntimeAdded(GetSelf(), downtime, origin);
@ -131,7 +131,7 @@ void Checkable::RemoveDowntime(const String& id, bool cancelled, const MessageOr
String config_owner = downtime->GetConfigOwner();
if (!config_owner.IsEmpty()) {
Log(LogWarning, "icinga", "Cannot remove downtime with ID '" + Convert::ToString(legacy_id) + "'. It is owned by scheduled downtime object '" + config_owner + "'");
Log(LogWarning, "Checkable", "Cannot remove downtime with ID '" + Convert::ToString(legacy_id) + "'. It is owned by scheduled downtime object '" + config_owner + "'");
return;
}
@ -145,7 +145,7 @@ void Checkable::RemoveDowntime(const String& id, bool cancelled, const MessageOr
downtime->SetWasCancelled(cancelled);
Log(LogNotice, "icinga", "Removed downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "' from service '" + owner->GetName() + "'.");
Log(LogNotice, "Checkable", "Removed downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "' from service '" + owner->GetName() + "'.");
OnDowntimeRemoved(owner, downtime, origin);
}
@ -178,16 +178,16 @@ void Checkable::TriggerDowntime(const String& id)
return;
if (downtime->IsActive() && downtime->IsTriggered()) {
Log(LogDebug, "icinga", "Not triggering downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "': already triggered.");
Log(LogDebug, "Checkable", "Not triggering downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "': already triggered.");
return;
}
if (downtime->IsExpired()) {
Log(LogDebug, "icinga", "Not triggering downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "': expired.");
Log(LogDebug, "Checkable", "Not triggering downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "': expired.");
return;
}
Log(LogNotice, "icinga", "Triggering downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "'.");
Log(LogNotice, "Checkable", "Triggering downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "'.");
if (downtime->GetTriggerTime() == 0)
downtime->SetTriggerTime(Utility::GetTime());
@ -245,7 +245,7 @@ void Checkable::StartDowntimesExpiredTimer(void)
void Checkable::AddDowntimesToCache(void)
{
#ifdef _DEBUG
Log(LogDebug, "icinga", "Updating Checkable downtimes cache.");
Log(LogDebug, "Checkable", "Updating Checkable downtimes cache.");
#endif /* _DEBUG */
Dictionary::Ptr downtimes = GetDowntimes();

View File

@ -69,7 +69,7 @@ void Checkable::ExecuteEventHandler(void)
if (!ec)
return;
Log(LogNotice, "icinga", "Executing event handler '" + ec->GetName() + "' for service '" + GetName() + "'");
Log(LogNotice, "Checkable", "Executing event handler '" + ec->GetName() + "' for service '" + GetName() + "'");
ec->Execute(GetSelf());

View File

@ -80,7 +80,7 @@ void Checkable::UpdateFlappingStatus(bool stateChange)
if (negative < 0)
negative = 0;
// Log(LogDebug, "icinga", "Flapping counter for '" + GetName() + "' is positive=" + Convert::ToString(positive) + ", negative=" + Convert::ToString(negative));
// Log(LogDebug, "Checkable", "Flapping counter for '" + GetName() + "' is positive=" + Convert::ToString(positive) + ", negative=" + Convert::ToString(negative));
SetFlappingLastChange(now);
SetFlappingPositive(positive);

View File

@ -51,21 +51,21 @@ void Checkable::SendNotifications(NotificationType type, const CheckResult::Ptr&
if (!IcingaApplication::GetInstance()->GetEnableNotifications() || !GetEnableNotifications()) {
if (!force) {
Log(LogInformation, "icinga", "Notifications are disabled for service '" + GetName() + "'.");
Log(LogInformation, "Checkable", "Notifications are disabled for service '" + GetName() + "'.");
return;
}
SetForceNextNotification(false);
}
Log(LogInformation, "icinga", "Sending notifications for object '" + GetName() + "'");
Log(LogInformation, "Checkable", "Sending notifications for object '" + GetName() + "'");
std::set<Notification::Ptr> notifications = GetNotifications();
if (notifications.empty())
Log(LogInformation, "icinga", "Checkable '" + GetName() + "' does not have any notifications.");
Log(LogInformation, "Checkable", "Checkable '" + GetName() + "' does not have any notifications.");
Log(LogDebug, "icinga", "Checkable '" + GetName() + "' has " + Convert::ToString(notifications.size()) + " notification(s).");
Log(LogDebug, "Checkable", "Checkable '" + GetName() + "' has " + Convert::ToString(notifications.size()) + " notification(s).");
BOOST_FOREACH(const Notification::Ptr& notification, notifications) {
try {
@ -76,7 +76,7 @@ void Checkable::SendNotifications(NotificationType type, const CheckResult::Ptr&
<< GetName() << "': " << DiagnosticInformation(ex);
String message = msgbuf.str();
Log(LogWarning, "icinga", message);
Log(LogWarning, "Checkable", message);
}
}
}

View File

@ -38,7 +38,7 @@ void CustomVarObject::SetVars(const Dictionary::Ptr& vars, const MessageOrigin&
{
SetOverrideVars(vars);
Log(LogNotice, "icinga", "Setting vars for object '" + GetName() + "'");
Log(LogNotice, "CustomVarObject", "Setting vars for object '" + GetName() + "'");
OnVarsChanged(GetSelf(), origin);
}

View File

@ -62,7 +62,7 @@ bool Dependency::EvaluateApplyRuleOne(const Checkable::Ptr& checkable, const App
std::ostringstream msgbuf2;
msgbuf2 << "Applying dependency '" << rule.GetName() << "' to object '" << checkable->GetName() << "' for rule " << di;
Log(LogDebug, "icinga", msgbuf2.str());
Log(LogDebug, "Dependency", msgbuf2.str());
ConfigItemBuilder::Ptr builder = make_shared<ConfigItemBuilder>(di);
builder->SetType("Dependency");
@ -120,7 +120,7 @@ void Dependency::EvaluateApplyRule(const ApplyRule& rule)
}
if (apply_count == 0)
Log(LogWarning, "icinga", "Apply rule '" + rule.GetName() + "' for host does not match anywhere!");
Log(LogWarning, "Dependency", "Apply rule '" + rule.GetName() + "' for host does not match anywhere!");
} else if (rule.GetTargetType() == "Service") {
apply_count = 0;
@ -133,10 +133,10 @@ void Dependency::EvaluateApplyRule(const ApplyRule& rule)
}
if (apply_count == 0)
Log(LogWarning, "icinga", "Apply rule '" + rule.GetName() + "' for service does not match anywhere!");
Log(LogWarning, "Dependency", "Apply rule '" + rule.GetName() + "' for service does not match anywhere!");
} else {
Log(LogWarning, "icinga", "Wrong target type for apply rule '" + rule.GetName() + "'!");
Log(LogWarning, "Dependency", "Wrong target type for apply rule '" + rule.GetName() + "'!");
}
}

View File

@ -63,12 +63,12 @@ void Dependency::OnStateLoaded(void)
ASSERT(!OwnsLock());
if (!GetChild())
Log(LogWarning, "icinga", "Dependency '" + GetName() + "' references an invalid child object and will be ignored.");
Log(LogWarning, "Dependency", "Dependency '" + GetName() + "' references an invalid child object and will be ignored.");
else
GetChild()->AddDependency(GetSelf());
if (!GetParent())
Log(LogWarning, "icinga", "Dependency '" + GetName() + "' references an invalid parent object and will always fail.");
Log(LogWarning, "Dependency", "Dependency '" + GetName() + "' references an invalid parent object and will always fail.");
else
GetParent()->AddReverseDependency(GetSelf());
}
@ -97,19 +97,19 @@ bool Dependency::IsAvailable(DependencyType dt) const
/* ignore if it's the same checkable object */
if (parent == GetChild()) {
Log(LogNotice, "icinga", "Dependency '" + GetName() + "' passed: Parent and child " + (service ? "service" : "host") + " are identical.");
Log(LogNotice, "Dependency", "Dependency '" + GetName() + "' passed: Parent and child " + (service ? "service" : "host") + " are identical.");
return true;
}
/* ignore pending */
if (!parent->GetLastCheckResult()) {
Log(LogNotice, "icinga", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' hasn't been checked yet.");
Log(LogNotice, "Dependency", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' hasn't been checked yet.");
return true;
}
/* ignore soft states */
if (parent->GetStateType() == StateTypeSoft) {
Log(LogNotice, "icinga", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' is in a soft state.");
Log(LogNotice, "Dependency", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' is in a soft state.");
return true;
}
@ -122,26 +122,26 @@ bool Dependency::IsAvailable(DependencyType dt) const
/* check state */
if (state & GetStateFilter()) {
Log(LogNotice, "icinga", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' matches state filter.");
Log(LogNotice, "Dependency", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' matches state filter.");
return true;
}
/* ignore if not in time period */
TimePeriod::Ptr tp = GetPeriod();
if (tp && !tp->IsInside(Utility::GetTime())) {
Log(LogNotice, "icinga", "Dependency '" + GetName() + "' passed: Outside time period.");
Log(LogNotice, "Dependency", "Dependency '" + GetName() + "' passed: Outside time period.");
return true;
}
if (dt == DependencyCheckExecution && !GetDisableChecks()) {
Log(LogNotice, "icinga", "Dependency '" + GetName() + "' passed: Checks are not disabled.");
Log(LogNotice, "Dependency", "Dependency '" + GetName() + "' passed: Checks are not disabled.");
return true;
} else if (dt == DependencyNotification && !GetDisableNotifications()) {
Log(LogNotice, "icinga", "Dependency '" + GetName() + "' passed: Notifications are not disabled");
Log(LogNotice, "Dependency", "Dependency '" + GetName() + "' passed: Notifications are not disabled");
return true;
}
Log(LogNotice, "icinga", "Dependency '" + GetName() + "' failed. Parent " +
Log(LogNotice, "Dependency", "Dependency '" + GetName() + "' failed. Parent " +
(service ? "service" : "host") + " '" + parent->GetName() + "' is " +
(service ? Service::StateToString(service->GetState()) : Host::StateToString(host->GetState())));
return false;
@ -168,10 +168,10 @@ Checkable::Ptr Dependency::GetParent(void) const
return Service::Ptr();
if (GetParentServiceName().IsEmpty()) {
Log(LogDebug, "icinga", "Dependency '" + GetName() + "' parent host '" + GetParentHostName() + ".");
Log(LogDebug, "Dependency", "Dependency '" + GetName() + "' parent host '" + GetParentHostName() + ".");
return host;
} else {
Log(LogDebug, "icinga", "Dependency '" + GetName() + "' parent host '" + GetParentHostName() + "' service '" + GetParentServiceName() + "' .");
Log(LogDebug, "Dependency", "Dependency '" + GetName() + "' parent host '" + GetParentHostName() + "' service '" + GetParentServiceName() + "' .");
return host->GetServiceByShortName(GetParentServiceName());
}
}

View File

@ -325,7 +325,7 @@ void ExternalCommandProcessor::ProcessHostCheckResult(double time, const std::ve
result->SetExecutionEnd(time);
result->SetActive(false);
Log(LogNotice, "icinga", "Processing passive check result for host '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Processing passive check result for host '" + arguments[0] + "'");
host->ProcessCheckResult(result);
{
@ -361,7 +361,7 @@ void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const std:
result->SetExecutionEnd(time);
result->SetActive(false);
Log(LogNotice, "icinga", "Processing passive check result for service '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Processing passive check result for service '" + arguments[1] + "'");
service->ProcessCheckResult(result);
{
@ -384,12 +384,12 @@ void ExternalCommandProcessor::ScheduleHostCheck(double, const std::vector<Strin
double planned_check = Convert::ToDouble(arguments[1]);
if (planned_check > host->GetNextCheck()) {
Log(LogNotice, "icinga", "Ignoring reschedule request for host '" +
Log(LogNotice, "ExternalCommandProcessor", "Ignoring reschedule request for host '" +
arguments[0] + "' (next check is already sooner than requested check time)");
return;
}
Log(LogNotice, "icinga", "Rescheduling next check for host '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Rescheduling next check for host '" + arguments[0] + "'");
if (planned_check < Utility::GetTime())
planned_check = Utility::GetTime();
@ -408,7 +408,7 @@ void ExternalCommandProcessor::ScheduleForcedHostCheck(double, const std::vector
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot reschedule forced host check for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Rescheduling next check for host '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Rescheduling next check for host '" + arguments[0] + "'");
{
ObjectLock olock(host);
@ -428,12 +428,12 @@ void ExternalCommandProcessor::ScheduleSvcCheck(double, const std::vector<String
double planned_check = Convert::ToDouble(arguments[2]);
if (planned_check > service->GetNextCheck()) {
Log(LogNotice, "icinga", "Ignoring reschedule request for service '" +
Log(LogNotice, "ExternalCommandProcessor", "Ignoring reschedule request for service '" +
arguments[1] + "' (next check is already sooner than requested check time)");
return;
}
Log(LogNotice, "icinga", "Rescheduling next check for service '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Rescheduling next check for service '" + arguments[1] + "'");
if (planned_check < Utility::GetTime())
planned_check = Utility::GetTime();
@ -452,7 +452,7 @@ void ExternalCommandProcessor::ScheduleForcedSvcCheck(double, const std::vector<
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot reschedule forced service check for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Rescheduling next check for service '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Rescheduling next check for service '" + arguments[1] + "'");
{
ObjectLock olock(service);
@ -469,7 +469,7 @@ void ExternalCommandProcessor::EnableHostCheck(double, const std::vector<String>
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable host checks for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Enabling active checks for host '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling active checks for host '" + arguments[0] + "'");
{
ObjectLock olock(host);
@ -485,7 +485,7 @@ void ExternalCommandProcessor::DisableHostCheck(double, const std::vector<String
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable host check non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Disabling active checks for host '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling active checks for host '" + arguments[0] + "'");
{
ObjectLock olock(host);
@ -501,7 +501,7 @@ void ExternalCommandProcessor::EnableSvcCheck(double, const std::vector<String>&
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable service check for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Enabling active checks for service '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling active checks for service '" + arguments[1] + "'");
{
ObjectLock olock(service);
@ -517,7 +517,7 @@ void ExternalCommandProcessor::DisableSvcCheck(double, const std::vector<String>
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable service check for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Disabling active checks for service '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling active checks for service '" + arguments[1] + "'");
{
ObjectLock olock(service);
@ -528,13 +528,13 @@ void ExternalCommandProcessor::DisableSvcCheck(double, const std::vector<String>
void ExternalCommandProcessor::ShutdownProcess(double, const std::vector<String>&)
{
Log(LogNotice, "icinga", "Shutting down Icinga via external command.");
Log(LogNotice, "ExternalCommandProcessor", "Shutting down Icinga via external command.");
Application::RequestShutdown();
}
void ExternalCommandProcessor::RestartProcess(double, const std::vector<String>&)
{
Log(LogNotice, "icinga", "Restarting Icinga via external command.");
Log(LogNotice, "ExternalCommandProcessor", "Restarting Icinga via external command.");
Application::RequestRestart();
}
@ -548,7 +548,7 @@ void ExternalCommandProcessor::ScheduleForcedHostSvcChecks(double, const std::ve
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot reschedule forced host service checks for non-existent host '" + arguments[0] + "'"));
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
Log(LogNotice, "icinga", "Rescheduling next check for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Rescheduling next check for service '" + service->GetName() + "'");
{
ObjectLock olock(service);
@ -573,12 +573,12 @@ void ExternalCommandProcessor::ScheduleHostSvcChecks(double, const std::vector<S
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (planned_check > service->GetNextCheck()) {
Log(LogNotice, "icinga", "Ignoring reschedule request for service '" +
Log(LogNotice, "ExternalCommandProcessor", "Ignoring reschedule request for service '" +
service->GetName() + "' (next check is already sooner than requested check time)");
continue;
}
Log(LogNotice, "icinga", "Rescheduling next check for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Rescheduling next check for service '" + service->GetName() + "'");
{
ObjectLock olock(service);
@ -596,7 +596,7 @@ void ExternalCommandProcessor::EnableHostSvcChecks(double, const std::vector<Str
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable host service checks for non-existent host '" + arguments[0] + "'"));
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
Log(LogNotice, "icinga", "Enabling active checks for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling active checks for service '" + service->GetName() + "'");
service->SetEnableActiveChecks(true);
}
}
@ -609,7 +609,7 @@ void ExternalCommandProcessor::DisableHostSvcChecks(double, const std::vector<St
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable host service checks for non-existent host '" + arguments[0] + "'"));
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
Log(LogNotice, "icinga", "Disabling active checks for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling active checks for service '" + service->GetName() + "'");
{
ObjectLock olock(service);
@ -631,7 +631,7 @@ void ExternalCommandProcessor::AcknowledgeSvcProblem(double, const std::vector<S
if (service->GetState() == ServiceOK)
BOOST_THROW_EXCEPTION(std::invalid_argument("The service '" + arguments[1] + "' is OK."));
Log(LogNotice, "icinga", "Setting acknowledgement for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Setting acknowledgement for service '" + service->GetName() + "'");
service->AddComment(CommentAcknowledgement, arguments[5], arguments[6], 0);
service->AcknowledgeProblem(arguments[5], arguments[6], sticky ? AcknowledgementSticky : AcknowledgementNormal);
@ -650,7 +650,7 @@ void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const std::ve
if (service->GetState() == ServiceOK)
BOOST_THROW_EXCEPTION(std::invalid_argument("The service '" + arguments[1] + "' is OK."));
Log(LogNotice, "icinga", "Setting timed acknowledgement for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Setting timed acknowledgement for service '" + service->GetName() + "'");
service->AddComment(CommentAcknowledgement, arguments[6], arguments[7], 0);
service->AcknowledgeProblem(arguments[6], arguments[7], sticky ? AcknowledgementSticky : AcknowledgementNormal, timestamp);
@ -663,7 +663,7 @@ void ExternalCommandProcessor::RemoveSvcAcknowledgement(double, const std::vecto
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot remove service acknowledgement for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Removing acknowledgement for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Removing acknowledgement for service '" + service->GetName() + "'");
{
ObjectLock olock(service);
@ -682,7 +682,7 @@ void ExternalCommandProcessor::AcknowledgeHostProblem(double, const std::vector<
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot acknowledge host problem for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Setting acknowledgement for host '" + host->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Setting acknowledgement for host '" + host->GetName() + "'");
if (host->GetState() == HostUp)
BOOST_THROW_EXCEPTION(std::invalid_argument("The host '" + arguments[0] + "' is OK."));
@ -701,7 +701,7 @@ void ExternalCommandProcessor::AcknowledgeHostProblemExpire(double, const std::v
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot acknowledge host problem with expire time for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Setting timed acknowledgement for host '" + host->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Setting timed acknowledgement for host '" + host->GetName() + "'");
if (host->GetState() == HostUp)
BOOST_THROW_EXCEPTION(std::invalid_argument("The host '" + arguments[0] + "' is OK."));
@ -717,7 +717,7 @@ void ExternalCommandProcessor::RemoveHostAcknowledgement(double, const std::vect
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot remove acknowledgement for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Removing acknowledgement for host '" + host->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Removing acknowledgement for host '" + host->GetName() + "'");
{
ObjectLock olock(host);
@ -735,7 +735,7 @@ void ExternalCommandProcessor::EnableHostgroupSvcChecks(double, const std::vecto
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
Log(LogNotice, "icinga", "Enabling active checks for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling active checks for service '" + service->GetName() + "'");
{
ObjectLock olock(service);
@ -755,7 +755,7 @@ void ExternalCommandProcessor::DisableHostgroupSvcChecks(double, const std::vect
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
Log(LogNotice, "icinga", "Disabling active checks for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling active checks for service '" + service->GetName() + "'");
{
ObjectLock olock(service);
@ -774,7 +774,7 @@ void ExternalCommandProcessor::EnableServicegroupSvcChecks(double, const std::ve
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable servicegroup service checks for non-existent servicegroup '" + arguments[0] + "'"));
BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
Log(LogNotice, "icinga", "Enabling active checks for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling active checks for service '" + service->GetName() + "'");
{
ObjectLock olock(service);
@ -792,7 +792,7 @@ void ExternalCommandProcessor::DisableServicegroupSvcChecks(double, const std::v
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable servicegroup service checks for non-existent servicegroup '" + arguments[0] + "'"));
BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
Log(LogNotice, "icinga", "Disabling active checks for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling active checks for service '" + service->GetName() + "'");
{
ObjectLock olock(service);
@ -809,7 +809,7 @@ void ExternalCommandProcessor::EnablePassiveHostChecks(double, const std::vector
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable passive host checks for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Enabling passive checks for host '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling passive checks for host '" + arguments[0] + "'");
{
ObjectLock olock(host);
@ -825,7 +825,7 @@ void ExternalCommandProcessor::DisablePassiveHostChecks(double, const std::vecto
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable passive host checks for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Disabling passive checks for host '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling passive checks for host '" + arguments[0] + "'");
{
ObjectLock olock(host);
@ -841,7 +841,7 @@ void ExternalCommandProcessor::EnablePassiveSvcChecks(double, const std::vector<
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable service checks for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Enabling passive checks for service '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling passive checks for service '" + arguments[1] + "'");
{
ObjectLock olock(service);
@ -857,7 +857,7 @@ void ExternalCommandProcessor::DisablePassiveSvcChecks(double, const std::vector
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable service checks for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Disabling passive checks for service '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling passive checks for service '" + arguments[1] + "'");
{
ObjectLock olock(service);
@ -874,7 +874,7 @@ void ExternalCommandProcessor::EnableServicegroupPassiveSvcChecks(double, const
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable servicegroup passive service checks for non-existent servicegroup '" + arguments[0] + "'"));
BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
Log(LogNotice, "icinga", "Enabling passive checks for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling passive checks for service '" + service->GetName() + "'");
{
ObjectLock olock(service);
@ -892,7 +892,7 @@ void ExternalCommandProcessor::DisableServicegroupPassiveSvcChecks(double, const
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable servicegroup passive service checks for non-existent servicegroup '" + arguments[0] + "'"));
BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
Log(LogNotice, "icinga", "Disabling passive checks for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling passive checks for service '" + service->GetName() + "'");
{
ObjectLock olock(service);
@ -911,7 +911,7 @@ void ExternalCommandProcessor::EnableHostgroupPassiveSvcChecks(double, const std
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
Log(LogNotice, "icinga", "Enabling passive checks for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling passive checks for service '" + service->GetName() + "'");
{
ObjectLock olock(service);
@ -931,7 +931,7 @@ void ExternalCommandProcessor::DisableHostgroupPassiveSvcChecks(double, const st
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
Log(LogNotice, "icinga", "Disabling passive checks for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling passive checks for service '" + service->GetName() + "'");
{
ObjectLock olock(service);
@ -963,7 +963,7 @@ void ExternalCommandProcessor::ProcessFile(double, const std::vector<String>& ar
} catch (const std::exception& ex) {
std::ostringstream msgbuf;
msgbuf << "External command failed: " << DiagnosticInformation(ex);
Log(LogWarning, "icinga", msgbuf.str());
Log(LogWarning, "ExternalCommandProcessor", msgbuf.str());
}
}
@ -985,7 +985,7 @@ void ExternalCommandProcessor::ScheduleSvcDowntime(double, const std::vector<Str
if (triggeredByLegacy != 0)
triggeredBy = Service::GetDowntimeIDFromLegacyID(triggeredByLegacy);
Log(LogNotice, "icinga", "Creating downtime for service " + service->GetName());
Log(LogNotice, "ExternalCommandProcessor", "Creating downtime for service " + service->GetName());
(void) service->AddDowntime(arguments[7], arguments[8],
Convert::ToDouble(arguments[2]), Convert::ToDouble(arguments[3]),
Convert::ToBool(arguments[4]), triggeredBy, Convert::ToDouble(arguments[6]));
@ -994,7 +994,7 @@ void ExternalCommandProcessor::ScheduleSvcDowntime(double, const std::vector<Str
void ExternalCommandProcessor::DelSvcDowntime(double, const std::vector<String>& arguments)
{
int id = Convert::ToLong(arguments[0]);
Log(LogNotice, "icinga", "Removing downtime ID " + arguments[0]);
Log(LogNotice, "ExternalCommandProcessor", "Removing downtime ID " + arguments[0]);
String rid = Service::GetDowntimeIDFromLegacyID(id);
Service::RemoveDowntime(rid, true);
}
@ -1011,7 +1011,7 @@ void ExternalCommandProcessor::ScheduleHostDowntime(double, const std::vector<St
if (triggeredByLegacy != 0)
triggeredBy = Service::GetDowntimeIDFromLegacyID(triggeredByLegacy);
Log(LogNotice, "icinga", "Creating downtime for host " + host->GetName());
Log(LogNotice, "ExternalCommandProcessor", "Creating downtime for host " + host->GetName());
(void) host->AddDowntime(arguments[6], arguments[7],
Convert::ToDouble(arguments[1]), Convert::ToDouble(arguments[2]),
@ -1021,7 +1021,7 @@ void ExternalCommandProcessor::ScheduleHostDowntime(double, const std::vector<St
void ExternalCommandProcessor::DelHostDowntime(double, const std::vector<String>& arguments)
{
int id = Convert::ToLong(arguments[0]);
Log(LogNotice, "icinga", "Removing downtime ID " + arguments[0]);
Log(LogNotice, "ExternalCommandProcessor", "Removing downtime ID " + arguments[0]);
String rid = Service::GetDowntimeIDFromLegacyID(id);
Service::RemoveDowntime(rid, true);
}
@ -1039,7 +1039,7 @@ void ExternalCommandProcessor::ScheduleHostSvcDowntime(double, const std::vector
triggeredBy = Service::GetDowntimeIDFromLegacyID(triggeredByLegacy);
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
Log(LogNotice, "icinga", "Creating downtime for service " + service->GetName());
Log(LogNotice, "ExternalCommandProcessor", "Creating downtime for service " + service->GetName());
(void) service->AddDowntime(arguments[6], arguments[7],
Convert::ToDouble(arguments[1]), Convert::ToDouble(arguments[2]),
Convert::ToBool(arguments[3]), triggeredBy, Convert::ToDouble(arguments[5]));
@ -1059,7 +1059,7 @@ void ExternalCommandProcessor::ScheduleHostgroupHostDowntime(double, const std::
triggeredBy = Service::GetDowntimeIDFromLegacyID(triggeredByLegacy);
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
Log(LogNotice, "icinga", "Creating downtime for host " + host->GetName());
Log(LogNotice, "ExternalCommandProcessor", "Creating downtime for host " + host->GetName());
(void) host->AddDowntime(arguments[6], arguments[7],
Convert::ToDouble(arguments[1]), Convert::ToDouble(arguments[2]),
@ -1092,7 +1092,7 @@ void ExternalCommandProcessor::ScheduleHostgroupSvcDowntime(double, const std::v
}
BOOST_FOREACH(const Service::Ptr& service, services) {
Log(LogNotice, "icinga", "Creating downtime for service " + service->GetName());
Log(LogNotice, "ExternalCommandProcessor", "Creating downtime for service " + service->GetName());
(void) service->AddDowntime(arguments[6], arguments[7],
Convert::ToDouble(arguments[1]), Convert::ToDouble(arguments[2]),
Convert::ToBool(arguments[3]), triggeredBy, Convert::ToDouble(arguments[5]));
@ -1123,7 +1123,7 @@ void ExternalCommandProcessor::ScheduleServicegroupHostDowntime(double, const st
}
BOOST_FOREACH(const Host::Ptr& host, hosts) {
Log(LogNotice, "icinga", "Creating downtime for host " + host->GetName());
Log(LogNotice, "ExternalCommandProcessor", "Creating downtime for host " + host->GetName());
(void) host->AddDowntime(arguments[6], arguments[7],
Convert::ToDouble(arguments[1]), Convert::ToDouble(arguments[2]),
Convert::ToBool(arguments[3]), triggeredBy, Convert::ToDouble(arguments[5]));
@ -1143,7 +1143,7 @@ void ExternalCommandProcessor::ScheduleServicegroupSvcDowntime(double, const std
triggeredBy = Service::GetDowntimeIDFromLegacyID(triggeredByLegacy);
BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
Log(LogNotice, "icinga", "Creating downtime for service " + service->GetName());
Log(LogNotice, "ExternalCommandProcessor", "Creating downtime for service " + service->GetName());
(void) service->AddDowntime(arguments[6], arguments[7],
Convert::ToDouble(arguments[1]), Convert::ToDouble(arguments[2]),
Convert::ToBool(arguments[3]), triggeredBy, Convert::ToDouble(arguments[5]));
@ -1157,14 +1157,14 @@ void ExternalCommandProcessor::AddHostComment(double, const std::vector<String>&
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot add host comment for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Creating comment for host " + host->GetName());
Log(LogNotice, "ExternalCommandProcessor", "Creating comment for host " + host->GetName());
(void) host->AddComment(CommentUser, arguments[2], arguments[3], 0);
}
void ExternalCommandProcessor::DelHostComment(double, const std::vector<String>& arguments)
{
int id = Convert::ToLong(arguments[0]);
Log(LogNotice, "icinga", "Removing comment ID " + arguments[0]);
Log(LogNotice, "ExternalCommandProcessor", "Removing comment ID " + arguments[0]);
String rid = Service::GetCommentIDFromLegacyID(id);
Service::RemoveComment(rid);
}
@ -1176,14 +1176,14 @@ void ExternalCommandProcessor::AddSvcComment(double, const std::vector<String>&
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot add service comment for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Creating comment for service " + service->GetName());
Log(LogNotice, "ExternalCommandProcessor", "Creating comment for service " + service->GetName());
(void) service->AddComment(CommentUser, arguments[3], arguments[4], 0);
}
void ExternalCommandProcessor::DelSvcComment(double, const std::vector<String>& arguments)
{
int id = Convert::ToLong(arguments[0]);
Log(LogNotice, "icinga", "Removing comment ID " + arguments[0]);
Log(LogNotice, "ExternalCommandProcessor", "Removing comment ID " + arguments[0]);
String rid = Service::GetCommentIDFromLegacyID(id);
Service::RemoveComment(rid);
@ -1196,7 +1196,7 @@ void ExternalCommandProcessor::DelAllHostComments(double, const std::vector<Stri
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot delete all host comments for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Removing all comments for host " + host->GetName());
Log(LogNotice, "ExternalCommandProcessor", "Removing all comments for host " + host->GetName());
host->RemoveAllComments();
}
@ -1207,7 +1207,7 @@ void ExternalCommandProcessor::DelAllSvcComments(double, const std::vector<Strin
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot delete all service comments for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Removing all comments for service " + service->GetName());
Log(LogNotice, "ExternalCommandProcessor", "Removing all comments for service " + service->GetName());
service->RemoveAllComments();
}
@ -1220,7 +1220,7 @@ void ExternalCommandProcessor::SendCustomHostNotification(double, const std::vec
int options = Convert::ToLong(arguments[1]);
Log(LogNotice, "icinga", "Sending custom notification for host " + host->GetName());
Log(LogNotice, "ExternalCommandProcessor", "Sending custom notification for host " + host->GetName());
if (options & 2) {
ObjectLock olock(host);
host->SetForceNextNotification(true);
@ -1238,7 +1238,7 @@ void ExternalCommandProcessor::SendCustomSvcNotification(double, const std::vect
int options = Convert::ToLong(arguments[2]);
Log(LogNotice, "icinga", "Sending custom notification for service " + service->GetName());
Log(LogNotice, "ExternalCommandProcessor", "Sending custom notification for service " + service->GetName());
if (options & 2) {
ObjectLock olock(service);
@ -1255,7 +1255,7 @@ void ExternalCommandProcessor::DelayHostNotification(double, const std::vector<S
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot delay host notification for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Delaying notifications for host '" + host->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Delaying notifications for host '" + host->GetName() + "'");
BOOST_FOREACH(const Notification::Ptr& notification, host->GetNotifications()) {
ObjectLock olock(notification);
@ -1271,7 +1271,7 @@ void ExternalCommandProcessor::DelaySvcNotification(double, const std::vector<St
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot delay service notification for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Delaying notifications for service " + service->GetName());
Log(LogNotice, "ExternalCommandProcessor", "Delaying notifications for service " + service->GetName());
BOOST_FOREACH(const Notification::Ptr& notification, service->GetNotifications()) {
ObjectLock olock(notification);
@ -1287,7 +1287,7 @@ void ExternalCommandProcessor::EnableHostNotifications(double, const std::vector
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable host notifications for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Enabling notifications for host '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling notifications for host '" + arguments[0] + "'");
{
ObjectLock olock(host);
@ -1303,7 +1303,7 @@ void ExternalCommandProcessor::DisableHostNotifications(double, const std::vecto
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable host notifications for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Disabling notifications for host '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling notifications for host '" + arguments[0] + "'");
{
ObjectLock olock(host);
@ -1319,7 +1319,7 @@ void ExternalCommandProcessor::EnableSvcNotifications(double, const std::vector<
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable service notifications for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Enabling notifications for service '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling notifications for service '" + arguments[1] + "'");
{
ObjectLock olock(service);
@ -1335,7 +1335,7 @@ void ExternalCommandProcessor::DisableSvcNotifications(double, const std::vector
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable service notifications for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Disabling notifications for service '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling notifications for service '" + arguments[1] + "'");
{
ObjectLock olock(service);
@ -1352,7 +1352,7 @@ void ExternalCommandProcessor::DisableHostgroupHostChecks(double, const std::vec
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable hostgroup host checks for non-existent hostgroup '" + arguments[0] + "'"));
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
Log(LogNotice, "icinga", "Disabling active checks for host '" + host->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling active checks for host '" + host->GetName() + "'");
{
ObjectLock olock(host);
@ -1370,7 +1370,7 @@ void ExternalCommandProcessor::DisableHostgroupPassiveHostChecks(double, const s
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable hostgroup passive host checks for non-existent hostgroup '" + arguments[0] + "'"));
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
Log(LogNotice, "icinga", "Disabling passive checks for host '" + host->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling passive checks for host '" + host->GetName() + "'");
{
ObjectLock olock(host);
@ -1390,7 +1390,7 @@ void ExternalCommandProcessor::DisableServicegroupHostChecks(double, const std::
BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
Host::Ptr host = service->GetHost();
Log(LogNotice, "icinga", "Disabling active checks for host '" + host->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling active checks for host '" + host->GetName() + "'");
{
ObjectLock olock(host);
@ -1410,7 +1410,7 @@ void ExternalCommandProcessor::DisableServicegroupPassiveHostChecks(double, cons
BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
Host::Ptr host = service->GetHost();
Log(LogNotice, "icinga", "Disabling passive checks for host '" + host->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling passive checks for host '" + host->GetName() + "'");
{
ObjectLock olock(host);
@ -1428,7 +1428,7 @@ void ExternalCommandProcessor::EnableHostgroupHostChecks(double, const std::vect
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable hostgroup host checks for non-existent hostgroup '" + arguments[0] + "'"));
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
Log(LogNotice, "icinga", "Enabling active checks for host '" + host->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling active checks for host '" + host->GetName() + "'");
{
ObjectLock olock(host);
@ -1446,7 +1446,7 @@ void ExternalCommandProcessor::EnableHostgroupPassiveHostChecks(double, const st
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable hostgroup passive host checks for non-existent hostgroup '" + arguments[0] + "'"));
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
Log(LogNotice, "icinga", "Enabling passive checks for host '" + host->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling passive checks for host '" + host->GetName() + "'");
{
ObjectLock olock(host);
@ -1466,7 +1466,7 @@ void ExternalCommandProcessor::EnableServicegroupHostChecks(double, const std::v
BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
Host::Ptr host = service->GetHost();
Log(LogNotice, "icinga", "Enabling active checks for host '" + host->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling active checks for host '" + host->GetName() + "'");
{
ObjectLock olock(host);
@ -1486,7 +1486,7 @@ void ExternalCommandProcessor::EnableServicegroupPassiveHostChecks(double, const
BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
Host::Ptr host = service->GetHost();
Log(LogNotice, "icinga", "Enabling passive checks for host '" + host->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling passive checks for host '" + host->GetName() + "'");
{
ObjectLock olock(host);
@ -1503,7 +1503,7 @@ void ExternalCommandProcessor::EnableHostFlapping(double, const std::vector<Stri
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable host flapping for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Enabling flapping detection for host '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling flapping detection for host '" + arguments[0] + "'");
{
ObjectLock olock(host);
@ -1519,7 +1519,7 @@ void ExternalCommandProcessor::DisableHostFlapping(double, const std::vector<Str
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable host flapping for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Disabling flapping detection for host '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling flapping detection for host '" + arguments[0] + "'");
{
ObjectLock olock(host);
@ -1535,7 +1535,7 @@ void ExternalCommandProcessor::EnableSvcFlapping(double, const std::vector<Strin
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable service flapping for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Enabling flapping detection for service '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling flapping detection for service '" + arguments[1] + "'");
{
ObjectLock olock(service);
@ -1551,7 +1551,7 @@ void ExternalCommandProcessor::DisableSvcFlapping(double, const std::vector<Stri
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable service flapping for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Disabling flapping detection for service '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling flapping detection for service '" + arguments[1] + "'");
{
ObjectLock olock(service);
@ -1562,84 +1562,84 @@ void ExternalCommandProcessor::DisableSvcFlapping(double, const std::vector<Stri
void ExternalCommandProcessor::EnableNotifications(double, const std::vector<String>&)
{
Log(LogNotice, "icinga", "Globally enabling notifications.");
Log(LogNotice, "ExternalCommandProcessor", "Globally enabling notifications.");
IcingaApplication::GetInstance()->SetEnableNotifications(true);
}
void ExternalCommandProcessor::DisableNotifications(double, const std::vector<String>&)
{
Log(LogNotice, "icinga", "Globally disabling notifications.");
Log(LogNotice, "ExternalCommandProcessor", "Globally disabling notifications.");
IcingaApplication::GetInstance()->SetEnableNotifications(false);
}
void ExternalCommandProcessor::EnableFlapDetection(double, const std::vector<String>&)
{
Log(LogNotice, "icinga", "Globally enabling flap detection.");
Log(LogNotice, "ExternalCommandProcessor", "Globally enabling flap detection.");
IcingaApplication::GetInstance()->SetEnableFlapping(true);
}
void ExternalCommandProcessor::DisableFlapDetection(double, const std::vector<String>&)
{
Log(LogNotice, "icinga", "Globally disabling flap detection.");
Log(LogNotice, "ExternalCommandProcessor", "Globally disabling flap detection.");
IcingaApplication::GetInstance()->SetEnableFlapping(false);
}
void ExternalCommandProcessor::EnableEventHandlers(double, const std::vector<String>&)
{
Log(LogNotice, "icinga", "Globally enabling event handlers.");
Log(LogNotice, "ExternalCommandProcessor", "Globally enabling event handlers.");
IcingaApplication::GetInstance()->SetEnableEventHandlers(true);
}
void ExternalCommandProcessor::DisableEventHandlers(double, const std::vector<String>&)
{
Log(LogNotice, "icinga", "Globally disabling event handlers.");
Log(LogNotice, "ExternalCommandProcessor", "Globally disabling event handlers.");
IcingaApplication::GetInstance()->SetEnableEventHandlers(false);
}
void ExternalCommandProcessor::EnablePerformanceData(double, const std::vector<String>&)
{
Log(LogNotice, "icinga", "Globally enabling performance data processing.");
Log(LogNotice, "ExternalCommandProcessor", "Globally enabling performance data processing.");
IcingaApplication::GetInstance()->SetEnablePerfdata(true);
}
void ExternalCommandProcessor::DisablePerformanceData(double, const std::vector<String>&)
{
Log(LogNotice, "icinga", "Globally disabling performance data processing.");
Log(LogNotice, "ExternalCommandProcessor", "Globally disabling performance data processing.");
IcingaApplication::GetInstance()->SetEnablePerfdata(false);
}
void ExternalCommandProcessor::StartExecutingSvcChecks(double, const std::vector<String>&)
{
Log(LogNotice, "icinga", "Globally enabling service checks.");
Log(LogNotice, "ExternalCommandProcessor", "Globally enabling service checks.");
IcingaApplication::GetInstance()->SetEnableServiceChecks(true);
}
void ExternalCommandProcessor::StopExecutingSvcChecks(double, const std::vector<String>&)
{
Log(LogNotice, "icinga", "Globally disabling service checks.");
Log(LogNotice, "ExternalCommandProcessor", "Globally disabling service checks.");
IcingaApplication::GetInstance()->SetEnableServiceChecks(false);
}
void ExternalCommandProcessor::StartExecutingHostChecks(double, const std::vector<String>&)
{
Log(LogNotice, "icinga", "Globally enabling host checks.");
Log(LogNotice, "ExternalCommandProcessor", "Globally enabling host checks.");
IcingaApplication::GetInstance()->SetEnableHostChecks(true);
}
void ExternalCommandProcessor::StopExecutingHostChecks(double, const std::vector<String>&)
{
Log(LogNotice, "icinga", "Globally disabling host checks.");
Log(LogNotice, "ExternalCommandProcessor", "Globally disabling host checks.");
IcingaApplication::GetInstance()->SetEnableHostChecks(false);
}
@ -1653,7 +1653,7 @@ void ExternalCommandProcessor::ChangeSvcModattr(double, const std::vector<String
int modifiedAttributes = Convert::ToLong(arguments[2]);
Log(LogNotice, "icinga", "Updating modified attributes for service '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Updating modified attributes for service '" + arguments[1] + "'");
{
ObjectLock olock(service);
@ -1669,7 +1669,7 @@ void ExternalCommandProcessor::ChangeHostModattr(double, const std::vector<Strin
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot update modified attributes for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Updating modified attributes for host '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Updating modified attributes for host '" + arguments[0] + "'");
int modifiedAttributes = Convert::ToLong(arguments[1]);
@ -1687,7 +1687,7 @@ void ExternalCommandProcessor::ChangeUserModattr(double, const std::vector<Strin
if (!user)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot update modified attributes for non-existent user '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Updating modified attributes for user '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Updating modified attributes for user '" + arguments[0] + "'");
int modifiedAttributes = Convert::ToLong(arguments[1]);
@ -1730,7 +1730,7 @@ void ExternalCommandProcessor::ChangeNotificationcommandModattr(double, const st
void ExternalCommandProcessor::ChangeCommandModattrInternal(const Command::Ptr& command, int mod_attr)
{
Log(LogNotice, "icinga", "Updating modified attributes for command '" + command->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Updating modified attributes for command '" + command->GetName() + "'");
{
ObjectLock olock(command);
@ -1748,7 +1748,7 @@ void ExternalCommandProcessor::ChangeNormalSvcCheckInterval(double, const std::v
double interval = Convert::ToDouble(arguments[2]);
Log(LogNotice, "icinga", "Updating check interval for service '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Updating check interval for service '" + arguments[1] + "'");
{
ObjectLock olock(service);
@ -1764,7 +1764,7 @@ void ExternalCommandProcessor::ChangeNormalHostCheckInterval(double, const std::
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot update check interval for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Updating check interval for host '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Updating check interval for host '" + arguments[0] + "'");
double interval = Convert::ToDouble(arguments[1]);
@ -1784,7 +1784,7 @@ void ExternalCommandProcessor::ChangeRetrySvcCheckInterval(double, const std::ve
double interval = Convert::ToDouble(arguments[2]);
Log(LogNotice, "icinga", "Updating retry interval for service '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Updating retry interval for service '" + arguments[1] + "'");
{
ObjectLock olock(service);
@ -1800,7 +1800,7 @@ void ExternalCommandProcessor::ChangeRetryHostCheckInterval(double, const std::v
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot update retry interval for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Updating retry interval for host '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Updating retry interval for host '" + arguments[0] + "'");
double interval = Convert::ToDouble(arguments[1]);
@ -1818,7 +1818,7 @@ void ExternalCommandProcessor::EnableHostEventHandler(double, const std::vector<
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable event handler for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Enabling event handler for host '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling event handler for host '" + arguments[0] + "'");
{
ObjectLock olock(host);
@ -1834,7 +1834,7 @@ void ExternalCommandProcessor::DisableHostEventHandler(double, const std::vector
if (!host)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable event handler for non-existent host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Disabling event handler for host '" + arguments[0] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling event handler for host '" + arguments[0] + "'");
{
ObjectLock olock(host);
@ -1850,7 +1850,7 @@ void ExternalCommandProcessor::EnableSvcEventHandler(double, const std::vector<S
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable event handler for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Enabling event handler for service '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling event handler for service '" + arguments[1] + "'");
{
ObjectLock olock(service);
@ -1866,7 +1866,7 @@ void ExternalCommandProcessor::DisableSvcEventHandler(double, const std::vector<
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable event handler for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
Log(LogNotice, "icinga", "Disabling event handler for service '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling event handler for service '" + arguments[1] + "'");
{
ObjectLock olock(service);
@ -1891,7 +1891,7 @@ void ExternalCommandProcessor::ChangeHostEventHandler(double, const std::vector<
if (!command)
BOOST_THROW_EXCEPTION(std::invalid_argument("Event command '" + arguments[1] + "' does not exist."));
Log(LogNotice, "icinga", "Changing event handler for host '" + arguments[0] + "' to '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Changing event handler for host '" + arguments[0] + "' to '" + arguments[1] + "'");
{
ObjectLock olock(host);
@ -1917,7 +1917,7 @@ void ExternalCommandProcessor::ChangeSvcEventHandler(double, const std::vector<S
if (!command)
BOOST_THROW_EXCEPTION(std::invalid_argument("Event command '" + arguments[2] + "' does not exist."));
Log(LogNotice, "icinga", "Changing event handler for service '" + arguments[1] + "' to '" + arguments[2] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Changing event handler for service '" + arguments[1] + "' to '" + arguments[2] + "'");
{
ObjectLock olock(service);
@ -1939,7 +1939,7 @@ void ExternalCommandProcessor::ChangeHostCheckCommand(double, const std::vector<
if (!command)
BOOST_THROW_EXCEPTION(std::invalid_argument("Check command '" + arguments[1] + "' does not exist."));
Log(LogNotice, "icinga", "Changing check command for host '" + arguments[0] + "' to '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Changing check command for host '" + arguments[0] + "' to '" + arguments[1] + "'");
{
ObjectLock olock(host);
@ -1960,7 +1960,7 @@ void ExternalCommandProcessor::ChangeSvcCheckCommand(double, const std::vector<S
if (!command)
BOOST_THROW_EXCEPTION(std::invalid_argument("Check command '" + arguments[2] + "' does not exist."));
Log(LogNotice, "icinga", "Changing check command for service '" + arguments[1] + "' to '" + arguments[2] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Changing check command for service '" + arguments[1] + "' to '" + arguments[2] + "'");
{
ObjectLock olock(service);
@ -1978,7 +1978,7 @@ void ExternalCommandProcessor::ChangeMaxHostCheckAttempts(double, const std::vec
int attempts = Convert::ToLong(arguments[1]);
Log(LogNotice, "icinga", "Changing max check attempts for host '" + arguments[0] + "' to '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Changing max check attempts for host '" + arguments[0] + "' to '" + arguments[1] + "'");
{
ObjectLock olock(host);
@ -1996,7 +1996,7 @@ void ExternalCommandProcessor::ChangeMaxSvcCheckAttempts(double, const std::vect
int attempts = Convert::ToLong(arguments[2]);
Log(LogNotice, "icinga", "Changing max check attempts for service '" + arguments[1] + "' to '" + arguments[2] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Changing max check attempts for service '" + arguments[1] + "' to '" + arguments[2] + "'");
{
ObjectLock olock(service);
@ -2017,7 +2017,7 @@ void ExternalCommandProcessor::ChangeHostCheckTimeperiod(double, const std::vect
if (!tp)
BOOST_THROW_EXCEPTION(std::invalid_argument("Time period '" + arguments[1] + "' does not exist."));
Log(LogNotice, "icinga", "Changing check period for host '" + arguments[0] + "' to '" + arguments[1] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Changing check period for host '" + arguments[0] + "' to '" + arguments[1] + "'");
{
ObjectLock olock(host);
@ -2038,7 +2038,7 @@ void ExternalCommandProcessor::ChangeSvcCheckTimeperiod(double, const std::vecto
if (!tp)
BOOST_THROW_EXCEPTION(std::invalid_argument("Time period '" + arguments[2] + "' does not exist."));
Log(LogNotice, "icinga", "Changing check period for service '" + arguments[1] + "' to '" + arguments[2] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Changing check period for service '" + arguments[1] + "' to '" + arguments[2] + "'");
{
ObjectLock olock(service);
@ -2063,7 +2063,7 @@ void ExternalCommandProcessor::ChangeCustomHostVar(double, const std::vector<Str
override_vars->Set(arguments[1], arguments[2]);
Log(LogNotice, "icinga", "Changing custom var '" + arguments[1] + "' for host '" + arguments[0] + "' to value '" + arguments[2] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Changing custom var '" + arguments[1] + "' for host '" + arguments[0] + "' to value '" + arguments[2] + "'");
{
ObjectLock olock(host);
@ -2089,7 +2089,7 @@ void ExternalCommandProcessor::ChangeCustomSvcVar(double, const std::vector<Stri
override_vars->Set(arguments[2], arguments[3]);
Log(LogNotice, "icinga", "Changing custom var '" + arguments[2] + "' for service '" + arguments[1] + "' on host '" +
Log(LogNotice, "ExternalCommandProcessor", "Changing custom var '" + arguments[2] + "' for service '" + arguments[1] + "' on host '" +
arguments[0] + "' to value '" + arguments[3] + "'");
{
@ -2115,7 +2115,7 @@ void ExternalCommandProcessor::ChangeCustomUserVar(double, const std::vector<Str
override_vars->Set(arguments[1], arguments[2]);
Log(LogNotice, "icinga", "Changing custom var '" + arguments[1] + "' for user '" + arguments[0] + "' to value '" + arguments[2] + "'");
Log(LogNotice, "ExternalCommandProcessor", "Changing custom var '" + arguments[1] + "' for user '" + arguments[0] + "' to value '" + arguments[2] + "'");
{
ObjectLock olock(user);
@ -2165,7 +2165,7 @@ void ExternalCommandProcessor::ChangeCustomCommandVarInternal(const Command::Ptr
override_vars->Set(name, value);
Log(LogNotice, "icinga", "Changing custom var '" + name + "' for command '" + command->GetName() + "' to value '" + Convert::ToString(value) + "'");
Log(LogNotice, "ExternalCommandProcessor", "Changing custom var '" + name + "' for command '" + command->GetName() + "' to value '" + Convert::ToString(value) + "'");
{
ObjectLock olock(command);
@ -2182,7 +2182,7 @@ void ExternalCommandProcessor::EnableHostgroupHostNotifications(double, const st
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable host notifications for non-existent hostgroup '" + arguments[0] + "'"));
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
Log(LogNotice, "icinga", "Enabling notifications for host '" + host->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling notifications for host '" + host->GetName() + "'");
{
ObjectLock olock(host);
@ -2201,7 +2201,7 @@ void ExternalCommandProcessor::EnableHostgroupSvcNotifications(double, const std
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
Log(LogNotice, "icinga", "Enabling notifications for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling notifications for service '" + service->GetName() + "'");
{
ObjectLock olock(service);
@ -2220,7 +2220,7 @@ void ExternalCommandProcessor::DisableHostgroupHostNotifications(double, const s
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable host notifications for non-existent hostgroup '" + arguments[0] + "'"));
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
Log(LogNotice, "icinga", "Disabling notifications for host '" + host->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling notifications for host '" + host->GetName() + "'");
{
ObjectLock olock(host);
@ -2239,7 +2239,7 @@ void ExternalCommandProcessor::DisableHostgroupSvcNotifications(double, const st
BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
Log(LogNotice, "icinga", "Disabling notifications for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling notifications for service '" + service->GetName() + "'");
{
ObjectLock olock(service);
@ -2260,7 +2260,7 @@ void ExternalCommandProcessor::EnableServicegroupHostNotifications(double, const
BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
Host::Ptr host = service->GetHost();
Log(LogNotice, "icinga", "Enabling notifications for host '" + host->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling notifications for host '" + host->GetName() + "'");
{
ObjectLock olock(host);
@ -2278,7 +2278,7 @@ void ExternalCommandProcessor::EnableServicegroupSvcNotifications(double, const
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable service notifications for non-existent servicegroup '" + arguments[0] + "'"));
BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
Log(LogNotice, "icinga", "Enabling notifications for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Enabling notifications for service '" + service->GetName() + "'");
{
ObjectLock olock(service);
@ -2298,7 +2298,7 @@ void ExternalCommandProcessor::DisableServicegroupHostNotifications(double, cons
BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
Host::Ptr host = service->GetHost();
Log(LogNotice, "icinga", "Disabling notifications for host '" + host->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling notifications for host '" + host->GetName() + "'");
{
ObjectLock olock(host);
@ -2316,7 +2316,7 @@ void ExternalCommandProcessor::DisableServicegroupSvcNotifications(double, const
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable service notifications for non-existent servicegroup '" + arguments[0] + "'"));
BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) {
Log(LogNotice, "icinga", "Disabling notifications for service '" + service->GetName() + "'");
Log(LogNotice, "ExternalCommandProcessor", "Disabling notifications for service '" + service->GetName() + "'");
{
ObjectLock olock(service);

View File

@ -53,13 +53,13 @@ bool HostGroup::EvaluateObjectRuleOne(const Host::Ptr host, const ObjectRule& ru
std::ostringstream msgbuf2;
msgbuf2 << "Assigning membership for group '" << rule.GetName() << "' to host '" << host->GetName() << "' for rule " << di;
Log(LogDebug, "icinga", msgbuf2.str());
Log(LogDebug, "HostGroup", msgbuf2.str());
String group_name = rule.GetName();
HostGroup::Ptr group = HostGroup::GetByName(group_name);
if (!group) {
Log(LogCritical, "icinga", "Invalid membership assignment. Group '" + group_name + "' does not exist.");
Log(LogCritical, "HostGroup", "Invalid membership assignment. Group '" + group_name + "' does not exist.");
return false;
}
@ -113,7 +113,7 @@ void HostGroup::RemoveMember(const Host::Ptr& host)
bool HostGroup::ResolveGroupMembership(Host::Ptr const& host, bool add, int rstack) {
if (add && rstack > 20) {
Log(LogWarning, "icinga", "Too many nested groups for group '" + GetName() + "': Host '" +
Log(LogWarning, "HostGroup", "Too many nested groups for group '" + GetName() + "': Host '" +
host->GetName() + "' membership assignment failed.");
return false;

View File

@ -82,7 +82,7 @@ Value IcingaApplication::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& per
*/
int IcingaApplication::Main(void)
{
Log(LogDebug, "icinga", "In IcingaApplication::Main()");
Log(LogDebug, "IcingaApplication", "In IcingaApplication::Main()");
/* periodically dump the program state */
l_RetentionTimer = make_shared<Timer>();
@ -92,7 +92,7 @@ int IcingaApplication::Main(void)
RunEventLoop();
Log(LogInformation, "icinga", "Icinga has shut down.");
Log(LogInformation, "IcingaApplication", "Icinga has shut down.");
return EXIT_SUCCESS;
}

View File

@ -141,7 +141,7 @@ Dictionary::Ptr IcingaStatusWriter::GetStatusData(void)
void IcingaStatusWriter::StatusTimerHandler(void)
{
Log(LogInformation, "icinga", "Writing status.json file");
Log(LogNotice, "IcingaStatusWriter", "Writing status.json file");
String statuspath = GetStatusPath();
String statuspathtmp = statuspath + ".tmp"; /* XXX make this a global definition */
@ -166,6 +166,6 @@ void IcingaStatusWriter::StatusTimerHandler(void)
<< boost::errinfo_file_name(statuspathtmp));
}
Log(LogInformation, "icinga", "Finished writing status.json file");
Log(LogNotice, "IcingaStatusWriter", "Finished writing status.json file");
}

View File

@ -323,7 +323,7 @@ bool LegacyTimePeriod::IsInDayDefinition(const String& daydef, tm *reference)
ParseTimeRange(daydef, &begin, &end, &stride, reference);
Log(LogDebug, "icinga", "ParseTimeRange: '" + daydef + "' => " + Convert::ToString(static_cast<long>(mktime(&begin))) + " -> " + Convert::ToString(static_cast<long>(mktime(&end))) + ", stride: " + Convert::ToString(stride));
Log(LogDebug, "LegacyTimePeriod", "ParseTimeRange: '" + daydef + "' => " + Convert::ToString(static_cast<long>(mktime(&begin))) + " -> " + Convert::ToString(static_cast<long>(mktime(&end))) + ", stride: " + Convert::ToString(stride));
return IsInTimeRange(&begin, &end, stride, reference);
}
@ -451,20 +451,20 @@ Array::Ptr LegacyTimePeriod::ScriptFunc(const TimePeriod::Ptr& tp, double begin,
tm reference = Utility::LocalTime(refts);
#ifdef _DEBUG
Log(LogDebug, "icinga", "Checking reference time " + Convert::ToString(static_cast<long>(refts)));
Log(LogDebug, "LegacyTimePeriod", "Checking reference time " + Convert::ToString(static_cast<long>(refts)));
#endif /* _DEBUG */
ObjectLock olock(ranges);
BOOST_FOREACH(const Dictionary::Pair& kv, ranges) {
if (!IsInDayDefinition(kv.first, &reference)) {
#ifdef _DEBUG
Log(LogDebug, "icinga", "Not in day definition '" + kv.first + "'.");
Log(LogDebug, "LegacyTimePeriod", "Not in day definition '" + kv.first + "'.");
#endif /* _DEBUG */
continue;
}
#ifdef _DEBUG
Log(LogDebug, "icinga", "In day definition '" + kv.first + "'.");
Log(LogDebug, "LegacyTimePeriod", "In day definition '" + kv.first + "'.");
#endif /* _DEBUG */
ProcessTimeRanges(kv.second, &reference, segments);
@ -472,7 +472,7 @@ Array::Ptr LegacyTimePeriod::ScriptFunc(const TimePeriod::Ptr& tp, double begin,
}
}
Log(LogDebug, "icinga", "Legacy timeperiod update returned " + Convert::ToString(static_cast<long>(segments->GetLength())) + " segments.");
Log(LogDebug, "LegacyTimePeriod", "Legacy timeperiod update returned " + Convert::ToString(static_cast<long>(segments->GetLength())) + " segments.");
return segments;
}

View File

@ -183,7 +183,7 @@ String MacroProcessor::InternalResolveMacros(const String& str, const ResolverLi
if (!found) {
if (!missingMacro)
Log(LogWarning, "icinga", "Macro '" + name + "' is not defined.");
Log(LogWarning, "MacroProcessor", "Macro '" + name + "' is not defined.");
else
*missingMacro = name;
}

View File

@ -62,7 +62,7 @@ bool Notification::EvaluateApplyRuleOne(const Checkable::Ptr& checkable, const A
std::ostringstream msgbuf2;
msgbuf2 << "Applying notification '" << rule.GetName() << "' to object '" << checkable->GetName() << "' for rule " << di;
Log(LogDebug, "icinga", msgbuf2.str());
Log(LogDebug, "Notification", msgbuf2.str());
ConfigItemBuilder::Ptr builder = make_shared<ConfigItemBuilder>(di);
builder->SetType("Notification");
@ -115,7 +115,7 @@ void Notification::EvaluateApplyRule(const ApplyRule& rule)
}
if (apply_count == 0)
Log(LogWarning, "icinga", "Apply rule '" + rule.GetName() + "' for host does not match anywhere!");
Log(LogWarning, "Notification", "Apply rule '" + rule.GetName() + "' for host does not match anywhere!");
} else if (rule.GetTargetType() == "Service") {
apply_count = 0;
@ -128,10 +128,10 @@ void Notification::EvaluateApplyRule(const ApplyRule& rule)
}
if (apply_count == 0)
Log(LogWarning, "icinga", "Apply rule '" + rule.GetName() + "' for service does not match anywhere!");
Log(LogWarning, "Notification", "Apply rule '" + rule.GetName() + "' for service does not match anywhere!");
} else {
Log(LogWarning, "icinga", "Wrong target type for apply rule '" + rule.GetName() + "'!");
Log(LogWarning, "Notification", "Wrong target type for apply rule '" + rule.GetName() + "'!");
}
}
void Notification::EvaluateApplyRules(const std::vector<ApplyRule>& rules)

View File

@ -231,7 +231,7 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
TimePeriod::Ptr tp = GetPeriod();
if (tp && !tp->IsInside(Utility::GetTime())) {
Log(LogNotice, "icinga", "Not sending notifications for notification object '" + GetName() + "': not in timeperiod");
Log(LogNotice, "Notification", "Not sending notifications for notification object '" + GetName() + "': not in timeperiod");
return;
}
@ -240,22 +240,22 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
if (type == NotificationProblem) {
if (times && times->Contains("begin") && now < checkable->GetLastHardStateChange() + times->Get("begin")) {
Log(LogNotice, "icinga", "Not sending notifications for notification object '" + GetName() + "': before escalation range");
Log(LogNotice, "Notification", "Not sending notifications for notification object '" + GetName() + "': before escalation range");
return;
}
if (times && times->Contains("end") && now > checkable->GetLastHardStateChange() + times->Get("end")) {
Log(LogNotice, "icinga", "Not sending notifications for notification object '" + GetName() + "': after escalation range");
Log(LogNotice, "Notification", "Not sending notifications for notification object '" + GetName() + "': after escalation range");
return;
}
}
unsigned long ftype = 1 << type;
Log(LogDebug, "icinga", "FType=" + Convert::ToString(ftype) + ", TypeFilter=" + Convert::ToString(GetTypeFilter()));
Log(LogDebug, "Notification", "FType=" + Convert::ToString(ftype) + ", TypeFilter=" + Convert::ToString(GetTypeFilter()));
if (!(ftype & GetTypeFilter())) {
Log(LogNotice, "icinga", "Not sending notifications for notification object '" + GetName() + "': type filter does not match");
Log(LogNotice, "Notification", "Not sending notifications for notification object '" + GetName() + "': type filter does not match");
return;
}
@ -271,7 +271,7 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
fstate = HostStateToFilter(host->GetState());
if (!(fstate & GetStateFilter())) {
Log(LogNotice, "icinga", "Not sending notifications for notification object '" + GetName() + "': state filter does not match");
Log(LogNotice, "Notification", "Not sending notifications for notification object '" + GetName() + "': state filter does not match");
return;
}
}
@ -303,7 +303,7 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
if (!CheckNotificationUserFilters(type, user, force))
continue;
Log(LogInformation, "icinga", "Sending notification for user '" + user->GetName() + "'");
Log(LogInformation, "Notification", "Sending notification for user '" + user->GetName() + "'");
Utility::QueueAsyncCallback(boost::bind(&Notification::ExecuteNotificationHelper, this, type, user, cr, force, author, text));
/* collect all notified users */
@ -322,7 +322,7 @@ bool Notification::CheckNotificationUserFilters(NotificationType type, const Use
TimePeriod::Ptr tp = user->GetPeriod();
if (tp && !tp->IsInside(Utility::GetTime())) {
Log(LogNotice, "icinga", "Not sending notifications for notification object '" +
Log(LogNotice, "Notification", "Not sending notifications for notification object '" +
GetName() + " and user '" + user->GetName() + "': user not in timeperiod");
return false;
}
@ -330,7 +330,7 @@ bool Notification::CheckNotificationUserFilters(NotificationType type, const Use
unsigned long ftype = 1 << type;
if (!(ftype & user->GetTypeFilter())) {
Log(LogNotice, "icinga", "Not sending notifications for notification object '" +
Log(LogNotice, "Notification", "Not sending notifications for notification object '" +
GetName() + " and user '" + user->GetName() + "': type filter does not match");
return false;
}
@ -348,7 +348,7 @@ bool Notification::CheckNotificationUserFilters(NotificationType type, const Use
fstate = HostStateToFilter(host->GetState());
if (!(fstate & user->GetStateFilter())) {
Log(LogNotice, "icinga", "Not sending notifications for notification object '" +
Log(LogNotice, "Notification", "Not sending notifications for notification object '" +
GetName() + " and user '" + user->GetName() + "': state filter does not match");
return false;
}
@ -365,7 +365,7 @@ void Notification::ExecuteNotificationHelper(NotificationType type, const User::
NotificationCommand::Ptr command = GetCommand();
if (!command) {
Log(LogDebug, "icinga", "No notification_command found for notification '" + GetName() + "'. Skipping execution.");
Log(LogDebug, "Notification", "No notification_command found for notification '" + GetName() + "'. Skipping execution.");
return;
}
@ -380,12 +380,12 @@ void Notification::ExecuteNotificationHelper(NotificationType type, const User::
/* required by compatlogger */
Service::OnNotificationSentToUser(GetSelf(), GetCheckable(), user, type, cr, author, text, command->GetName());
Log(LogInformation, "icinga", "Completed sending notification for object '" + GetCheckable()->GetName() + "'");
Log(LogInformation, "Notification", "Completed sending notification for object '" + GetCheckable()->GetName() + "'");
} catch (const std::exception& ex) {
std::ostringstream msgbuf;
msgbuf << "Exception occured during notification for object '"
<< GetCheckable()->GetName() << "': " << DiagnosticInformation(ex);
Log(LogWarning, "icinga", msgbuf.str());
Log(LogWarning, "Notification", msgbuf.str());
}
}

View File

@ -122,7 +122,7 @@ void PluginUtility::ExecuteCommand(const Command::Ptr& commandObj, const Checkab
String message = "Non-optional macro '" + missingMacro + "' used in argument '" +
arg.Key + "' is missing while executing command '" + commandObj->GetName() +
"' for object '" + checkable->GetName() + "'";
Log(LogWarning, "methods", message);
Log(LogWarning, "PluginUtility", message);
if (callback) {
ProcessResult pr;

View File

@ -61,7 +61,7 @@ bool ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const
std::ostringstream msgbuf2;
msgbuf2 << "Applying scheduled downtime '" << rule.GetName() << "' to object '" << checkable->GetName() << "' for rule " << di;
Log(LogDebug, "icinga", msgbuf2.str());
Log(LogDebug, "ScheduledDowntime", msgbuf2.str());
ConfigItemBuilder::Ptr builder = make_shared<ConfigItemBuilder>(di);
builder->SetType("ScheduledDowntime");
@ -115,7 +115,7 @@ void ScheduledDowntime::EvaluateApplyRules(const std::vector<ApplyRule>& rules)
}
if (apply_count == 0)
Log(LogWarning, "icinga", "Apply rule '" + rule.GetName() + "' for host does not match anywhere!");
Log(LogWarning, "ScheduledDowntime", "Apply rule '" + rule.GetName() + "' for host does not match anywhere!");
} else if (rule.GetTargetType() == "Service") {
apply_count = 0;
@ -128,10 +128,10 @@ void ScheduledDowntime::EvaluateApplyRules(const std::vector<ApplyRule>& rules)
}
if (apply_count == 0)
Log(LogWarning, "icinga", "Apply rule '" + rule.GetName() + "' for service does not match anywhere!");
Log(LogWarning, "ScheduledDowntime", "Apply rule '" + rule.GetName() + "' for service does not match anywhere!");
} else {
Log(LogWarning, "icinga", "Wrong target type for apply rule '" + rule.GetName() + "'!");
Log(LogWarning, "ScheduledDowntime", "Wrong target type for apply rule '" + rule.GetName() + "'!");
}
}
}

View File

@ -91,7 +91,7 @@ std::pair<double, double> ScheduledDowntime::FindNextSegment(void)
time_t refts = Utility::GetTime();
tm reference = Utility::LocalTime(refts);
Log(LogDebug, "icinga", "Finding next scheduled downtime segment for time " + Convert::ToString(static_cast<long>(refts)));
Log(LogDebug, "ScheduledDowntime", "Finding next scheduled downtime segment for time " + Convert::ToString(static_cast<long>(refts)));
Dictionary::Ptr ranges = GetRanges();

View File

@ -54,7 +54,7 @@ bool Service::EvaluateApplyRuleOne(const Host::Ptr& host, const ApplyRule& rule)
std::ostringstream msgbuf2;
msgbuf2 << "Applying service '" << rule.GetName() << "' to host '" << host->GetName() << "' for rule " << di;
Log(LogDebug, "icinga", msgbuf2.str());
Log(LogDebug, "Service", msgbuf2.str());
ConfigItemBuilder::Ptr builder = make_shared<ConfigItemBuilder>(di);
builder->SetType("Service");
@ -102,7 +102,7 @@ void Service::EvaluateApplyRule(const ApplyRule& rule)
}
if (apply_count == 0)
Log(LogWarning, "icinga", "Apply rule '" + rule.GetName() + "' for host does not match anywhere!");
Log(LogWarning, "Service", "Apply rule '" + rule.GetName() + "' for host does not match anywhere!");
}
void Service::EvaluateApplyRules(const std::vector<ApplyRule>& rules)

View File

@ -56,13 +56,13 @@ bool ServiceGroup::EvaluateObjectRuleOne(const Service::Ptr service, const Objec
std::ostringstream msgbuf2;
msgbuf2 << "Assigning membership for group '" << rule.GetName() << "' to service '" << service->GetName() << "' for rule " << di;
Log(LogDebug, "icinga", msgbuf2.str());
Log(LogDebug, "ServiceGroup", msgbuf2.str());
String group_name = rule.GetName();
ServiceGroup::Ptr group = ServiceGroup::GetByName(group_name);
if (!group) {
Log(LogCritical, "icinga", "Invalid membership assignment. Group '" + group_name + "' does not exist.");
Log(LogCritical, "ServiceGroup", "Invalid membership assignment. Group '" + group_name + "' does not exist.");
return false;
}
@ -116,7 +116,7 @@ void ServiceGroup::RemoveMember(const Service::Ptr& service)
bool ServiceGroup::ResolveGroupMembership(Service::Ptr const& service, bool add, int rstack) {
if (add && rstack > 20) {
Log(LogWarning, "icinga", "Too many nested groups for group '" + GetName() + "': Service '" +
Log(LogWarning, "ServiceGroup", "Too many nested groups for group '" + GetName() + "': Service '" +
service->GetName() + "' membership assignment failed.");
return false;

View File

@ -55,7 +55,7 @@ void TimePeriod::AddSegment(double begin, double end)
{
ASSERT(OwnsLock());
Log(LogDebug, "icinga", "Adding segment '" + Utility::FormatDateTime("%c", begin) + "' <-> '" + Utility::FormatDateTime("%c", end) + "' to TimePeriod '" + GetName() + "'");
Log(LogDebug, "TimePeriod", "Adding segment '" + Utility::FormatDateTime("%c", begin) + "' <-> '" + Utility::FormatDateTime("%c", end) + "' to TimePeriod '" + GetName() + "'");
if (GetValidBegin().IsEmpty() || begin < GetValidBegin())
SetValidBegin(begin);
@ -106,7 +106,7 @@ void TimePeriod::RemoveSegment(double begin, double end)
{
ASSERT(OwnsLock());
Log(LogDebug, "icinga", "Removing segment '" + Utility::FormatDateTime("%c", begin) + "' <-> '" + Utility::FormatDateTime("%c", end) + "' from TimePeriod '" + GetName() + "'");
Log(LogDebug, "TimePeriod", "Removing segment '" + Utility::FormatDateTime("%c", begin) + "' <-> '" + Utility::FormatDateTime("%c", end) + "' from TimePeriod '" + GetName() + "'");
if (GetValidBegin().IsEmpty() || begin < GetValidBegin())
SetValidBegin(begin);
@ -154,7 +154,7 @@ void TimePeriod::PurgeSegments(double end)
{
ASSERT(OwnsLock());
Log(LogDebug, "icinga", "Purging segments older than '" + Utility::FormatDateTime("%c", end) + "' from TimePeriod '" + GetName() + "'");
Log(LogDebug, "TimePeriod", "Purging segments older than '" + Utility::FormatDateTime("%c", end) + "' from TimePeriod '" + GetName() + "'");
if (GetValidBegin().IsEmpty() || end < GetValidBegin())
return;
@ -275,17 +275,17 @@ void TimePeriod::Dump(void)
{
Array::Ptr segments = GetSegments();
Log(LogDebug, "icinga", "Dumping TimePeriod '" + GetName() + "'");
Log(LogDebug, "icinga", "Valid from '" + Utility::FormatDateTime("%c", GetValidBegin()) + "' until '" + Utility::FormatDateTime("%c", GetValidEnd()));
Log(LogDebug, "TimePeriod", "Dumping TimePeriod '" + GetName() + "'");
Log(LogDebug, "TimePeriod", "Valid from '" + Utility::FormatDateTime("%c", GetValidBegin()) + "' until '" + Utility::FormatDateTime("%c", GetValidEnd()));
if (segments) {
ObjectLock dlock(segments);
BOOST_FOREACH(const Dictionary::Ptr& segment, segments) {
Log(LogDebug, "icinga", "Segment: " +
Log(LogDebug, "TimePeriod", "Segment: " +
Utility::FormatDateTime("%c", segment->Get("begin")) + " <-> " +
Utility::FormatDateTime("%c", segment->Get("end")));
}
}
Log(LogDebug, "icinga", "---");
Log(LogDebug, "TimePeriod", "---");
}

View File

@ -53,13 +53,13 @@ bool UserGroup::EvaluateObjectRuleOne(const User::Ptr user, const ObjectRule& ru
std::ostringstream msgbuf2;
msgbuf2 << "Assigning membership for group '" << rule.GetName() << "' to user '" << user->GetName() << "' for rule " << di;
Log(LogDebug, "icinga", msgbuf2.str());
Log(LogDebug, "UserGroup", msgbuf2.str());
String group_name = rule.GetName();
UserGroup::Ptr group = UserGroup::GetByName(group_name);
if (!group) {
Log(LogCritical, "icinga", "Invalid membership assignment. Group '" + group_name + "' does not exist.");
Log(LogCritical, "UserGroup", "Invalid membership assignment. Group '" + group_name + "' does not exist.");
return false;
}
@ -113,7 +113,7 @@ void UserGroup::RemoveMember(const User::Ptr& user)
bool UserGroup::ResolveGroupMembership(User::Ptr const& user, bool add, int rstack) {
if (add && rstack > 20) {
Log(LogWarning, "icinga", "Too many nested groups for group '" + GetName() + "': User '" +
Log(LogWarning, "UserGroup", "Too many nested groups for group '" + GetName() + "': User '" +
user->GetName() + "' membership assignment failed.");
return false;

View File

@ -72,6 +72,6 @@ void PluginNotificationTask::ProcessFinishedHandler(const Checkable::Ptr& checka
msgbuf << "Notification command '" << command << "' for object '"
<< checkable->GetName() << "' failed; exit status: "
<< pr.ExitStatus << ", output: " << pr.Output;
Log(LogWarning, "icinga", msgbuf.str());
Log(LogWarning, "PluginNotificationTask", msgbuf.str());
}
}

View File

@ -75,8 +75,8 @@ void ApiClient::SendMessage(const Dictionary::Ptr& message)
std::ostringstream info, debug;
info << "Error while sending JSON-RPC message for identity '" << m_Identity << "'";
debug << info.str() << std::endl << DiagnosticInformation(ex);
Log(LogWarning, "remote", info.str());
Log(LogDebug, "remote", debug.str());
Log(LogWarning, "ApiClient", info.str());
Log(LogDebug, "ApiClient", debug.str());
Disconnect();
}
@ -84,7 +84,7 @@ void ApiClient::SendMessage(const Dictionary::Ptr& message)
void ApiClient::Disconnect(void)
{
Log(LogWarning, "remote", "API client disconnected for identity '" + m_Identity + "'");
Log(LogWarning, "ApiClient", "API client disconnected for identity '" + m_Identity + "'");
m_Stream->Close();
if (m_Endpoint)
@ -127,7 +127,7 @@ bool ApiClient::ProcessMessage(void)
String method = message->Get("method");
Log(LogNotice, "remote", "Received '" + method + "' message from '" + m_Identity + "'");
Log(LogNotice, "ApiClient", "Received '" + method + "' message from '" + m_Identity + "'");
Dictionary::Ptr resultMessage = make_shared<Dictionary>();
@ -161,7 +161,7 @@ void ApiClient::MessageThreadProc(void)
Disconnect();
} catch (const std::exception& ex) {
Log(LogWarning, "remote", "Error while reading JSON-RPC message for identity '" + m_Identity + "': " + DiagnosticInformation(ex));
Log(LogWarning, "ApiClient", "Error while reading JSON-RPC message for identity '" + m_Identity + "': " + DiagnosticInformation(ex));
}
}

View File

@ -72,7 +72,7 @@ bool ApiListener::UpdateConfigDir(const Dictionary::Ptr& oldConfig, const Dictio
configChange = true;
String path = configDir + "/" + kv.first;
Log(LogInformation, "remote", "Updating configuration file: " + path);
Log(LogInformation, "ApiListener", "Updating configuration file: " + path);
std::ofstream fp(path.CStr(), std::ofstream::out | std::ostream::trunc);
fp << kv.second;
@ -101,7 +101,7 @@ bool ApiListener::UpdateConfigDir(const Dictionary::Ptr& oldConfig, const Dictio
void ApiListener::SyncZoneDir(const Zone::Ptr& zone) const
{
Log(LogInformation, "remote", "Syncing zone: " + zone->GetName());
Log(LogInformation, "ApiListener", "Syncing zone: " + zone->GetName());
String newDir = Application::GetZonesDir() + "/" + zone->GetName();
String oldDir = Application::GetLocalStateDir() + "/lib/icinga2/api/zones/" + zone->GetName();
@ -187,7 +187,7 @@ Value ApiListener::ConfigUpdateHandler(const MessageOrigin& origin, const Dictio
Zone::Ptr zone = Zone::GetByName(kv.first);
if (!zone) {
Log(LogWarning, "remote", "Ignoring config update for unknown zone: " + kv.first);
Log(LogWarning, "ApiListener", "Ignoring config update for unknown zone: " + kv.first);
continue;
}
@ -212,7 +212,7 @@ Value ApiListener::ConfigUpdateHandler(const MessageOrigin& origin, const Dictio
}
if (configChange) {
Log(LogInformation, "remote", "Restarting after configuration change.");
Log(LogInformation, "ApiListener", "Restarting after configuration change.");
Application::RequestRestart();
}

View File

@ -44,7 +44,7 @@ void ApiListener::OnConfigLoaded(void)
/* set up SSL context */
shared_ptr<X509> cert = GetX509Certificate(GetCertPath());
SetIdentity(GetCertificateCN(cert));
Log(LogInformation, "remote", "My API identity: " + GetIdentity());
Log(LogInformation, "ApiListener", "My API identity: " + GetIdentity());
m_SSLContext = MakeSSLContext(GetCertPath(), GetKeyPath(), GetCaPath());
@ -133,7 +133,7 @@ void ApiListener::AddListener(const String& service)
std::ostringstream s;
s << "Adding new listener: port " << service;
Log(LogInformation, "remote", s.str());
Log(LogInformation, "ApiListener", s.str());
TcpSocket::Ptr server = make_shared<TcpSocket>();
server->Bind(service, AF_INET6);
@ -184,7 +184,7 @@ void ApiListener::AddConnection(const String& node, const String& service)
info << "Cannot connect to host '" << node << "' on port '" << service << "'";
debug << info.str() << std::endl << DiagnosticInformation(ex);
Log(LogCritical, "remote", info.str());
Log(LogDebug, "remote", debug.str());
Log(LogDebug, "ApiListener", debug.str());
}
}
@ -209,7 +209,7 @@ void ApiListener::NewClientHandler(const Socket::Ptr& client, ConnectionRole rol
shared_ptr<X509> cert = tlsStream->GetPeerCertificate();
String identity = GetCertificateCN(cert);
Log(LogInformation, "remote", "New client connection for identity '" + identity + "'");
Log(LogInformation, "ApiListener", "New client connection for identity '" + identity + "'");
Endpoint::Ptr endpoint = Endpoint::GetByName(identity);
@ -265,7 +265,7 @@ void ApiListener::ApiTimerHandler(void)
if (!need) {
String path = GetApiDir() + "log/" + Convert::ToString(ts);
Log(LogNotice, "remote", "Removing old log file: " + path);
Log(LogNotice, "ApiListener", "Removing old log file: " + path);
(void)unlink(path.CStr());
}
}
@ -325,18 +325,18 @@ void ApiListener::ApiTimerHandler(void)
BOOST_FOREACH(const ApiClient::Ptr& client, endpoint->GetClients())
client->SendMessage(lmessage);
Log(LogNotice, "remote", "Setting log position for identity '" + endpoint->GetName() + "': " +
Log(LogNotice, "ApiListener", "Setting log position for identity '" + endpoint->GetName() + "': " +
Utility::FormatDateTime("%Y/%m/%d %H:%M:%S", ts));
}
Log(LogNotice, "remote", "Current zone master: " + GetMaster()->GetName());
Log(LogNotice, "ApiListener", "Current zone master: " + GetMaster()->GetName());
std::vector<String> names;
BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>())
if (endpoint->IsConnected())
names.push_back(endpoint->GetName() + " (" + Convert::ToString(endpoint->GetClients().size()) + ")");
Log(LogNotice, "remote", "Connected endpoints: " + Utility::NaturalJoin(names));
Log(LogNotice, "ApiListener", "Connected endpoints: " + Utility::NaturalJoin(names));
}
void ApiListener::RelayMessage(const MessageOrigin& origin, const DynamicObject::Ptr& secobj, const Dictionary::Ptr& message, bool log)
@ -374,7 +374,7 @@ void ApiListener::SyncRelayMessage(const MessageOrigin& origin, const DynamicObj
double ts = Utility::GetTime();
message->Set("ts", ts);
Log(LogNotice, "remote", "Relaying '" + message->Get("method") + "' message");
Log(LogNotice, "ApiListener", "Relaying '" + message->Get("method") + "' message");
if (log)
m_LogQueue.Enqueue(boost::bind(&ApiListener::PersistMessage, this, message));
@ -437,7 +437,7 @@ void ApiListener::SyncRelayMessage(const MessageOrigin& origin, const DynamicObj
ObjectLock olock(endpoint);
if (!endpoint->GetSyncing()) {
Log(LogNotice, "remote", "Sending message to '" + endpoint->GetName() + "'");
Log(LogNotice, "ApiListener", "Sending message to '" + endpoint->GetName() + "'");
BOOST_FOREACH(const ApiClient::Ptr& client, endpoint->GetClients())
client->SendMessage(message);
@ -462,7 +462,7 @@ void ApiListener::OpenLogFile(void)
std::fstream *fp = new std::fstream(path.CStr(), std::fstream::out | std::ofstream::app);
if (!fp->good()) {
Log(LogWarning, "cluster", "Could not open spool file: " + path);
Log(LogWarning, "ApiListener", "Could not open spool file: " + path);
return;
}
@ -545,7 +545,7 @@ void ApiListener::ReplayLog(const ApiClient::Ptr& client)
if (ts < peer_ts)
continue;
Log(LogNotice, "remote", "Replaying log: " + path);
Log(LogNotice, "ApiListener", "Replaying log: " + path);
std::fstream *fp = new std::fstream(path.CStr(), std::fstream::in);
StdioStream::Ptr logStream = make_shared<StdioStream>(fp, true);
@ -560,7 +560,7 @@ void ApiListener::ReplayLog(const ApiClient::Ptr& client)
pmessage = JsonDeserialize(message);
} catch (const std::exception&) {
Log(LogWarning, "remote", "Unexpected end-of-file for cluster log: " + path);
Log(LogWarning, "ApiListener", "Unexpected end-of-file for cluster log: " + path);
/* Log files may be incomplete or corrupted. This is perfectly OK. */
break;
@ -578,7 +578,7 @@ void ApiListener::ReplayLog(const ApiClient::Ptr& client)
logStream->Close();
}
Log(LogNotice, "remote", "Replayed " + Convert::ToString(count) + " messages.");
Log(LogNotice, "ApiListener", "Replayed " + Convert::ToString(count) + " messages.");
if (last_sync) {
{