MCPcopy Create free account
hub / github.com/Icinga/icinga2 / OnAllConfigLoaded

Method OnAllConfigLoaded

lib/icinga/checkable.cpp:77–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77void Checkable::OnAllConfigLoaded()
78{
79 ObjectImpl<Checkable>::OnAllConfigLoaded();
80
81 const auto it = boost::range::find(l_DeprecatedCheckCommands, GetCheckCommandRaw());
82 if (it != l_DeprecatedCheckCommands.end()) {
83 static std::mutex warnedSetMutex;
84 static std::unordered_set<std::string_view> alreadyWarned;
85
86 std::unique_lock lock{warnedSetMutex};
87 auto [_, inserted] = alreadyWarned.emplace(*it);
88 lock.unlock();
89 if (inserted) {
90 Log(LogWarning, "Checkable")
91 << "CheckCommand '" << GetCheckCommandRaw() << "' used by '" << GetName() << "' (" << GetDebugInfo()
92 << ") is DEPRECATED and will be removed in v2.18. Further uses of this check command won't be logged.";
93 }
94 }
95
96 Endpoint::Ptr endpoint = GetCommandEndpoint();
97
98 if (endpoint) {
99 Zone::Ptr checkableZone = static_pointer_cast<Zone>(GetZone());
100
101 if (checkableZone) {
102 Zone::Ptr cmdZone = endpoint->GetZone();
103
104 if (cmdZone != checkableZone && cmdZone->GetParent() != checkableZone) {
105 BOOST_THROW_EXCEPTION(ValidationError(this, { "command_endpoint" },
106 "Command endpoint must be in zone '" + checkableZone->GetName() + "' or in a direct child zone thereof."));
107 }
108 } else {
109 BOOST_THROW_EXCEPTION(ValidationError(this, { "command_endpoint" },
110 "Checkable with command endpoint requires a zone. Please check the troubleshooting documentation."));
111 }
112 }
113}
114
115void Checkable::Start(bool runtimeCreated)
116{

Callers

nothing calls this directly

Calls 8

findFunction · 0.85
LogClass · 0.85
ValidationErrorClass · 0.85
emplaceMethod · 0.80
endMethod · 0.45
GetZoneMethod · 0.45
GetParentMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected