| 69 | } |
| 70 | |
| 71 | Dictionary::Ptr ClusterEvents::MakeCheckResultMessage(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr) |
| 72 | { |
| 73 | Dictionary::Ptr message = new Dictionary(); |
| 74 | message->Set("jsonrpc", "2.0"); |
| 75 | message->Set("method", "event::CheckResult"); |
| 76 | |
| 77 | Host::Ptr host; |
| 78 | Service::Ptr service; |
| 79 | tie(host, service) = GetHostService(checkable); |
| 80 | |
| 81 | Dictionary::Ptr params = new Dictionary(); |
| 82 | params->Set("host", host->GetName()); |
| 83 | if (service) |
| 84 | params->Set("service", service->GetShortName()); |
| 85 | else { |
| 86 | Value agent_service_name = checkable->GetExtension("agent_service_name"); |
| 87 | |
| 88 | if (!agent_service_name.IsEmpty()) |
| 89 | params->Set("service", agent_service_name); |
| 90 | } |
| 91 | params->Set("cr", Serialize(cr)); |
| 92 | |
| 93 | message->Set("params", params); |
| 94 | |
| 95 | return message; |
| 96 | } |
| 97 | |
| 98 | void ClusterEvents::CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const MessageOrigin::Ptr& origin) |
| 99 | { |
nothing calls this directly
no test coverage detected