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

Method FetchRows

lib/livestatus/servicestable.cpp:156–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154}
155
156void ServicesTable::FetchRows(const AddRowFunction& addRowFn)
157{
158 if (GetGroupByType() == LivestatusGroupByServiceGroup) {
159 for (const ServiceGroup::Ptr& sg : ConfigType::GetObjectsByType<ServiceGroup>()) {
160 for (const Service::Ptr& service : sg->GetMembers()) {
161 /* the caller must know which groupby type and value are set for this row */
162 if (!addRowFn(service, LivestatusGroupByServiceGroup, sg))
163 return;
164 }
165 }
166 } else if (GetGroupByType() == LivestatusGroupByHostGroup) {
167 for (const HostGroup::Ptr& hg : ConfigType::GetObjectsByType<HostGroup>()) {
168 ObjectLock ylock(hg);
169 for (const Host::Ptr& host : hg->GetMembers()) {
170 ObjectLock ylock(host);
171 for (const Service::Ptr& service : host->GetServices()) {
172 /* the caller must know which groupby type and value are set for this row */
173 if (!addRowFn(service, LivestatusGroupByHostGroup, hg))
174 return;
175 }
176 }
177 }
178 } else {
179 for (const Service::Ptr& service : ConfigType::GetObjectsByType<Service>()) {
180 if (!addRowFn(service, LivestatusGroupByNone, Empty))
181 return;
182 }
183 }
184}
185
186Object::Ptr ServicesTable::HostAccessor(const Value& row, const Column::ObjectAccessor& parentObjectAccessor)
187{

Callers

nothing calls this directly

Calls 2

GetMembersMethod · 0.45
GetServicesMethod · 0.45

Tested by

no test coverage detected