| 149 | } |
| 150 | |
| 151 | void 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 | |
| 187 | void DbEvents::LastNotificationChangedHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable) |
| 188 | { |
nothing calls this directly
no test coverage detected