Clean up some parts of the code

This commit is contained in:
Gunnar Beutner 2014-08-17 17:57:20 +02:00
parent c4d448efe5
commit 65bec9e904
56 changed files with 324 additions and 325 deletions

View File

@ -38,7 +38,7 @@ public:
DECLARE_PTR_TYPEDEFS(CheckResultReader);
DECLARE_TYPENAME(CheckResultReader);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
protected:
virtual void Start(void);

View File

@ -257,14 +257,14 @@ void CompatLogger::NotificationSentHandler(const Notification::Ptr& notification
author_comment = author + ";" + comment_text;
}
if (!cr)
return;
if (!cr)
return;
String output;
if (cr)
output = CompatUtility::GetCheckResultOutput(cr);
std::ostringstream msgbuf;
std::ostringstream msgbuf;
if (service) {
msgbuf << "SERVICE NOTIFICATION: "
@ -277,22 +277,22 @@ void CompatLogger::NotificationSentHandler(const Notification::Ptr& notification
<< author_comment
<< "";
} else {
msgbuf << "HOST NOTIFICATION: "
msgbuf << "HOST NOTIFICATION: "
<< user->GetName() << ";"
<< host->GetName() << ";"
<< notification_type_str << " "
<< host->GetName() << ";"
<< notification_type_str << " "
<< "(" << (host->IsReachable() ? Host::StateToString(host->GetState()) : "UNREACHABLE") << ");"
<< command_name << ";"
<< output << ";"
<< author_comment
<< "";
<< "";
}
{
ObjectLock oLock(this);
WriteLine(msgbuf.str());
Flush();
}
Flush();
}
}
/**
@ -325,7 +325,7 @@ void CompatLogger::FlappingHandler(const Checkable::Ptr& checkable, FlappingStat
return;
}
std::ostringstream msgbuf;
std::ostringstream msgbuf;
if (service) {
msgbuf << "SERVICE FLAPPING ALERT: "
@ -335,32 +335,32 @@ void CompatLogger::FlappingHandler(const Checkable::Ptr& checkable, FlappingStat
<< flapping_output
<< "";
} else {
msgbuf << "HOST FLAPPING ALERT: "
<< host->GetName() << ";"
<< flapping_state_str << "; "
<< flapping_output
<< "";
msgbuf << "HOST FLAPPING ALERT: "
<< host->GetName() << ";"
<< flapping_state_str << "; "
<< flapping_output
<< "";
}
{
ObjectLock oLock(this);
WriteLine(msgbuf.str());
Flush();
}
Flush();
}
}
void CompatLogger::ExternalCommandHandler(const String& command, const std::vector<String>& arguments)
{
std::ostringstream msgbuf;
msgbuf << "EXTERNAL COMMAND: "
<< command << ";"
<< boost::algorithm::join(arguments, ";")
<< "";
std::ostringstream msgbuf;
msgbuf << "EXTERNAL COMMAND: "
<< command << ";"
<< boost::algorithm::join(arguments, ";")
<< "";
{
ObjectLock oLock(this);
WriteLine(msgbuf.str());
}
{
ObjectLock oLock(this);
WriteLine(msgbuf.str());
}
}
void CompatLogger::EventCommandHandler(const Checkable::Ptr& checkable)
@ -373,7 +373,7 @@ void CompatLogger::EventCommandHandler(const Checkable::Ptr& checkable)
String event_command_name = event_command->GetName();
long current_attempt = checkable->GetCheckAttempt();
std::ostringstream msgbuf;
std::ostringstream msgbuf;
if (service) {
msgbuf << "SERVICE EVENT HANDLER: "
@ -385,7 +385,7 @@ void CompatLogger::EventCommandHandler(const Checkable::Ptr& checkable)
<< event_command_name;
} else {
msgbuf << "HOST EVENT HANDLER: "
<< host->GetName() << ";"
<< host->GetName() << ";"
<< (host->IsReachable() ? Host::StateToString(host->GetState()) : "UNREACHABLE") << ";"
<< Host::StateTypeToString(host->GetStateType()) << ";"
<< current_attempt << ";"
@ -395,8 +395,8 @@ void CompatLogger::EventCommandHandler(const Checkable::Ptr& checkable)
{
ObjectLock oLock(this);
WriteLine(msgbuf.str());
Flush();
}
Flush();
}
}
void CompatLogger::WriteLine(const String& line)

View File

@ -39,7 +39,7 @@ public:
DECLARE_PTR_TYPEDEFS(CompatLogger);
DECLARE_TYPENAME(CompatLogger);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
static void ValidateRotationMethod(const String& location, const Dictionary::Ptr& attrs);
@ -52,8 +52,8 @@ private:
void CheckResultHandler(const Checkable::Ptr& service, const CheckResult::Ptr& cr);
void NotificationSentHandler(const Notification::Ptr& notification, const Checkable::Ptr& service,
const User::Ptr& user, NotificationType const& notification_type, CheckResult::Ptr const& cr,
const String& author, const String& comment_text, const String& command_name);
const User::Ptr& user, NotificationType const& notification_type, CheckResult::Ptr const& cr,
const String& author, const String& comment_text, const String& command_name);
void FlappingHandler(const Checkable::Ptr& service, FlappingState flapping_state);
void TriggerDowntimeHandler(const Checkable::Ptr& service, const Downtime::Ptr& downtime);
void RemoveDowntimeHandler(const Checkable::Ptr& service, const Downtime::Ptr& downtime);

View File

@ -37,9 +37,9 @@ class ExternalCommandListener : public ObjectImpl<ExternalCommandListener>
{
public:
DECLARE_PTR_TYPEDEFS(ExternalCommandListener);
DECLARE_TYPENAME(ExternalCommandListener);
DECLARE_TYPENAME(ExternalCommandListener);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
protected:
virtual void Start(void);
@ -49,7 +49,7 @@ private:
boost::thread m_CommandThread;
void CommandPipeThread(const String& commandPath);
void ClientHandler(const String& commandPath, int fd);
void ClientHandler(const String& commandPath, int fd);
#endif /* _WIN32 */
};

View File

@ -236,7 +236,7 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host)
"\t" "host_name" "\t" << host->GetName() << "\n";
if (!display_name.IsEmpty()) {
fp << "\t" "display_name" "\t" << host->GetDisplayName() << "\n"
"\t" "alias" "\t" << host->GetDisplayName() << "\n";
"\t" "alias" "\t" << host->GetDisplayName() << "\n";
}
if (!address.IsEmpty())
fp << "\t" "address" "\t" << address << "\n";
@ -300,24 +300,24 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host)
fp << "\t" "host_groups" "\t";
bool first = true;
Array::Ptr groups = host->GetGroups();
Array::Ptr groups = host->GetGroups();
if (groups) {
ObjectLock olock(groups);
if (groups) {
ObjectLock olock(groups);
BOOST_FOREACH(const String& name, groups) {
HostGroup::Ptr hg = HostGroup::GetByName(name);
BOOST_FOREACH(const String& name, groups) {
HostGroup::Ptr hg = HostGroup::GetByName(name);
if (hg) {
if (hg) {
if (!first)
fp << ",";
else
first = false;
fp << hg->GetName();
}
}
}
}
}
}
fp << "\n";
@ -344,7 +344,7 @@ void StatusDataWriter::DumpCheckableStatusAttrs(std::ostream& fp, const Checkabl
if (cr) {
fp << "\t" << "check_execution_time=" << Convert::ToString(Service::CalculateExecutionTime(cr)) << "\n"
"\t" "check_latency=" << Convert::ToString(Service::CalculateLatency(cr)) << "\n";
"\t" "check_latency=" << Convert::ToString(Service::CalculateLatency(cr)) << "\n";
}
Host::Ptr host;
@ -363,7 +363,7 @@ void StatusDataWriter::DumpCheckableStatusAttrs(std::ostream& fp, const Checkabl
if (cr) {
fp << "\t" << "check_source=" << cr->GetCheckSource() << "\n"
"\t" "last_check=" << static_cast<long>(cr->GetScheduleEnd()) << "\n";
"\t" "last_check=" << static_cast<long>(cr->GetScheduleEnd()) << "\n";
}
fp << "\t" << "next_check=" << static_cast<long>(checkable->GetNextCheck()) << "\n"
@ -446,13 +446,13 @@ void StatusDataWriter::DumpServiceObject(std::ostream& fp, const Service::Ptr& s
if (eventcommand)
fp << "\t" "event_handler" "\t" << CompatUtility::GetCommandName(eventcommand) << "\n";
fp << "\t" "contacts" "\t";
DumpNameList(fp, CompatUtility::GetCheckableNotificationUsers(service));
fp << "\n";
fp << "\t" "contacts" "\t";
DumpNameList(fp, CompatUtility::GetCheckableNotificationUsers(service));
fp << "\n";
fp << "\t" "contact_groups" "\t";
DumpNameList(fp, CompatUtility::GetCheckableNotificationUserGroups(service));
fp << "\n";
fp << "\t" "contact_groups" "\t";
DumpNameList(fp, CompatUtility::GetCheckableNotificationUserGroups(service));
fp << "\n";
String notes = service->GetNotes();
String notes_url = service->GetNotesUrl();
@ -460,11 +460,11 @@ void StatusDataWriter::DumpServiceObject(std::ostream& fp, const Service::Ptr& s
String icon_image = service->GetIconImage();
String icon_image_alt = service->GetIconImageAlt();
fp << "\t" "initial_state" "\t" "o" "\n"
"\t" "low_flap_threshold" "\t" << service->GetFlappingThreshold() << "\n"
"\t" "high_flap_threshold" "\t" << service->GetFlappingThreshold() << "\n"
"\t" "process_perf_data" "\t" << CompatUtility::GetCheckableProcessPerformanceData(service) << "\n"
"\t" "check_freshness" << "\t" "1" "\n";
fp << "\t" "initial_state" "\t" "o" "\n"
"\t" "low_flap_threshold" "\t" << service->GetFlappingThreshold() << "\n"
"\t" "high_flap_threshold" "\t" << service->GetFlappingThreshold() << "\n"
"\t" "process_perf_data" "\t" << CompatUtility::GetCheckableProcessPerformanceData(service) << "\n"
"\t" "check_freshness" << "\t" "1" "\n";
if (!notes.IsEmpty())
fp << "\t" "notes" "\t" << notes << "\n";
if (!notes_url.IsEmpty())
@ -480,24 +480,24 @@ void StatusDataWriter::DumpServiceObject(std::ostream& fp, const Service::Ptr& s
fp << "\t" "service_groups" "\t";
bool first = true;
Array::Ptr groups = service->GetGroups();
Array::Ptr groups = service->GetGroups();
if (groups) {
ObjectLock olock(groups);
if (groups) {
ObjectLock olock(groups);
BOOST_FOREACH(const String& name, groups) {
ServiceGroup::Ptr sg = ServiceGroup::GetByName(name);
BOOST_FOREACH(const String& name, groups) {
ServiceGroup::Ptr sg = ServiceGroup::GetByName(name);
if (sg) {
if (sg) {
if (!first)
fp << ",";
else
first = false;
fp << sg->GetName();
}
}
}
}
}
}
fp << "\n";
@ -712,7 +712,7 @@ void StatusDataWriter::UpdateObjectsCache(void)
Service::Ptr child_service;
tie(child_host, child_service) = GetHostService(child);
int state_filter = dep->GetStateFilter();
int state_filter = dep->GetStateFilter();
std::vector<String> failure_criteria;
if (state_filter & StateFilterOK || state_filter & StateFilterUp)
failure_criteria.push_back("o");

View File

@ -42,7 +42,7 @@ public:
DECLARE_PTR_TYPEDEFS(IdoMysqlConnection);
DECLARE_TYPENAME(IdoMysqlConnection);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
protected:
virtual void Resume(void);

View File

@ -363,8 +363,8 @@ IdoPgsqlResult IdoPgsqlConnection::Query(const String& query)
BOOST_THROW_EXCEPTION(
database_error()
<< errinfo_message(message)
<< errinfo_database_query(query)
<< errinfo_message(message)
<< errinfo_database_query(query)
);
}
@ -384,8 +384,8 @@ IdoPgsqlResult IdoPgsqlConnection::Query(const String& query)
BOOST_THROW_EXCEPTION(
database_error()
<< errinfo_message(message)
<< errinfo_database_query(query)
<< errinfo_message(message)
<< errinfo_database_query(query)
);
}

View File

@ -40,9 +40,9 @@ class IdoPgsqlConnection : public ObjectImpl<IdoPgsqlConnection>
{
public:
DECLARE_PTR_TYPEDEFS(IdoPgsqlConnection);
DECLARE_TYPENAME(IdoPgsqlConnection);
DECLARE_TYPENAME(IdoPgsqlConnection);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
protected:
virtual void Resume(void);
@ -51,7 +51,7 @@ protected:
virtual void ActivateObject(const DbObject::Ptr& dbobj);
virtual void DeactivateObject(const DbObject::Ptr& dbobj);
virtual void ExecuteQuery(const DbQuery& query);
virtual void CleanUpExecuteQuery(const String& table, const String& time_key, double time_value);
virtual void CleanUpExecuteQuery(const String& table, const String& time_key, double time_value);
virtual void FillIDCache(const DbType::Ptr& type);
private:

View File

@ -51,8 +51,8 @@ protected:
static Value CustomVariableNamesAccessor(const Value& row);
static Value CustomVariableValuesAccessor(const Value& row);
static Value CustomVariablesAccessor(const Value& row);
static Value ModifiedAttributesAccessor(const Value& row);
static Value ModifiedAttributesListAccessor(const Value& row);
static Value ModifiedAttributesAccessor(const Value& row);
static Value ModifiedAttributesListAccessor(const Value& row);
};
}

View File

@ -47,9 +47,9 @@ protected:
virtual void FetchRows(const AddRowFunction& addRowFn);
static Value NameAccessor(const Value& row);
static Value IdentityAccessor(const Value& row);
static Value NodeAccessor(const Value& row);
static Value IsConnectedAccessor(const Value& row);
static Value IdentityAccessor(const Value& row);
static Value NodeAccessor(const Value& row);
static Value IsConnectedAccessor(const Value& row);
};
}

View File

@ -33,7 +33,7 @@ namespace icinga
class HistoryTable : public Table
{
public:
virtual void UpdateLogEntries(const Dictionary::Ptr& bag, int line_count, int lineno, const AddRowFunction& addRowFn);
virtual void UpdateLogEntries(const Dictionary::Ptr& bag, int line_count, int lineno, const AddRowFunction& addRowFn);
};
}

View File

@ -584,7 +584,7 @@ Value HostsTable::CurrentNotificationNumberAccessor(const Value& row)
if (!host)
return Empty;
return CompatUtility::GetCheckableNotificationNotificationNumber(host);
return CompatUtility::GetCheckableNotificationNotificationNumber(host);
}
Value HostsTable::TotalServicesAccessor(const Value& row)

View File

@ -62,7 +62,7 @@ protected:
static Value ActionUrlAccessor(const Value& row);
static Value ActionUrlExpandedAccessor(const Value& row);
static Value PluginOutputAccessor(const Value& row);
static Value PerfDataAccessor(const Value& row);
static Value PerfDataAccessor(const Value& row);
static Value IconImageAccessor(const Value& row);
static Value IconImageExpandedAccessor(const Value& row);
static Value IconImageAltAccessor(const Value& row);
@ -141,8 +141,8 @@ protected:
static Value ServicesAccessor(const Value& row);
static Value ServicesWithStateAccessor(const Value& row);
static Value ServicesWithInfoAccessor(const Value& row);
static Value CheckSourceAccessor(const Value& row);
static Value IsReachableAccessor(const Value& row);
static Value CheckSourceAccessor(const Value& row);
static Value IsReachableAccessor(const Value& row);
};
}

View File

@ -26,5 +26,5 @@
%attribute %string "bind_host",
%attribute %string "bind_port",
%attribute %string "compat_log_path",
%attribute %string "compat_log_path",
}

View File

@ -37,9 +37,9 @@ class LivestatusListener : public ObjectImpl<LivestatusListener>
{
public:
DECLARE_PTR_TYPEDEFS(LivestatusListener);
DECLARE_TYPENAME(LivestatusListener);
DECLARE_TYPENAME(LivestatusListener);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
static int GetClientsConnected(void);
static int GetConnections(void);

View File

@ -120,27 +120,27 @@ void LivestatusLogUtility::CreateLogCache(std::map<time_t, String> index, Histor
Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
{
Dictionary::Ptr bag = make_shared<Dictionary>();
Dictionary::Ptr bag = make_shared<Dictionary>();
/*
* [1379025342] SERVICE NOTIFICATION: contactname;hostname;servicedesc;WARNING;true;foo output
*/
unsigned long time = atoi(text.SubStr(1, 11).CStr());
/*
* [1379025342] SERVICE NOTIFICATION: contactname;hostname;servicedesc;WARNING;true;foo output
*/
unsigned long time = atoi(text.SubStr(1, 11).CStr());
Log(LogDebug, "LivestatusLogUtility", "Processing log line: '" + text + "'.");
bag->Set("time", time);
Log(LogDebug, "LivestatusLogUtility", "Processing log line: '" + text + "'.");
bag->Set("time", time);
size_t colon = text.FindFirstOf(':');
size_t colon_offset = colon - 13;
size_t colon = text.FindFirstOf(':');
size_t colon_offset = colon - 13;
String type = String(text.SubStr(13, colon_offset));
String options = String(text.SubStr(colon + 1));
String type = String(text.SubStr(13, colon_offset));
String options = String(text.SubStr(colon + 1));
type.Trim();
options.Trim();
type.Trim();
options.Trim();
bag->Set("type", type);
bag->Set("options", options);
bag->Set("type", type);
bag->Set("options", options);
std::vector<String> tokens;
boost::algorithm::split(tokens, options, boost::is_any_of(";"));
@ -260,7 +260,7 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
bag->Set("contact_name", tokens[0]);
bag->Set("host_name", tokens[1]);
bag->Set("state_type", tokens[2].CStr());
bag->Set("state", Service::StateFromString(tokens[3]));
bag->Set("state", Service::StateFromString(tokens[3]));
bag->Set("command_name", tokens[4]);
bag->Set("plugin_output", tokens[5]);
@ -274,9 +274,9 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
bag->Set("contact_name", tokens[0]);
bag->Set("host_name", tokens[1]);
bag->Set("service_description", tokens[2]);
bag->Set("service_description", tokens[2]);
bag->Set("state_type", tokens[3].CStr());
bag->Set("state", Service::StateFromString(tokens[4]));
bag->Set("state", Service::StateFromString(tokens[4]));
bag->Set("command_name", tokens[5]);
bag->Set("plugin_output", tokens[6]);
@ -292,41 +292,41 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
bag->Set("state", Host::StateFromString(tokens[1]));
bag->Set("plugin_output", tokens[2]);
bag->Set("log_class", LogEntryClassPassive);
bag->Set("log_class", LogEntryClassPassive);
return bag;
return bag;
} else if (type.Contains("PASSIVE SERVICE CHECK")) {
if (tokens.size() < 4)
return bag;
bag->Set("host_name", tokens[0]);
bag->Set("service_description", tokens[1]);
bag->Set("service_description", tokens[1]);
bag->Set("state", Host::StateFromString(tokens[2]));
bag->Set("plugin_output", tokens[3]);
bag->Set("log_class", LogEntryClassPassive);
bag->Set("log_class", LogEntryClassPassive);
return bag;
return bag;
} else if (type.Contains("EXTERNAL COMMAND")) {
bag->Set("log_class", LogEntryClassCommand);
/* string processing not implemented in 1.x */
return bag;
return bag;
} else if (type.Contains("LOG VERSION")) {
bag->Set("log_class", LogEntryClassProgram);
bag->Set("log_type", LogEntryTypeVersion);
return bag;
return bag;
} else if (type.Contains("logging initial states")) {
bag->Set("log_class", LogEntryClassProgram);
bag->Set("log_type", LogEntryTypeInitialStates);
return bag;
return bag;
} else if (type.Contains("starting... (PID=")) {
bag->Set("log_class", LogEntryClassProgram);
bag->Set("log_type", LogEntryTypeProgramStarting);
return bag;
return bag;
}
/* program */
else if (type.Contains("restarting...") ||
@ -336,8 +336,8 @@ Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
type.Contains("standby mode...")) {
bag->Set("log_class", LogEntryClassProgram);
return bag;
return bag;
}
return bag;
return bag;
}

View File

@ -44,15 +44,15 @@ public:
virtual String GetName(void) const;
virtual String GetPrefix(void) const;
void UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, int line_count, int lineno, const AddRowFunction& addRowFn);
void UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, int line_count, int lineno, const AddRowFunction& addRowFn);
protected:
virtual void FetchRows(const AddRowFunction& addRowFn);
static Object::Ptr HostAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor);
static Object::Ptr ServiceAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor);
static Object::Ptr ContactAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor);
static Object::Ptr CommandAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor);
static Object::Ptr HostAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor);
static Object::Ptr ServiceAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor);
static Object::Ptr ContactAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor);
static Object::Ptr CommandAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor);
static Value TimeAccessor(const Value& row);
static Value LinenoAccessor(const Value& row);
@ -71,11 +71,11 @@ protected:
static Value CommandNameAccessor(const Value& row);
private:
std::map<time_t, String> m_LogFileIndex;
std::map<time_t, Dictionary::Ptr> m_RowsCache;
time_t m_TimeFrom;
time_t m_TimeUntil;
String m_CompatLogPath;
std::map<time_t, String> m_LogFileIndex;
std::map<time_t, Dictionary::Ptr> m_RowsCache;
time_t m_TimeFrom;
time_t m_TimeUntil;
String m_CompatLogPath;
};
}

View File

@ -519,7 +519,7 @@ Value ServicesTable::NoMoreNotificationsAccessor(const Value& row)
if (!service)
return Empty;
return CompatUtility::GetCheckableNoMoreNotifications(service);
return CompatUtility::GetCheckableNoMoreNotifications(service);
}
Value ServicesTable::LastTimeOkAccessor(const Value& row)

View File

@ -95,7 +95,7 @@ protected:
static Value AcceptPassiveChecksAccessor(const Value& row);
static Value EventHandlerEnabledAccessor(const Value& row);
static Value NotificationsEnabledAccessor(const Value& row);
static Value ProcessPerformanceDataAccessor(const Value& row);
static Value ProcessPerformanceDataAccessor(const Value& row);
static Value ActiveChecksEnabledAccessor(const Value& row);
static Value CheckOptionsAccessor(const Value& row);
static Value FlapDetectionEnabledAccessor(const Value& row);
@ -124,8 +124,8 @@ protected:
static Value CustomVariablesAccessor(const Value& row);
static Value GroupsAccessor(const Value& row);
static Value ContactGroupsAccessor(const Value& row);
static Value CheckSourceAccessor(const Value& row);
static Value IsReachableAccessor(const Value& row);
static Value CheckSourceAccessor(const Value& row);
static Value IsReachableAccessor(const Value& row);
};
}

View File

@ -50,8 +50,8 @@ public:
protected:
virtual void FetchRows(const AddRowFunction& addRowFn);
static Object::Ptr HostAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor);
static Object::Ptr ServiceAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor);
static Object::Ptr HostAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor);
static Object::Ptr ServiceAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor);
static Value TimeAccessor(const Value& row);
static Value LinenoAccessor(const Value& row);
@ -81,11 +81,11 @@ protected:
static Value DurationPartUnmonitoredAccessor(const Value& row);
private:
std::map<time_t, String> m_LogFileIndex;
std::map<Checkable::Ptr, Array::Ptr> m_CheckablesCache;
time_t m_TimeFrom;
time_t m_TimeUntil;
String m_CompatLogPath;
std::map<time_t, String> m_LogFileIndex;
std::map<Checkable::Ptr, Array::Ptr> m_CheckablesCache;
time_t m_TimeFrom;
time_t m_TimeUntil;
String m_CompatLogPath;
};
}

View File

@ -48,10 +48,10 @@ protected:
static Value ConnectionsAccessor(const Value& row);
static Value ConnectionsRateAccessor(const Value& row);
static Value ServiceChecksAccessor(const Value& row);
static Value ServiceChecksRateAccessor(const Value& row);
static Value HostChecksAccessor(const Value& row);
static Value HostChecksRateAccessor(const Value& row);
static Value ServiceChecksAccessor(const Value& row);
static Value ServiceChecksRateAccessor(const Value& row);
static Value HostChecksAccessor(const Value& row);
static Value HostChecksRateAccessor(const Value& row);
static Value ExternalCommandsAccessor(const Value& row);
static Value ExternalCommandsRateAccessor(const Value& row);
static Value NagiosPidAccessor(const Value& row);
@ -60,7 +60,7 @@ protected:
static Value ExecuteHostChecksAccessor(const Value& row);
static Value EnableEventHandlersAccessor(const Value& row);
static Value EnableFlapDetectionAccessor(const Value& row);
static Value ProcessPerformanceDataAccessor(const Value& row);
static Value ProcessPerformanceDataAccessor(const Value& row);
static Value ProgramStartAccessor(const Value& row);
static Value NumHostsAccessor(const Value& row);
static Value NumServicesAccessor(const Value& row);

View File

@ -35,9 +35,9 @@ class NotificationComponent : public ObjectImpl<NotificationComponent>
{
public:
DECLARE_PTR_TYPEDEFS(NotificationComponent);
DECLARE_TYPENAME(NotificationComponent);
DECLARE_TYPENAME(NotificationComponent);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
virtual void Start(void);

View File

@ -41,20 +41,20 @@ public:
DECLARE_PTR_TYPEDEFS(GraphiteWriter);
DECLARE_TYPENAME(GraphiteWriter);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
protected:
virtual void Start(void);
private:
Stream::Ptr m_Stream;
Timer::Ptr m_ReconnectTimer;
void CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr);
void SendMetric(const String& prefix, const String& name, double value);
void SendPerfdata(const String& prefix, const CheckResult::Ptr& cr);
static void SanitizeMetric(String& str);
void SendMetric(const String& prefix, const String& name, double value);
void SendPerfdata(const String& prefix, const CheckResult::Ptr& cr);
static void SanitizeMetric(String& str);
void ReconnectTimerHandler(void);
};

View File

@ -28,6 +28,6 @@
}
%type GraphiteWriter {
%attribute %string "host",
%attribute %string "port",
%attribute %string "host",
%attribute %string "port",
}

View File

@ -40,7 +40,7 @@ public:
DECLARE_PTR_TYPEDEFS(PerfdataWriter);
DECLARE_TYPENAME(PerfdataWriter);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
protected:
virtual void Start(void);
@ -52,7 +52,7 @@ private:
void RotationTimerHandler(void);
std::ofstream m_ServiceOutputFile;
std::ofstream m_HostOutputFile;
std::ofstream m_HostOutputFile;
void RotateFile(std::ofstream& output, const String& temp_path, const String& perfdata_path);
};

View File

@ -35,9 +35,9 @@ class I2_BASE_API FileLogger : public ObjectImpl<FileLogger>
{
public:
DECLARE_PTR_TYPEDEFS(FileLogger);
DECLARE_TYPENAME(FileLogger);
DECLARE_TYPENAME(FileLogger);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
virtual void Start(void);

View File

@ -136,7 +136,7 @@ void StackTrace::Print(std::ostream& fp, int ignoreFrames) const
}
}
fp << "\t(" << i - ignoreFrames - 1 << ") " << message << std::endl;
fp << "\t(" << i - ignoreFrames - 1 << ") " << message << std::endl;
}
free(messages);

View File

@ -45,7 +45,7 @@ public:
void BindStream(std::ostream *stream, bool ownsStream);
static void ProcessLogEntry(std::ostream& stream, bool tty, const LogEntry& entry);
static bool IsTty(std::ostream& stream);
static bool IsTty(std::ostream& stream);
protected:
virtual void ProcessLogEntry(const LogEntry& entry);

View File

@ -36,9 +36,9 @@ class I2_BASE_API SyslogLogger : public ObjectImpl<SyslogLogger>
{
public:
DECLARE_PTR_TYPEDEFS(SyslogLogger);
DECLARE_TYPENAME(SyslogLogger);
DECLARE_TYPENAME(SyslogLogger);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
protected:
virtual void ProcessLogEntry(const LogEntry& entry);

View File

@ -47,17 +47,17 @@ typedef boost::error_info<struct errinfo_openssl_error_, int> errinfo_openssl_er
inline std::string to_string(const errinfo_openssl_error& e)
{
std::ostringstream tmp;
int code = e.value();
std::ostringstream tmp;
int code = e.value();
char errbuf[120];
const char *message = ERR_error_string(code, errbuf);
const char *message = ERR_error_string(code, errbuf);
if (message == NULL)
message = "Unknown error.";
if (message == NULL)
message = "Unknown error.";
tmp << code << ", \"" << message << "\"";
return tmp.str();
tmp << code << ", \"" << message << "\"";
return tmp.str();
}
}

View File

@ -777,22 +777,22 @@ String Utility::FormatErrorNumber(int code) {
std::ostringstream msgbuf;
#ifdef _WIN32
char *message;
String result = "Unknown error.";
char *message;
String result = "Unknown error.";
DWORD rc = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM, NULL, code, 0, (char *)&message,
0, NULL);
DWORD rc = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM, NULL, code, 0, (char *)&message,
0, NULL);
if (rc != 0) {
result = String(message);
LocalFree(message);
if (rc != 0) {
result = String(message);
LocalFree(message);
/* remove trailing new-line characters */
boost::algorithm::trim_right(result);
}
/* remove trailing new-line characters */
boost::algorithm::trim_right(result);
}
msgbuf << code << ", \"" << result << "\"";
msgbuf << code << ", \"" << result << "\"";
#else
msgbuf << strerror(code);
#endif

View File

@ -54,7 +54,7 @@ public:
static ConfigCompilerContext *GetInstance(void);
private:
std::vector<ConfigCompilerMessage> m_Messages;
std::vector<ConfigCompilerMessage> m_Messages;
mutable boost::mutex m_Mutex;
};

View File

@ -42,7 +42,7 @@ public:
virtual Dictionary::Ptr GetStatusFields(void) const;
protected:
virtual void OnConfigUpdate(void);
virtual void OnConfigUpdate(void);
};
}

View File

@ -18,31 +18,31 @@
******************************************************************************/
%type DbConnection {
%validator "ValidateFailoverTimeout"
%validator "ValidateFailoverTimeout"
%attribute %string "table_prefix",
%attribute %dictionary "cleanup" {
%attribute %number "acknowledgements_age",
%attribute %number "commenthistory_age",
%attribute %number "contactnotifications_age",
%attribute %number "contactnotificationmethods_age",
%attribute %number "downtimehistory_age",
%attribute %number "eventhandlers_age",
%attribute %number "externalcommands_age",
%attribute %number "flappinghistory_age",
%attribute %number "hostchecks_age",
%attribute %number "logentries_age",
%attribute %number "notifications_age",
%attribute %number "processevents_age",
%attribute %number "statehistory_age",
%attribute %number "servicechecks_age",
%attribute %number "systemcommands_age",
%attribute %number "commenthistory_age",
%attribute %number "contactnotifications_age",
%attribute %number "contactnotificationmethods_age",
%attribute %number "downtimehistory_age",
%attribute %number "eventhandlers_age",
%attribute %number "externalcommands_age",
%attribute %number "flappinghistory_age",
%attribute %number "hostchecks_age",
%attribute %number "logentries_age",
%attribute %number "notifications_age",
%attribute %number "processevents_age",
%attribute %number "statehistory_age",
%attribute %number "servicechecks_age",
%attribute %number "systemcommands_age",
},
%attribute %number "categories",
%attribute %number "enable_ha",
%attribute %number "enable_ha",
%attribute %number "failover_timeout",
%attribute %number "failover_timeout",
}

View File

@ -419,9 +419,8 @@ void DbConnection::ValidateFailoverTimeout(const String& location, const Diction
if (!attrs->Contains("failover_timeout"))
return;
Value failover_timeout = attrs->Get("failover_timeout");
if (failover_timeout < 60) {
ConfigCompilerContext::GetInstance()->AddMessage(true, "Validation failed for " +
location + ": Failover timeout minimum is 60s.");
if (attrs->Get("failover_timeout") < 60) {
ConfigCompilerContext::GetInstance()->AddMessage(true, "Validation failed for " +
location + ": Failover timeout minimum is 60s.");
}
}

View File

@ -63,10 +63,10 @@ public:
void SetStatusUpdate(const DbObject::Ptr& dbobj, bool hasupdate);
bool GetStatusUpdate(const DbObject::Ptr& dbobj) const;
static void ValidateFailoverTimeout(const String& location, const Dictionary::Ptr& attrs);
static void ValidateFailoverTimeout(const String& location, const Dictionary::Ptr& attrs);
protected:
virtual void OnConfigLoaded(void);
virtual void OnConfigLoaded(void);
virtual void Start(void);
virtual void Resume(void);
virtual void Pause(void);
@ -85,7 +85,7 @@ protected:
private:
std::map<DbObject::Ptr, DbReference> m_ObjectIDs;
std::map<std::pair<DbType::Ptr, DbReference>, DbReference> m_InsertIDs;
std::map<CustomVarObject::Ptr, DbReference> m_NotificationInsertIDs;
std::map<CustomVarObject::Ptr, DbReference> m_NotificationInsertIDs;
std::set<DbObject::Ptr> m_ActiveObjects;
std::set<DbObject::Ptr> m_ConfigUpdates;
std::set<DbObject::Ptr> m_StatusUpdates;

View File

@ -1087,18 +1087,18 @@ void DbEvents::AddFlappingLogHistory(const Checkable::Ptr& checkable, FlappingSt
std::ostringstream msgbuf;
if (service) {
msgbuf << "SERVICE FLAPPING ALERT: "
<< host->GetName() << ";"
<< service->GetShortName() << ";"
<< flapping_state_str << "; "
<< flapping_output
<< "";
msgbuf << "SERVICE FLAPPING ALERT: "
<< host->GetName() << ";"
<< service->GetShortName() << ";"
<< flapping_state_str << "; "
<< flapping_output
<< "";
} else {
msgbuf << "HOST FLAPPING ALERT: "
<< host->GetName() << ";"
<< flapping_state_str << "; "
<< flapping_output
<< "";
msgbuf << "HOST FLAPPING ALERT: "
<< host->GetName() << ";"
<< flapping_state_str << "; "
<< flapping_output
<< "";
}
AddLogHistory(checkable, msgbuf.str(), LogEntryTypeInfoMessage);

View File

@ -71,16 +71,16 @@ public:
static void StaticInitialize(void);
static void AddCommentByType(const DynamicObject::Ptr& object, const Comment::Ptr& comment, bool historical);
static void AddComments(const Checkable::Ptr& checkable);
static void RemoveComments(const Checkable::Ptr& checkable);
static void AddComments(const Checkable::Ptr& checkable);
static void RemoveComments(const Checkable::Ptr& checkable);
static void AddDowntimeByType(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime, bool historical);
static void AddDowntimes(const Checkable::Ptr& checkable);
static void RemoveDowntimes(const Checkable::Ptr& checkable);
static void AddDowntimeByType(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime, bool historical);
static void AddDowntimes(const Checkable::Ptr& checkable);
static void RemoveDowntimes(const Checkable::Ptr& checkable);
static void AddLogHistory(const Checkable::Ptr& checkable, String buffer, LogEntryType type);
static void AddLogHistory(const Checkable::Ptr& checkable, String buffer, LogEntryType type);
/* Status */
/* Status */
static void NextCheckChangedHandler(const Checkable::Ptr& checkable, double nextCheck);
static void FlappingChangedHandler(const Checkable::Ptr& checkable, FlappingState state);
static void LastNotificationChangedHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable);
@ -102,34 +102,34 @@ public:
static void RemoveAcknowledgement(const Checkable::Ptr& checkable);
static void AddAcknowledgementInternal(const Checkable::Ptr& checkable, AcknowledgementType type, bool add);
/* comment, downtime, acknowledgement history */
static void AddCommentHistory(const Checkable::Ptr& checkable, const Comment::Ptr& comment);
/* comment, downtime, acknowledgement history */
static void AddCommentHistory(const Checkable::Ptr& checkable, const Comment::Ptr& comment);
static void AddDowntimeHistory(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime);
static void AddAcknowledgementHistory(const Checkable::Ptr& checkable, const String& author, const String& comment,
AcknowledgementType type, double expiry);
static void AddAcknowledgementHistory(const Checkable::Ptr& checkable, const String& author, const String& comment,
AcknowledgementType type, double expiry);
/* notification & contactnotification history */
/* notification & contactnotification history */
static void 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);
const std::set<User::Ptr>& users, NotificationType type, const CheckResult::Ptr& cr, const String& author,
const String& text);
/* statehistory */
/* statehistory */
static void AddStateChangeHistory(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type);
/* logentries */
/* logentries */
static void AddCheckResultLogHistory(const Checkable::Ptr& checkable, const CheckResult::Ptr &cr);
static void AddTriggerDowntimeLogHistory(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime);
static void AddRemoveDowntimeLogHistory(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime);
static void AddTriggerDowntimeLogHistory(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime);
static void AddRemoveDowntimeLogHistory(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime);
static void AddNotificationSentLogHistory(const Notification::Ptr& notification, const Checkable::Ptr& checkable,
const User::Ptr& user, NotificationType notification_type, const CheckResult::Ptr& cr, const String& author,
const String& comment_text);
static void AddFlappingLogHistory(const Checkable::Ptr& checkable, FlappingState flapping_state);
const User::Ptr& user, NotificationType notification_type, const CheckResult::Ptr& cr, const String& author,
const String& comment_text);
static void AddFlappingLogHistory(const Checkable::Ptr& checkable, FlappingState flapping_state);
/* other history */
static void AddFlappingHistory(const Checkable::Ptr& checkable, FlappingState flapping_state);
/* other history */
static void AddFlappingHistory(const Checkable::Ptr& checkable, FlappingState flapping_state);
static void AddServiceCheckHistory(const Checkable::Ptr& checkable, const CheckResult::Ptr &cr);
static void AddEventHandlerHistory(const Checkable::Ptr& checkable);
static void AddExternalCommandHistory(double time, const String& command, const std::vector<String>& arguments);
static void AddEventHandlerHistory(const Checkable::Ptr& checkable);
static void AddExternalCommandHistory(double time, const String& command, const std::vector<String>& arguments);
private:
DbEvents(void);

View File

@ -39,17 +39,17 @@ public:
EndpointDbObject(const shared_ptr<DbType>& type, const String& name1, const String& name2);
static void StaticInitialize(void);
static void StaticInitialize(void);
virtual Dictionary::Ptr GetConfigFields(void) const;
virtual Dictionary::Ptr GetStatusFields(void) const;
protected:
virtual void OnConfigUpdate(void);
virtual void OnConfigUpdate(void);
private:
static void UpdateConnectedStatus(const Endpoint::Ptr& endpoint);
static int EndpointIsConnected(const Endpoint::Ptr& endpoint);
static void UpdateConnectedStatus(const Endpoint::Ptr& endpoint);
static int EndpointIsConnected(const Endpoint::Ptr& endpoint);
};
}

View File

@ -41,7 +41,7 @@ public:
virtual Dictionary::Ptr GetConfigFields(void) const;
virtual Dictionary::Ptr GetStatusFields(void) const;
virtual void OnConfigUpdate(void);
virtual void OnConfigUpdate(void);
virtual bool IsStatusAttribute(const String& attribute) const;
};

View File

@ -190,7 +190,7 @@ public:
static void RemoveDowntime(const String& id, bool cancelled, const MessageOrigin& origin = MessageOrigin());
void TriggerDowntimes(void);
void TriggerDowntimes(void);
static void TriggerDowntime(const String& id);
static String GetDowntimeIDFromLegacyID(int id);

View File

@ -37,25 +37,25 @@ struct CheckableCheckStatistics {
};
struct ServiceStatistics {
double services_ok;
double services_warning;
double services_critical;
double services_unknown;
double services_pending;
double services_unreachable;
double services_flapping;
double services_in_downtime;
double services_acknowledged;
double services_ok;
double services_warning;
double services_critical;
double services_unknown;
double services_pending;
double services_unreachable;
double services_flapping;
double services_in_downtime;
double services_acknowledged;
};
struct HostStatistics {
double hosts_up;
double hosts_down;
double hosts_unreachable;
double hosts_pending;
double hosts_flapping;
double hosts_in_downtime;
double hosts_acknowledged;
double hosts_up;
double hosts_down;
double hosts_unreachable;
double hosts_pending;
double hosts_flapping;
double hosts_in_downtime;
double hosts_acknowledged;
};
/**
@ -79,12 +79,12 @@ public:
static void UpdatePassiveServiceChecksStatistics(long tv, int num);
static int GetPassiveServiceChecksStatistics(long timespan);
static CheckableCheckStatistics CalculateHostCheckStats(void);
static CheckableCheckStatistics CalculateServiceCheckStats(void);
static HostStatistics CalculateHostStats(void);
static ServiceStatistics CalculateServiceStats(void);
static CheckableCheckStatistics CalculateHostCheckStats(void);
static CheckableCheckStatistics CalculateServiceCheckStats(void);
static HostStatistics CalculateHostStats(void);
static ServiceStatistics CalculateServiceStats(void);
static std::pair<Dictionary::Ptr, Dictionary::Ptr> GetFeatureStats(void);
static std::pair<Dictionary::Ptr, Dictionary::Ptr> GetFeatureStats(void);
private:
CIB(void);

View File

@ -314,8 +314,8 @@ int CompatUtility::GetCheckableIsAcknowledged(const Checkable::Ptr& checkable)
int CompatUtility::GetCheckableNoMoreNotifications(const Checkable::Ptr& checkable)
{
if (CompatUtility::GetCheckableNotificationNotificationInterval(checkable) == 0 && !checkable->GetVolatile())
return 1;
if (CompatUtility::GetCheckableNotificationNotificationInterval(checkable) == 0 && !checkable->GetVolatile())
return 1;
return 0;
}

View File

@ -49,7 +49,7 @@ public:
static int GetHostNotifyOnUnreachable(const Host::Ptr& host);
/* service */
static String GetCheckableCommandArgs(const Checkable::Ptr& checkable);
static String GetCheckableCommandArgs(const Checkable::Ptr& checkable);
static int GetCheckableCheckType(const Checkable::Ptr& checkable);
static double GetCheckableCheckInterval(const Checkable::Ptr& checkable);
static double GetCheckableRetryInterval(const Checkable::Ptr& checkable);
@ -62,7 +62,7 @@ public:
static int GetCheckableEventHandlerEnabled(const Checkable::Ptr& checkable);
static int GetCheckableFlapDetectionEnabled(const Checkable::Ptr& checkable);
static int GetCheckableIsFlapping(const Checkable::Ptr& checkable);
static int GetCheckableIsReachable(const Checkable::Ptr& checkable);
static int GetCheckableIsReachable(const Checkable::Ptr& checkable);
static String GetCheckablePercentStateChange(const Checkable::Ptr& checkable);
static int GetCheckableProcessPerformanceData(const Checkable::Ptr& checkable);

View File

@ -127,10 +127,10 @@ private:
static void ChangeSvcModattr(double time, const std::vector<String>& arguments);
static void ChangeHostModattr(double time, const std::vector<String>& arguments);
static void ChangeUserModattr(double time, const std::vector<String>& arguments);
static void ChangeCheckcommandModattr(double time, const std::vector<String>& arguments);
static void ChangeEventcommandModattr(double time, const std::vector<String>& arguments);
static void ChangeNotificationcommandModattr(double time, const std::vector<String>& arguments);
static void ChangeUserModattr(double time, const std::vector<String>& arguments);
static void ChangeCheckcommandModattr(double time, const std::vector<String>& arguments);
static void ChangeEventcommandModattr(double time, const std::vector<String>& arguments);
static void ChangeNotificationcommandModattr(double time, const std::vector<String>& arguments);
static void ChangeNormalSvcCheckInterval(double time, const std::vector<String>& arguments);
static void ChangeNormalHostCheckInterval(double time, const std::vector<String>& arguments);
@ -148,12 +148,12 @@ private:
static void ChangeMaxSvcCheckAttempts(double time, const std::vector<String>& arguments);
static void ChangeHostCheckTimeperiod(double time, const std::vector<String>& arguments);
static void ChangeSvcCheckTimeperiod(double time, const std::vector<String>& arguments);
static void ChangeCustomHostVar(double time, const std::vector<String>& arguments);
static void ChangeCustomSvcVar(double time, const std::vector<String>& arguments);
static void ChangeCustomUserVar(double time, const std::vector<String>& arguments);
static void ChangeCustomCheckcommandVar(double time, const std::vector<String>& arguments);
static void ChangeCustomEventcommandVar(double time, const std::vector<String>& arguments);
static void ChangeCustomNotificationcommandVar(double time, const std::vector<String>& arguments);
static void ChangeCustomHostVar(double time, const std::vector<String>& arguments);
static void ChangeCustomSvcVar(double time, const std::vector<String>& arguments);
static void ChangeCustomUserVar(double time, const std::vector<String>& arguments);
static void ChangeCustomCheckcommandVar(double time, const std::vector<String>& arguments);
static void ChangeCustomEventcommandVar(double time, const std::vector<String>& arguments);
static void ChangeCustomNotificationcommandVar(double time, const std::vector<String>& arguments);
static void EnableHostgroupHostNotifications(double time, const std::vector<String>& arguments);
static void EnableHostgroupSvcNotifications(double time, const std::vector<String>& arguments);
@ -165,8 +165,8 @@ private:
static void DisableServicegroupSvcNotifications(double time, const std::vector<String>& arguments);
private:
static void ChangeCommandModattrInternal(const Command::Ptr& command, int mod_attr);
static void ChangeCustomCommandVarInternal(const Command::Ptr& command, const String& name, const Value& value);
static void ChangeCommandModattrInternal(const Command::Ptr& command, int mod_attr);
static void ChangeCustomCommandVarInternal(const Command::Ptr& command, const String& name, const Value& value);
};
}

View File

@ -34,10 +34,10 @@ INITIALIZE_ONCE(&HostGroup::RegisterObjectRuleHandler);
void HostGroup::RegisterObjectRuleHandler(void)
{
ObjectRule::RegisterType("HostGroup", &HostGroup::EvaluateObjectRules);
ObjectRule::RegisterType("HostGroup", &HostGroup::EvaluateObjectRules);
}
bool HostGroup::EvaluateObjectRuleOne(const Host::Ptr host, const ObjectRule& rule)
bool HostGroup::EvaluateObjectRuleOne(const Host::Ptr& host, const ObjectRule& rule)
{
DebugInfo di = rule.GetDebugInfo();

View File

@ -44,17 +44,17 @@ public:
void AddMember(const Host::Ptr& host);
void RemoveMember(const Host::Ptr& host);
bool ResolveGroupMembership(Host::Ptr const& host, bool add = true, int rstack = 0);
bool ResolveGroupMembership(const Host::Ptr& host, bool add = true, int rstack = 0);
static void RegisterObjectRuleHandler(void);
static void RegisterObjectRuleHandler(void);
private:
mutable boost::mutex m_HostGroupMutex;
std::set<Host::Ptr> m_Members;
static bool EvaluateObjectRuleOne(const Host::Ptr host, const ObjectRule& rule);
static bool EvaluateObjectRuleOne(const Host::Ptr& host, const ObjectRule& rule);
static void EvaluateObjectRule(const ObjectRule& rule);
static void EvaluateObjectRules(const std::vector<ObjectRule>& rules);
static void EvaluateObjectRules(const std::vector<ObjectRule>& rules);
};
}

View File

@ -21,8 +21,8 @@
}
%type IcingaStatusWriter {
%attribute %string "status_path",
%attribute %number "update_interval"
%attribute %string "status_path",
%attribute %number "update_interval"
}
%type Checkable {

View File

@ -42,13 +42,13 @@ public:
int Main(void);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
static Value StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& perfdata);
static IcingaApplication::Ptr GetInstance(void);
String GetPidPath(void) const;
Dictionary::Ptr GetVars(void) const;
String GetNodeName(void) const;
String GetNodeName(void) const;
virtual bool ResolveMacro(const String& macro, const CheckResult::Ptr& cr, String *result) const;

View File

@ -143,29 +143,29 @@ void IcingaStatusWriter::StatusTimerHandler(void)
{
Log(LogNotice, "IcingaStatusWriter", "Writing status.json file");
String statuspath = GetStatusPath();
String statuspathtmp = statuspath + ".tmp"; /* XXX make this a global definition */
String statuspath = GetStatusPath();
String statuspathtmp = statuspath + ".tmp"; /* XXX make this a global definition */
std::ofstream statusfp;
statusfp.open(statuspathtmp.CStr(), std::ofstream::out | std::ofstream::trunc);
std::ofstream statusfp;
statusfp.open(statuspathtmp.CStr(), std::ofstream::out | std::ofstream::trunc);
statusfp << std::fixed;
statusfp << std::fixed;
statusfp << JsonSerialize(GetStatusData());
statusfp.close();
statusfp.close();
#ifdef _WIN32
_unlink(statuspath.CStr());
_unlink(statuspath.CStr());
#endif /* _WIN32 */
if (rename(statuspathtmp.CStr(), statuspath.CStr()) < 0) {
BOOST_THROW_EXCEPTION(posix_error()
<< boost::errinfo_api_function("rename")
<< boost::errinfo_errno(errno)
<< boost::errinfo_file_name(statuspathtmp));
}
if (rename(statuspathtmp.CStr(), statuspath.CStr()) < 0) {
BOOST_THROW_EXCEPTION(posix_error()
<< boost::errinfo_api_function("rename")
<< boost::errinfo_errno(errno)
<< boost::errinfo_file_name(statuspathtmp));
}
Log(LogNotice, "IcingaStatusWriter", "Finished writing status.json file");
Log(LogNotice, "IcingaStatusWriter", "Finished writing status.json file");
}

View File

@ -34,10 +34,10 @@ INITIALIZE_ONCE(&ServiceGroup::RegisterObjectRuleHandler);
void ServiceGroup::RegisterObjectRuleHandler(void)
{
ObjectRule::RegisterType("ServiceGroup", &ServiceGroup::EvaluateObjectRules);
ObjectRule::RegisterType("ServiceGroup", &ServiceGroup::EvaluateObjectRules);
}
bool ServiceGroup::EvaluateObjectRuleOne(const Service::Ptr service, const ObjectRule& rule)
bool ServiceGroup::EvaluateObjectRuleOne(const Service::Ptr& service, const ObjectRule& rule)
{
DebugInfo di = rule.GetDebugInfo();

View File

@ -44,17 +44,17 @@ public:
void AddMember(const Service::Ptr& service);
void RemoveMember(const Service::Ptr& service);
bool ResolveGroupMembership(Service::Ptr const& service, bool add = true, int rstack = 0);
bool ResolveGroupMembership(const Service::Ptr& service, bool add = true, int rstack = 0);
static void RegisterObjectRuleHandler(void);
static void RegisterObjectRuleHandler(void);
private:
mutable boost::mutex m_ServiceGroupMutex;
std::set<Service::Ptr> m_Members;
static bool EvaluateObjectRuleOne(const Service::Ptr service, const ObjectRule& rule);
static bool EvaluateObjectRuleOne(const Service::Ptr& service, const ObjectRule& rule);
static void EvaluateObjectRule(const ObjectRule& rule);
static void EvaluateObjectRules(const std::vector<ObjectRule>& rules);
static void EvaluateObjectRules(const std::vector<ObjectRule>& rules);
};
}

View File

@ -34,10 +34,10 @@ INITIALIZE_ONCE(&UserGroup::RegisterObjectRuleHandler);
void UserGroup::RegisterObjectRuleHandler(void)
{
ObjectRule::RegisterType("UserGroup", &UserGroup::EvaluateObjectRules);
ObjectRule::RegisterType("UserGroup", &UserGroup::EvaluateObjectRules);
}
bool UserGroup::EvaluateObjectRuleOne(const User::Ptr user, const ObjectRule& rule)
bool UserGroup::EvaluateObjectRuleOne(const User::Ptr& user, const ObjectRule& rule)
{
DebugInfo di = rule.GetDebugInfo();

View File

@ -44,17 +44,17 @@ public:
void AddMember(const User::Ptr& user);
void RemoveMember(const User::Ptr& user);
bool ResolveGroupMembership(User::Ptr const& user, bool add = true, int rstack = 0);
bool ResolveGroupMembership(const User::Ptr& user, bool add = true, int rstack = 0);
static void RegisterObjectRuleHandler(void);
static void RegisterObjectRuleHandler(void);
private:
mutable boost::mutex m_UserGroupMutex;
std::set<User::Ptr> m_Members;
static bool EvaluateObjectRuleOne(const User::Ptr user, const ObjectRule& rule);
static bool EvaluateObjectRuleOne(const User::Ptr& user, const ObjectRule& rule);
static void EvaluateObjectRule(const ObjectRule& rule);
static void EvaluateObjectRules(const std::vector<ObjectRule>& rules);
static void EvaluateObjectRules(const std::vector<ObjectRule>& rules);
};
}

View File

@ -37,7 +37,7 @@ public:
private:
ClusterCheckTask(void);
static String FormatArray(const Array::Ptr& arr);
static String FormatArray(const Array::Ptr& arr);
};
}

View File

@ -40,7 +40,7 @@ public:
private:
PluginEventTask(void);
static void ProcessFinishedHandler(const Checkable::Ptr& checkable, const Value& command, const ProcessResult& pr);
static void ProcessFinishedHandler(const Checkable::Ptr& checkable, const Value& command, const ProcessResult& pr);
};
}