| 1168 | } |
| 1169 | |
| 1170 | void DbEvents::AddFlappingChangedLogHistory(const Checkable::Ptr& checkable) |
| 1171 | { |
| 1172 | String flappingStateStr; |
| 1173 | String flappingOutput; |
| 1174 | |
| 1175 | if (checkable->IsFlapping()) { |
| 1176 | flappingOutput = "Service appears to have started flapping (" + Convert::ToString(checkable->GetFlappingCurrent()) + "% change >= " + Convert::ToString(checkable->GetFlappingThresholdHigh()) + "% threshold)"; |
| 1177 | flappingStateStr = "STARTED"; |
| 1178 | } else { |
| 1179 | flappingOutput = "Service appears to have stopped flapping (" + Convert::ToString(checkable->GetFlappingCurrent()) + "% change < " + Convert::ToString(checkable->GetFlappingThresholdLow()) + "% threshold)"; |
| 1180 | flappingStateStr = "STOPPED"; |
| 1181 | } |
| 1182 | |
| 1183 | Host::Ptr host; |
| 1184 | Service::Ptr service; |
| 1185 | tie(host, service) = GetHostService(checkable); |
| 1186 | |
| 1187 | std::ostringstream msgbuf; |
| 1188 | |
| 1189 | if (service) { |
| 1190 | msgbuf << "SERVICE FLAPPING ALERT: " |
| 1191 | << host->GetName() << ";" |
| 1192 | << service->GetShortName() << ";" |
| 1193 | << flappingStateStr << "; " |
| 1194 | << flappingOutput |
| 1195 | << ""; |
| 1196 | } else { |
| 1197 | msgbuf << "HOST FLAPPING ALERT: " |
| 1198 | << host->GetName() << ";" |
| 1199 | << flappingStateStr << "; " |
| 1200 | << flappingOutput |
| 1201 | << ""; |
| 1202 | } |
| 1203 | |
| 1204 | AddLogHistory(checkable, msgbuf.str(), LogEntryTypeInfoMessage); |
| 1205 | } |
| 1206 | |
| 1207 | void DbEvents::AddEnableFlappingChangedLogHistory(const Checkable::Ptr& checkable) |
| 1208 | { |
nothing calls this directly
no test coverage detected