MCPcopy Create free account
hub / github.com/Icinga/icinga2 / MakeCheckResultMessage

Method MakeCheckResultMessage

lib/icinga/clusterevents.cpp:71–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71Dictionary::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
98void ClusterEvents::CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const MessageOrigin::Ptr& origin)
99{

Callers

nothing calls this directly

Calls 4

GetExtensionMethod · 0.80
SetMethod · 0.45
GetNameMethod · 0.45
IsEmptyMethod · 0.45

Tested by

no test coverage detected