1 /******************************************************************************
3 * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License *
7 * as published by the Free Software Foundation; either version 2 *
8 * of the License, or (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software Foundation *
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ******************************************************************************/
20 #ifndef NOTIFICATION_H
21 #define NOTIFICATION_H
27 * The notification type.
33 NotificationDowntimeStart,
34 NotificationDowntimeEnd,
35 NotificationDowntimeRemoved,
37 NotificationAcknowledgement,
45 * An Icinga notification specification.
49 class I2_ICINGA_API Notification : public DynamicObject
52 typedef shared_ptr<Notification> Ptr;
53 typedef weak_ptr<Notification> WeakPtr;
55 Notification(const Dictionary::Ptr& properties);
58 static Notification::Ptr GetByName(const String& name);
60 shared_ptr<Service> GetService(void) const;
61 Value GetNotificationCommand(void) const;
62 Dictionary::Ptr GetMacros(void) const;
63 set<User::Ptr> GetUsers(void) const;
64 set<UserGroup::Ptr> GetGroups(void) const;
66 void BeginExecuteNotification(NotificationType type, const Dictionary::Ptr& cr);
68 static String NotificationTypeToString(NotificationType type);
71 void OnAttributeChanged(const String& name);
74 Attribute<Value> m_NotificationCommand;
75 Attribute<Dictionary::Ptr> m_Macros;
76 Attribute<Dictionary::Ptr> m_Users;
77 Attribute<Dictionary::Ptr> m_Groups;
78 Attribute<String> m_HostName;
79 Attribute<String> m_Service;
81 set<ScriptTask::Ptr> m_Tasks;
83 void NotificationCompletedHandler(const ScriptTask::Ptr& task);
85 void BeginExecuteNotificationHelper(const Dictionary::Ptr& notificationMacros,
86 NotificationType type, const User::Ptr& user);
91 #endif /* NOTIFICATION_H */