]> granicus.if.org Git - icinga2/commitdiff
API Event Streams: Add 'command' for Notification events 6829/head
authorMichael Friedrich <michael.friedrich@icinga.com>
Fri, 7 Dec 2018 08:37:03 +0000 (09:37 +0100)
committerMichael Friedrich <michael.friedrich@icinga.com>
Fri, 7 Dec 2018 08:37:03 +0000 (09:37 +0100)
fixes #6824

doc/12-icinga2-api.md
lib/icinga/apievents.cpp

index 8709438d16dece96718cc44ea88832c5909dc9b1..2b982c9aa4ff1266ecdaf6d0baef75f44bf10803 100644 (file)
@@ -1333,6 +1333,7 @@ Example for all downtime events:
   timestamp     | Timestamp     | Unix timestamp when the event happened.
   host         | String        | [Host](09-object-types.md#objecttype-host) name.
   service       | String        | [Service](09-object-types.md#objecttype-service) name. Optional if this is a host notification.
+  command       | String        | [NotificationCommand](09-object-types.md#objecttype-notificationcommand) name.
   users         | Array         | List of notified [user](09-object-types.md#objecttype-user) names.
   notification\_type | String   | [$notification.type$](03-monitoring-basics.md#notification-runtime-macros) runtime macro value.
   author        | String        | [$notification.author$](03-monitoring-basics.md#notification-runtime-macros) runtime macro value.
index 3097280ad08cbe1fbeb6d21e7ba324d544e10968..55c8a541b3becae5c17e2da7ce1c1a2d2c2196fc 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "icinga/apievents.hpp"
 #include "icinga/service.hpp"
+#include "icinga/notificationcommand.hpp"
 #include "remote/eventqueue.hpp"
 #include "base/initialize.hpp"
 #include "base/serializer.hpp"
@@ -129,6 +130,11 @@ void ApiEvents::NotificationSentToAllUsersHandler(const Notification::Ptr& notif
        if (service)
                result->Set("service", service->GetShortName());
 
+       NotificationCommand::Ptr command = notification->GetCommand();
+
+       if (command)
+               result->Set("command", command->GetName());
+
        ArrayData userNames;
 
        for (const User::Ptr& user : users) {