| 277 | } |
| 278 | |
| 279 | Value ClusterEvents::LastCheckStartedChangedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params) |
| 280 | { |
| 281 | Endpoint::Ptr endpoint = origin->FromClient->GetEndpoint(); |
| 282 | |
| 283 | if (!endpoint) { |
| 284 | Log(LogNotice, "ClusterEvents") |
| 285 | << "Discarding 'last_check_started changed' message from '" << origin->FromClient->GetIdentity() << "': Invalid endpoint origin (client not allowed)."; |
| 286 | return Empty; |
| 287 | } |
| 288 | |
| 289 | Host::Ptr host = Host::GetByName(params->Get("host")); |
| 290 | |
| 291 | if (!host) |
| 292 | return Empty; |
| 293 | |
| 294 | Checkable::Ptr checkable; |
| 295 | |
| 296 | if (params->Contains("service")) |
| 297 | checkable = host->GetServiceByShortName(params->Get("service")); |
| 298 | else |
| 299 | checkable = host; |
| 300 | |
| 301 | if (!checkable) |
| 302 | return Empty; |
| 303 | |
| 304 | if (origin->FromZone && !origin->FromZone->CanAccessObject(checkable)) { |
| 305 | Log(LogNotice, "ClusterEvents") |
| 306 | << "Discarding 'last_check_started changed' message for checkable '" << checkable->GetName() |
| 307 | << "' from '" << origin->FromClient->GetIdentity() << "': Unauthorized access."; |
| 308 | return Empty; |
| 309 | } |
| 310 | |
| 311 | checkable->SetLastCheckStarted(params->Get("last_check_started"), false, origin); |
| 312 | |
| 313 | return Empty; |
| 314 | } |
| 315 | |
| 316 | void ClusterEvents::StateBeforeSuppressionChangedHandler(const Checkable::Ptr& checkable, const MessageOrigin::Ptr& origin) |
| 317 | { |
nothing calls this directly
no test coverage detected