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

Method GetServiceByShortName

lib/icinga/host.cpp:118–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118Service::Ptr Host::GetServiceByShortName(const Value& name)
119{
120 if (name.IsScalar()) {
121 {
122 std::unique_lock<std::mutex> lock(m_ServicesMutex);
123
124 auto it = m_Services.find(name);
125
126 if (it != m_Services.end())
127 return it->second;
128 }
129
130 return nullptr;
131 } else if (name.IsObjectType<Dictionary>()) {
132 Dictionary::Ptr dict = name;
133 String short_name;
134
135 return Service::GetByNamePair(dict->Get("host"), dict->Get("service"));
136 } else {
137 BOOST_THROW_EXCEPTION(std::invalid_argument("Host/Service name pair is invalid: " + JsonEncode(name)));
138 }
139}
140
141HostState Host::CalculateState(ServiceState state)
142{

Calls 4

IsScalarMethod · 0.80
findMethod · 0.80
endMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected