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

Method FlappingChangedHandler

lib/db_ido/dbevents.cpp:151–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151void DbEvents::FlappingChangedHandler(const Checkable::Ptr& checkable)
152{
153 Host::Ptr host;
154 Service::Ptr service;
155 tie(host, service) = GetHostService(checkable);
156
157 DbQuery query1;
158 query1.WhereCriteria = new Dictionary();
159
160 if (service) {
161 query1.Table = "servicestatus";
162 query1.WhereCriteria->Set("service_object_id", service);
163 } else {
164 query1.Table = "hoststatus";
165 query1.WhereCriteria->Set("host_object_id", host);
166 }
167
168 query1.Type = DbQueryUpdate;
169 query1.Category = DbCatState;
170 query1.StatusUpdate = true;
171 query1.Object = DbObject::GetOrCreateByObject(checkable);
172
173 Dictionary::Ptr fields1 = new Dictionary();
174 fields1->Set("is_flapping", checkable->IsFlapping());
175 fields1->Set("percent_state_change", checkable->GetFlappingCurrent());
176
177 query1.Fields = new Dictionary({
178 { "is_flapping", checkable->IsFlapping() },
179 { "percent_state_change", checkable->GetFlappingCurrent() }
180 });
181
182 query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
183
184 DbObject::OnQuery(query1);
185}
186
187void DbEvents::LastNotificationChangedHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable)
188{

Callers

nothing calls this directly

Calls 2

IsFlappingMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected