| 1309 | } |
| 1310 | |
| 1311 | void DbEvents::AddEnableFlappingChangedHistory(const Checkable::Ptr& checkable) |
| 1312 | { |
| 1313 | if (!checkable->GetEnableFlapping()) |
| 1314 | return; |
| 1315 | |
| 1316 | std::pair<unsigned long, unsigned long> timeBag = ConvertTimestamp(Utility::GetTime()); |
| 1317 | |
| 1318 | DbQuery query1; |
| 1319 | query1.Table = "flappinghistory"; |
| 1320 | query1.Type = DbQueryInsert; |
| 1321 | query1.Category = DbCatFlapping; |
| 1322 | |
| 1323 | Dictionary::Ptr fields1 = new Dictionary(); |
| 1324 | |
| 1325 | fields1->Set("event_time", DbValue::FromTimestamp(timeBag.first)); |
| 1326 | fields1->Set("event_time_usec", timeBag.second); |
| 1327 | |
| 1328 | fields1->Set("event_type", 1001); |
| 1329 | fields1->Set("reason_type", 2); |
| 1330 | |
| 1331 | Host::Ptr host; |
| 1332 | Service::Ptr service; |
| 1333 | tie(host, service) = GetHostService(checkable); |
| 1334 | |
| 1335 | fields1->Set("flapping_type", service ? 1 : 0); |
| 1336 | fields1->Set("object_id", checkable); |
| 1337 | fields1->Set("percent_state_change", checkable->GetFlappingCurrent()); |
| 1338 | fields1->Set("low_threshold", checkable->GetFlappingThresholdLow()); |
| 1339 | fields1->Set("high_threshold", checkable->GetFlappingThresholdHigh()); |
| 1340 | fields1->Set("instance_id", 0); /* DbConnection class fills in real ID */ |
| 1341 | |
| 1342 | Endpoint::Ptr endpoint = Endpoint::GetByName(IcingaApplication::GetInstance()->GetNodeName()); |
| 1343 | |
| 1344 | if (endpoint) |
| 1345 | fields1->Set("endpoint_object_id", endpoint); |
| 1346 | |
| 1347 | query1.Fields = fields1; |
| 1348 | DbObject::OnQuery(query1); |
| 1349 | } |
| 1350 | |
| 1351 | /* servicechecks */ |
| 1352 | void DbEvents::AddCheckableCheckHistory(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr) |
nothing calls this directly
no test coverage detected