msgbuf << "HOST ALERT: "
<< host->GetName() << ";"
- << CompatUtility::GetHostStateString(host) << ";"
+ << GetHostStateString(host) << ";"
<< Host::StateTypeToString(host->GetStateType()) << ";"
<< attempt_after << ";"
<< output << ""
if (service)
notification_type_str = Service::StateToString(service->GetState());
else
- notification_type_str = CompatUtility::GetHostStateString(host);
+ notification_type_str = GetHostStateString(host);
}
String author_comment = "";
<< user->GetName() << ";"
<< host->GetName() << ";"
<< notification_type_str << " "
- << "(" << CompatUtility::GetHostStateString(host) << ");"
+ << "(" << GetHostStateString(host) << ");"
<< command_name << ";"
<< output << ";"
<< author_comment
} else {
msgbuf << "HOST EVENT HANDLER: "
<< host->GetName() << ";"
- << CompatUtility::GetHostStateString(host) << ";"
+ << GetHostStateString(host) << ";"
<< Host::StateTypeToString(host->GetStateType()) << ";"
<< current_attempt << ";"
<< event_command_name;
}
}
+String CompatLogger::GetHostStateString(const Host::Ptr& host)
+{
+ if (host->GetState() != HostUp && !host->IsReachable())
+ return "UNREACHABLE"; /* hardcoded compat state */
+
+ return Host::StateToString(host->GetState());
+}
+
void CompatLogger::WriteLine(const String& line)
{
ASSERT(OwnsLock());
std::ostringstream msgbuf;
msgbuf << "CURRENT HOST STATE: "
<< host->GetName() << ";"
- << CompatUtility::GetHostStateString(host) << ";"
+ << GetHostStateString(host) << ";"
<< Host::StateTypeToString(host->GetStateType()) << ";"
<< host->GetCheckAttempt() << ";"
<< output << "";
void ExternalCommandHandler(const String& command, const std::vector<String>& arguments);
void EventCommandHandler(const Checkable::Ptr& service);
+ static String GetHostStateString(const Host::Ptr& host);
+
Timer::Ptr m_RotationTimer;
void RotationTimerHandler();
void ScheduleNextRotation();
} else {
msgbuf << "HOST ALERT: "
<< host->GetName() << ";"
- << CompatUtility::GetHostStateString(host) << ";"
+ << GetHostStateString(host) << ";"
<< Host::StateTypeToString(host->GetStateType()) << ";"
<< attempt_after << ";"
<< output << ""
return currentState;
}
+String DbEvents::GetHostStateString(const Host::Ptr& host)
+{
+ if (host->GetState() != HostUp && !host->IsReachable())
+ return "UNREACHABLE"; /* hardcoded compat state */
+
+ return Host::StateToString(host->GetState());
+}
+
std::pair<unsigned long, unsigned long> DbEvents::ConvertTimestamp(double time)
{
unsigned long time_sec = static_cast<long>(time);
static void EnableChangedHandlerInternal(const Checkable::Ptr& checkable, const String& fieldName, bool enabled);
static int GetHostState(const Host::Ptr& host);
+ static String GetHostStateString(const Host::Ptr& host);
static std::pair<unsigned long, unsigned long> ConvertTimestamp(double time);
static int MapNotificationReasonType(NotificationType type);
static int MapExternalCommandType(const String& name);
return GetCommandNamePrefix(command) + command->GetName();
}
-/* Used in StatusDataWriter and DB IDO. */
-String CompatUtility::GetHostStateString(const Host::Ptr& host)
-{
- if (host->GetState() != HostUp && !host->IsReachable())
- return "UNREACHABLE"; /* hardcoded compat state */
-
- return Host::StateToString(host->GetState());
-}
-
/* Used in DB IDO, StatusDataWriter and Livestatus. */
String CompatUtility::GetCheckableCommandArgs(const Checkable::Ptr& checkable)
{
static String GetCommandLine(const Command::Ptr& command);
static String GetCommandName(const Command::Ptr& command);
- /* host */
- static String GetHostStateString(const Host::Ptr& host);
-
/* service */
static String GetCheckableCommandArgs(const Checkable::Ptr& checkable);