当前位置: 首页>>代码示例>>C++>>正文


C++ Ptr::GetActive方法代码示例

本文整理汇总了C++中checkresult::Ptr::GetActive方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::GetActive方法的具体用法?C++ Ptr::GetActive怎么用?C++ Ptr::GetActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在checkresult::Ptr的用法示例。


在下文中一共展示了Ptr::GetActive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UpdateStatistics

void Checkable::UpdateStatistics(const CheckResult::Ptr& cr, CheckableType type)
{
    time_t ts = cr->GetScheduleEnd();

    if (type == CheckableHost) {
        if (cr->GetActive())
            CIB::UpdateActiveHostChecksStatistics(ts, 1);
        else
            CIB::UpdatePassiveHostChecksStatistics(ts, 1);
    } else if (type == CheckableService) {
        if (cr->GetActive())
            CIB::UpdateActiveServiceChecksStatistics(ts, 1);
        else
            CIB::UpdatePassiveServiceChecksStatistics(ts, 1);
    } else {
        Log(LogWarning, "Checkable", "Unknown checkable type for statistic update.");
    }
}
开发者ID:haus,项目名称:icinga2,代码行数:18,代码来源:checkable-check.cpp

示例2: ProcessCheckResult


//.........这里部分代码省略.........
		send_notification = false; /* Don't send notifications for volatile OK -> OK changes. */

	bool send_downtime_notification = (GetLastInDowntime() != in_downtime);
	SetLastInDowntime(in_downtime);

	olock.Unlock();

	if (remove_acknowledgement_comments)
		RemoveCommentsByType(CommentAcknowledgement);

	Dictionary::Ptr vars_after = new Dictionary();
	vars_after->Set("state", new_state);
	vars_after->Set("state_type", GetStateType());
	vars_after->Set("attempt", GetCheckAttempt());
	vars_after->Set("reachable", reachable);

	if (old_cr)
		cr->SetVarsBefore(old_cr->GetVarsAfter());

	cr->SetVarsAfter(vars_after);

	olock.Lock();
	SetLastCheckResult(cr);

	bool was_flapping, is_flapping;

	was_flapping = IsFlapping();

	if (GetStateType() == StateTypeHard)
		UpdateFlappingStatus(stateChange);

	is_flapping = IsFlapping();

	if (cr->GetActive()) {
		UpdateNextCheck(origin);
	} else {
		/* Reschedule the next check for passive check results. The side effect of
		 * this is that for as long as we receive passive results for a service we
		 * won't execute any active checks. */
		SetNextCheck(Utility::GetTime() + GetCheckInterval(), false, origin);
	}

	olock.Unlock();

//	Log(LogDebug, "Checkable")
//	    << "Flapping: Checkable " << GetName()
//	    << " was: " << (was_flapping)
//	    << " is: " << is_flapping)
//	    << " threshold: " << GetFlappingThreshold()
//	    << "% current: " + GetFlappingCurrent()) << "%.";

	OnNewCheckResult(this, cr, origin);

	/* signal status updates to for example db_ido */
	OnStateChanged(this);

	String old_state_str = (service ? Service::StateToString(old_state) : Host::StateToString(Host::CalculateState(old_state)));
	String new_state_str = (service ? Service::StateToString(new_state) : Host::StateToString(Host::CalculateState(new_state)));

	/* Whether a hard state change or a volatile state change except OK -> OK happened. */
	if (hardChange || (is_volatile && !(IsStateOK(old_state) && IsStateOK(new_state)))) {
		OnStateChange(this, cr, StateTypeHard, origin);
		Log(LogNotice, "Checkable")
		    << "State Change: Checkable " << GetName() << " hard state change from " << old_state_str << " to " << new_state_str << " detected." << (is_volatile ? " Checkable is volatile." : "");
	}
	/* Whether a state change happened or the state type is SOFT (must be logged too). */
开发者ID:bardahlm,项目名称:icinga2,代码行数:67,代码来源:checkable-check.cpp


注:本文中的checkresult::Ptr::GetActive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。