Skip to content

Commit

Permalink
Merge pull request #6829 from Icinga/feature/api-events-notification-…
Browse files Browse the repository at this point in the history
…command

API Event Streams: Add 'command' for Notification events
  • Loading branch information
Michael Friedrich committed Dec 17, 2018
2 parents 75e06e9 + ba8d79f commit eab49d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/12-icinga2-api.md
Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions lib/icinga/apievents.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit eab49d3

Please sign in to comment.