本文整理汇总了C++中downtime::Ptr::GetCheckable方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::GetCheckable方法的具体用法?C++ Ptr::GetCheckable怎么用?C++ Ptr::GetCheckable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类downtime::Ptr
的用法示例。
在下文中一共展示了Ptr::GetCheckable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TriggerDowntimeHandler
/**
* @threadsafety Always.
*/
void CompatLogger::TriggerDowntimeHandler(const Downtime::Ptr& downtime)
{
Host::Ptr host;
Service::Ptr service;
tie(host, service) = GetHostService(downtime->GetCheckable());
if (!downtime)
return;
std::ostringstream msgbuf;
if (service) {
msgbuf << "SERVICE DOWNTIME ALERT: "
<< host->GetName() << ";"
<< service->GetShortName() << ";"
<< "STARTED" << "; "
<< "Checkable has entered a period of scheduled downtime."
<< "";
} else {
msgbuf << "HOST DOWNTIME ALERT: "
<< host->GetName() << ";"
<< "STARTED" << "; "
<< "Checkable has entered a period of scheduled downtime."
<< "";
}
{
ObjectLock oLock(this);
WriteLine(msgbuf.str());
Flush();
}
}
示例2: NotifyDowntimeInternal
void Checkable::NotifyDowntimeInternal(const Downtime::Ptr& downtime)
{
Checkable::Ptr checkable = downtime->GetCheckable();
if (!checkable->IsPaused())
OnNotificationsRequested(checkable, NotificationDowntimeStart, checkable->GetLastCheckResult(), downtime->GetAuthor(), downtime->GetComment(), nullptr);
}
示例3: IsServiceAccessor
Value DowntimesTable::IsServiceAccessor(const Value& row)
{
Downtime::Ptr downtime = static_cast<Downtime::Ptr>(row);
Checkable::Ptr checkable = downtime->GetCheckable();
return (dynamic_pointer_cast<Host>(checkable) ? 0 : 1);
}
示例4: RemoveDowntime
void Downtime::RemoveDowntime(const String& id, bool cancelled, bool expired, const MessageOrigin::Ptr& origin)
{
Downtime::Ptr downtime = Downtime::GetByName(id);
if (!downtime)
return;
String config_owner = downtime->GetConfigOwner();
if (!config_owner.IsEmpty() && !expired) {
Log(LogWarning, "Downtime")
<< "Cannot remove downtime '" << downtime->GetName() << "'. It is owned by scheduled downtime object '" << config_owner << "'";
return;
}
downtime->SetWasCancelled(cancelled);
Log(LogNotice, "Downtime")
<< "Removed downtime '" << downtime->GetName() << "' from object '" << downtime->GetCheckable()->GetName() << "'.";
if (downtime->GetPackage() != "_api")
return;
Array::Ptr errors = new Array();
if (!ConfigObjectUtility::DeleteObject(downtime, false, errors)) {
ObjectLock olock(errors);
for (const String& error : errors) {
Log(LogCritical, "Downtime", error);
}
BOOST_THROW_EXCEPTION(std::runtime_error("Could not remove downtime."));
}
}
示例5: NotifyDowntimeEnd
void Checkable::NotifyDowntimeEnd(const Downtime::Ptr& downtime)
{
/* don't send notifications for flexible downtimes which never triggered */
if (!downtime->GetFixed() && !downtime->IsTriggered())
return;
Checkable::Ptr checkable = downtime->GetCheckable();
if (!checkable->IsPaused())
OnNotificationsRequested(checkable, NotificationDowntimeEnd, checkable->GetLastCheckResult(), downtime->GetAuthor(), downtime->GetComment(), nullptr);
}
示例6: ServiceAccessor
Object::Ptr DowntimesTable::ServiceAccessor(const Value& row, const Column::ObjectAccessor&)
{
Downtime::Ptr downtime = static_cast<Downtime::Ptr>(row);
Checkable::Ptr checkable = downtime->GetCheckable();
Host::Ptr host;
Service::Ptr service;
tie(host, service) = GetHostService(checkable);
return service;
}
示例7: RemoveDowntimeHandler
/**
* @threadsafety Always.
*/
void CompatLogger::RemoveDowntimeHandler(const Downtime::Ptr& downtime)
{
Host::Ptr host;
Service::Ptr service;
tie(host, service) = GetHostService(downtime->GetCheckable());
if (!downtime)
return;
String downtime_output;
String downtime_state_str;
if (downtime->GetWasCancelled()) {
downtime_output = "Scheduled downtime for service has been cancelled.";
downtime_state_str = "CANCELLED";
} else {
downtime_output = "Checkable has exited from a period of scheduled downtime.";
downtime_state_str = "STOPPED";
}
std::ostringstream msgbuf;
if (service) {
msgbuf << "SERVICE DOWNTIME ALERT: "
<< host->GetName() << ";"
<< service->GetShortName() << ";"
<< downtime_state_str << "; "
<< downtime_output
<< "";
} else {
msgbuf << "HOST DOWNTIME ALERT: "
<< host->GetName() << ";"
<< downtime_state_str << "; "
<< downtime_output
<< "";
}
{
ObjectLock oLock(this);
WriteLine(msgbuf.str());
Flush();
}
}