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

Method AcknowledgementSetHandler

lib/icinga/clusterevents.cpp:770–801  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

768}
769
770void ClusterEvents::AcknowledgementSetHandler(const Checkable::Ptr& checkable,
771 const String& author, const String& comment, AcknowledgementType type,
772 bool notify, bool persistent, double changeTime, double expiry, const MessageOrigin::Ptr& origin)
773{
774 ApiListener::Ptr listener = ApiListener::GetInstance();
775
776 if (!listener)
777 return;
778
779 Host::Ptr host;
780 Service::Ptr service;
781 tie(host, service) = GetHostService(checkable);
782
783 Dictionary::Ptr params = new Dictionary();
784 params->Set("host", host->GetName());
785 if (service)
786 params->Set("service", service->GetShortName());
787 params->Set("author", author);
788 params->Set("comment", comment);
789 params->Set("acktype", type);
790 params->Set("notify", notify);
791 params->Set("persistent", persistent);
792 params->Set("expiry", expiry);
793 params->Set("change_time", changeTime);
794
795 Dictionary::Ptr message = new Dictionary();
796 message->Set("jsonrpc", "2.0");
797 message->Set("method", "event::SetAcknowledgement");
798 message->Set("params", params);
799
800 listener->RelayMessage(origin, checkable, message, true);
801}
802
803Value ClusterEvents::AcknowledgementSetAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params)
804{

Callers

nothing calls this directly

Calls 3

RelayMessageMethod · 0.80
SetMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected