2013-02-09 11:42:22 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* Icinga 2 *
|
|
|
|
* Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License *
|
|
|
|
* as published by the Free Software Foundation; either version 2 *
|
|
|
|
* of the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the Free Software Foundation *
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
|
|
|
******************************************************************************/
|
|
|
|
|
2013-03-17 20:19:29 +01:00
|
|
|
#include "icinga/notification.h"
|
2013-06-13 11:33:00 +02:00
|
|
|
#include "icinga/notificationcommand.h"
|
2013-03-17 20:19:29 +01:00
|
|
|
#include "icinga/macroprocessor.h"
|
|
|
|
#include "icinga/service.h"
|
2013-03-16 21:18:53 +01:00
|
|
|
#include "base/dynamictype.h"
|
|
|
|
#include "base/objectlock.h"
|
|
|
|
#include "base/logger_fwd.h"
|
2013-03-25 18:36:15 +01:00
|
|
|
#include "base/utility.h"
|
2013-06-26 09:08:50 +02:00
|
|
|
#include "base/convert.h"
|
2013-03-15 18:21:29 +01:00
|
|
|
#include <boost/tuple/tuple.hpp>
|
2013-03-16 21:18:53 +01:00
|
|
|
#include <boost/foreach.hpp>
|
|
|
|
#include <boost/exception/diagnostic_information.hpp>
|
2013-02-09 11:42:22 +01:00
|
|
|
|
|
|
|
using namespace icinga;
|
|
|
|
|
2013-03-01 12:07:52 +01:00
|
|
|
REGISTER_TYPE(Notification);
|
2013-02-09 11:42:22 +01:00
|
|
|
|
2013-08-28 14:59:41 +02:00
|
|
|
boost::signals2::signal<void (const Notification::Ptr&, double, const String&)> Notification::OnNextNotificationChanged;
|
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
void Notification::Start(void)
|
2013-02-09 15:20:10 +01:00
|
|
|
{
|
2013-08-20 11:06:04 +02:00
|
|
|
DynamicObject::Start();
|
2013-02-09 11:42:22 +01:00
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
GetService()->AddNotification(GetSelf());
|
2013-02-09 11:42:22 +01:00
|
|
|
}
|
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
void Notification::Stop(void)
|
2013-02-09 11:42:22 +01:00
|
|
|
{
|
2013-08-20 11:06:04 +02:00
|
|
|
DynamicObject::Stop();
|
2013-02-09 11:42:22 +01:00
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
GetService()->RemoveNotification(GetSelf());
|
2013-02-09 11:42:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Service::Ptr Notification::GetService(void) const
|
|
|
|
{
|
2013-02-26 10:13:54 +01:00
|
|
|
Host::Ptr host = Host::GetByName(m_HostName);
|
2013-02-09 11:42:22 +01:00
|
|
|
|
2013-02-27 15:23:25 +01:00
|
|
|
if (!host)
|
|
|
|
return Service::Ptr();
|
|
|
|
|
2013-02-26 10:13:54 +01:00
|
|
|
if (m_Service.IsEmpty())
|
2013-03-02 09:07:47 +01:00
|
|
|
return host->GetHostCheckService();
|
2013-02-09 11:42:22 +01:00
|
|
|
else
|
2013-03-02 09:07:47 +01:00
|
|
|
return host->GetServiceByShortName(m_Service);
|
2013-02-09 11:42:22 +01:00
|
|
|
}
|
|
|
|
|
2013-06-13 11:33:00 +02:00
|
|
|
NotificationCommand::Ptr Notification::GetNotificationCommand(void) const
|
2013-02-09 11:42:22 +01:00
|
|
|
{
|
2013-06-13 11:33:00 +02:00
|
|
|
return NotificationCommand::GetByName(m_NotificationCommand);
|
2013-02-09 11:42:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Dictionary::Ptr Notification::GetMacros(void) const
|
|
|
|
{
|
2013-02-26 10:13:54 +01:00
|
|
|
return m_Macros;
|
2013-02-09 11:42:22 +01:00
|
|
|
}
|
|
|
|
|
2013-03-22 14:40:55 +01:00
|
|
|
Array::Ptr Notification::GetExportMacros(void) const
|
|
|
|
{
|
|
|
|
return m_ExportMacros;
|
|
|
|
}
|
|
|
|
|
2013-03-16 21:18:53 +01:00
|
|
|
std::set<User::Ptr> Notification::GetUsers(void) const
|
2013-02-24 08:26:10 +01:00
|
|
|
{
|
2013-03-16 21:18:53 +01:00
|
|
|
std::set<User::Ptr> result;
|
2013-02-24 08:26:10 +01:00
|
|
|
|
2013-03-15 18:21:29 +01:00
|
|
|
Array::Ptr users = m_Users;
|
2013-02-24 08:26:10 +01:00
|
|
|
|
|
|
|
if (users) {
|
2013-03-01 12:07:52 +01:00
|
|
|
ObjectLock olock(users);
|
|
|
|
|
2013-03-15 18:21:29 +01:00
|
|
|
BOOST_FOREACH(const String& name, users) {
|
2013-02-27 21:49:03 +01:00
|
|
|
User::Ptr user = User::GetByName(name);
|
|
|
|
|
|
|
|
if (!user)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
result.insert(user);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2013-03-16 21:18:53 +01:00
|
|
|
std::set<UserGroup::Ptr> Notification::GetGroups(void) const
|
2013-02-27 21:49:03 +01:00
|
|
|
{
|
2013-03-16 21:18:53 +01:00
|
|
|
std::set<UserGroup::Ptr> result;
|
2013-02-27 21:49:03 +01:00
|
|
|
|
2013-03-15 18:21:29 +01:00
|
|
|
Array::Ptr groups = m_Groups;
|
2013-02-27 21:49:03 +01:00
|
|
|
|
|
|
|
if (groups) {
|
2013-03-01 12:07:52 +01:00
|
|
|
ObjectLock olock(groups);
|
|
|
|
|
2013-03-15 18:21:29 +01:00
|
|
|
BOOST_FOREACH(const String& name, groups) {
|
2013-02-27 21:49:03 +01:00
|
|
|
UserGroup::Ptr ug = UserGroup::GetByName(name);
|
|
|
|
|
|
|
|
if (!ug)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
result.insert(ug);
|
2013-02-24 08:26:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2013-05-13 13:44:57 +02:00
|
|
|
Dictionary::Ptr Notification::GetTimes(void) const
|
|
|
|
{
|
|
|
|
return m_Times;
|
|
|
|
}
|
|
|
|
|
2013-06-26 09:50:04 +02:00
|
|
|
unsigned long Notification::GetNotificationTypeFilter(void) const
|
2013-06-26 09:08:50 +02:00
|
|
|
{
|
2013-06-26 09:50:04 +02:00
|
|
|
if (m_NotificationTypeFilter.IsEmpty())
|
2013-06-26 09:08:50 +02:00
|
|
|
return ~(unsigned long)0; /* All states. */
|
|
|
|
else
|
2013-06-26 09:50:04 +02:00
|
|
|
return m_NotificationTypeFilter;
|
2013-06-26 09:08:50 +02:00
|
|
|
}
|
|
|
|
|
2013-06-26 09:50:04 +02:00
|
|
|
unsigned long Notification::GetNotificationStateFilter(void) const
|
2013-06-26 09:08:50 +02:00
|
|
|
{
|
2013-06-26 09:50:04 +02:00
|
|
|
if (m_NotificationStateFilter.IsEmpty())
|
2013-06-26 09:08:50 +02:00
|
|
|
return ~(unsigned long)0; /* All states. */
|
|
|
|
else
|
2013-06-26 09:50:04 +02:00
|
|
|
return m_NotificationStateFilter;
|
2013-06-26 09:08:50 +02:00
|
|
|
}
|
|
|
|
|
2013-03-20 10:08:27 +01:00
|
|
|
double Notification::GetNotificationInterval(void) const
|
|
|
|
{
|
|
|
|
if (m_NotificationInterval.IsEmpty())
|
|
|
|
return 300;
|
|
|
|
else
|
|
|
|
return m_NotificationInterval;
|
|
|
|
}
|
|
|
|
|
2013-03-21 13:42:46 +01:00
|
|
|
TimePeriod::Ptr Notification::GetNotificationPeriod(void) const
|
|
|
|
{
|
|
|
|
return TimePeriod::GetByName(m_NotificationPeriod);
|
|
|
|
}
|
|
|
|
|
2013-03-20 10:08:27 +01:00
|
|
|
double Notification::GetLastNotification(void) const
|
|
|
|
{
|
|
|
|
if (m_LastNotification.IsEmpty())
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return m_LastNotification;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the timestamp when the last notification was sent.
|
|
|
|
*/
|
|
|
|
void Notification::SetLastNotification(double time)
|
|
|
|
{
|
|
|
|
m_LastNotification = time;
|
|
|
|
}
|
|
|
|
|
|
|
|
double Notification::GetNextNotification(void) const
|
|
|
|
{
|
|
|
|
if (m_NextNotification.IsEmpty())
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return m_NextNotification;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the timestamp when the next periodical notification should be sent.
|
|
|
|
* This does not affect notifications that are sent for state changes.
|
|
|
|
*/
|
2013-08-28 14:59:41 +02:00
|
|
|
void Notification::SetNextNotification(double time, const String& authority)
|
2013-03-20 10:08:27 +01:00
|
|
|
{
|
|
|
|
m_NextNotification = time;
|
2013-08-28 14:59:41 +02:00
|
|
|
|
|
|
|
Utility::QueueAsyncCallback(bind(boost::ref(OnNextNotificationChanged), GetSelf(), time, authority));
|
2013-03-20 10:08:27 +01:00
|
|
|
}
|
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
long Notification::GetNotificationNumber(void) const
|
2013-07-18 17:04:09 +02:00
|
|
|
{
|
|
|
|
if (m_NotificationNumber.IsEmpty())
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return m_NotificationNumber;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Notification::UpdateNotificationNumber(void)
|
|
|
|
{
|
|
|
|
m_NotificationNumber = m_NotificationNumber + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Notification::ResetNotificationNumber(void)
|
|
|
|
{
|
|
|
|
m_NotificationNumber = 0;
|
|
|
|
}
|
|
|
|
|
2013-02-24 01:10:34 +01:00
|
|
|
String Notification::NotificationTypeToString(NotificationType type)
|
2013-02-09 11:42:22 +01:00
|
|
|
{
|
2013-02-24 01:10:34 +01:00
|
|
|
switch (type) {
|
|
|
|
case NotificationDowntimeStart:
|
|
|
|
return "DOWNTIMESTART";
|
|
|
|
case NotificationDowntimeEnd:
|
|
|
|
return "DOWNTIMEEND";
|
|
|
|
case NotificationDowntimeRemoved:
|
|
|
|
return "DOWNTIMECANCELLED";
|
|
|
|
case NotificationCustom:
|
2013-02-24 12:47:24 +01:00
|
|
|
return "CUSTOM";
|
|
|
|
case NotificationAcknowledgement:
|
|
|
|
return "ACKNOWLEDGEMENT";
|
2013-02-24 01:10:34 +01:00
|
|
|
case NotificationProblem:
|
|
|
|
return "PROBLEM";
|
|
|
|
case NotificationRecovery:
|
|
|
|
return "RECOVERY";
|
2013-06-21 10:20:29 +02:00
|
|
|
case NotificationFlappingStart:
|
|
|
|
return "FLAPPINGSTART";
|
|
|
|
case NotificationFlappingEnd:
|
|
|
|
return "FLAPPINGEND";
|
2013-02-24 01:10:34 +01:00
|
|
|
default:
|
|
|
|
return "UNKNOWN_NOTIFICATION";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-01 11:17:58 +02:00
|
|
|
void Notification::BeginExecuteNotification(NotificationType type, const Dictionary::Ptr& cr, bool force, const String& author, const String& text)
|
2013-02-24 01:10:34 +01:00
|
|
|
{
|
2013-03-07 16:00:10 +01:00
|
|
|
ASSERT(!OwnsLock());
|
2013-02-24 01:10:34 +01:00
|
|
|
|
2013-05-13 13:44:57 +02:00
|
|
|
if (!force) {
|
2013-03-21 13:42:46 +01:00
|
|
|
TimePeriod::Ptr tp = GetNotificationPeriod();
|
|
|
|
|
|
|
|
if (tp && !tp->IsInside(Utility::GetTime())) {
|
|
|
|
Log(LogInformation, "icinga", "Not sending notifications for notification object '" + GetName() + "': not in timeperiod");
|
|
|
|
return;
|
|
|
|
}
|
2013-05-13 13:44:57 +02:00
|
|
|
|
|
|
|
double now = Utility::GetTime();
|
|
|
|
Dictionary::Ptr times = GetTimes();
|
|
|
|
Service::Ptr service = GetService();
|
|
|
|
|
2013-07-19 11:02:43 +02:00
|
|
|
if (type == NotificationProblem) {
|
|
|
|
if (times && times->Contains("begin") && now < service->GetLastHardStateChange() + times->Get("begin")) {
|
|
|
|
Log(LogInformation, "icinga", "Not sending notifications for notification object '" + GetName() + "': before escalation range");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (times && times->Contains("end") && now > service->GetLastHardStateChange() + times->Get("end")) {
|
|
|
|
Log(LogInformation, "icinga", "Not sending notifications for notification object '" + GetName() + "': after escalation range");
|
|
|
|
return;
|
|
|
|
}
|
2013-05-13 13:44:57 +02:00
|
|
|
}
|
2013-06-26 09:08:50 +02:00
|
|
|
|
|
|
|
unsigned long ftype = 1 << type;
|
|
|
|
|
2013-06-26 09:50:04 +02:00
|
|
|
Log(LogDebug, "icinga", "FType=" + Convert::ToString(ftype) + ", TypeFilter=" + Convert::ToString(GetNotificationTypeFilter()));
|
2013-06-26 09:08:50 +02:00
|
|
|
|
2013-06-26 09:50:04 +02:00
|
|
|
if (!(ftype & GetNotificationTypeFilter())) {
|
2013-06-26 09:08:50 +02:00
|
|
|
Log(LogInformation, "icinga", "Not sending notifications for notification object '" + GetName() + "': type filter does not match");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned long fstate = 1 << GetService()->GetState();
|
|
|
|
|
2013-06-26 09:50:04 +02:00
|
|
|
if (!(fstate & GetNotificationStateFilter())) {
|
2013-06-26 09:08:50 +02:00
|
|
|
Log(LogInformation, "icinga", "Not sending notifications for notification object '" + GetName() + "': state filter does not match");
|
|
|
|
return;
|
|
|
|
}
|
2013-03-21 13:42:46 +01:00
|
|
|
}
|
|
|
|
|
2013-03-20 10:08:27 +01:00
|
|
|
{
|
|
|
|
ObjectLock olock(this);
|
|
|
|
|
|
|
|
SetLastNotification(Utility::GetTime());
|
|
|
|
}
|
|
|
|
|
2013-03-16 21:18:53 +01:00
|
|
|
std::set<User::Ptr> allUsers;
|
2013-02-27 21:49:03 +01:00
|
|
|
|
2013-03-16 21:18:53 +01:00
|
|
|
std::set<User::Ptr> users = GetUsers();
|
2013-02-27 21:49:03 +01:00
|
|
|
std::copy(users.begin(), users.end(), std::inserter(allUsers, allUsers.begin()));
|
|
|
|
|
2013-03-02 09:07:47 +01:00
|
|
|
BOOST_FOREACH(const UserGroup::Ptr& ug, GetGroups()) {
|
2013-03-16 21:18:53 +01:00
|
|
|
std::set<User::Ptr> members = ug->GetMembers();
|
2013-02-27 21:49:03 +01:00
|
|
|
std::copy(members.begin(), members.end(), std::inserter(allUsers, allUsers.begin()));
|
|
|
|
}
|
2013-02-24 08:26:10 +01:00
|
|
|
|
2013-02-27 21:49:03 +01:00
|
|
|
BOOST_FOREACH(const User::Ptr& user, allUsers) {
|
2013-06-13 11:33:00 +02:00
|
|
|
Log(LogDebug, "icinga", "Sending notification for user '" + user->GetName() + "'");
|
2013-07-01 11:17:58 +02:00
|
|
|
Utility::QueueAsyncCallback(boost::bind(&Notification::ExecuteNotificationHelper, this, type, user, cr, force, author, text));
|
2013-02-24 08:26:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-01 11:17:58 +02:00
|
|
|
void Notification::ExecuteNotificationHelper(NotificationType type, const User::Ptr& user, const Dictionary::Ptr& cr, bool force, const String& author, const String& text)
|
2013-02-24 08:26:10 +01:00
|
|
|
{
|
2013-03-07 16:00:10 +01:00
|
|
|
ASSERT(!OwnsLock());
|
2013-03-02 09:07:47 +01:00
|
|
|
|
2013-06-26 09:08:50 +02:00
|
|
|
if (!force) {
|
2013-03-21 13:42:46 +01:00
|
|
|
TimePeriod::Ptr tp = user->GetNotificationPeriod();
|
2013-02-24 08:26:10 +01:00
|
|
|
|
2013-03-21 13:42:46 +01:00
|
|
|
if (tp && !tp->IsInside(Utility::GetTime())) {
|
|
|
|
Log(LogInformation, "icinga", "Not sending notifications for notification object '" +
|
|
|
|
GetName() + " and user '" + user->GetName() + "': user not in timeperiod");
|
|
|
|
return;
|
|
|
|
}
|
2013-06-26 09:08:50 +02:00
|
|
|
|
|
|
|
unsigned long ftype = 1 << type;
|
|
|
|
|
2013-06-26 09:50:04 +02:00
|
|
|
if (!(ftype & user->GetNotificationTypeFilter())) {
|
2013-06-26 09:08:50 +02:00
|
|
|
Log(LogInformation, "icinga", "Not sending notifications for notification object '" +
|
|
|
|
GetName() + " and user '" + user->GetName() + "': type filter does not match");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned long fstate = 1 << GetService()->GetState();
|
|
|
|
|
2013-06-26 09:50:04 +02:00
|
|
|
if (!(fstate & user->GetNotificationStateFilter())) {
|
2013-06-26 09:08:50 +02:00
|
|
|
Log(LogInformation, "icinga", "Not sending notifications for notification object '" +
|
|
|
|
GetName() + " and user '" + user->GetName() + "': state filter does not match");
|
|
|
|
return;
|
|
|
|
}
|
2013-02-24 08:26:10 +01:00
|
|
|
}
|
|
|
|
|
2013-02-09 11:42:22 +01:00
|
|
|
try {
|
2013-06-13 11:33:00 +02:00
|
|
|
GetNotificationCommand()->Execute(GetSelf(), user, cr, type);
|
2013-02-09 11:42:22 +01:00
|
|
|
|
2013-07-18 17:04:09 +02:00
|
|
|
{
|
|
|
|
ObjectLock olock(this);
|
|
|
|
UpdateNotificationNumber();
|
2013-08-08 08:30:19 +02:00
|
|
|
SetLastNotification(Utility::GetTime());
|
2013-07-18 17:04:09 +02:00
|
|
|
}
|
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
Service::OnNotificationSentChanged(GetSelf(), user, type, cr, author, text);
|
2013-06-28 21:31:38 +02:00
|
|
|
|
2013-03-16 21:18:53 +01:00
|
|
|
Log(LogInformation, "icinga", "Completed sending notification for service '" + GetService()->GetName() + "'");
|
|
|
|
} catch (const std::exception& ex) {
|
|
|
|
std::ostringstream msgbuf;
|
2013-02-09 11:42:22 +01:00
|
|
|
msgbuf << "Exception occured during notification for service '"
|
2013-03-16 21:18:53 +01:00
|
|
|
<< GetService()->GetName() << "': " << boost::diagnostic_information(ex);
|
2013-02-09 11:42:22 +01:00
|
|
|
String message = msgbuf.str();
|
|
|
|
|
2013-03-16 21:18:53 +01:00
|
|
|
Log(LogWarning, "icinga", message);
|
2013-02-09 11:42:22 +01:00
|
|
|
}
|
|
|
|
}
|
2013-02-11 14:01:52 +01:00
|
|
|
|
2013-04-16 10:12:53 +02:00
|
|
|
bool Notification::ResolveMacro(const String& macro, const Dictionary::Ptr&, String *result) const
|
2013-03-22 14:40:55 +01:00
|
|
|
{
|
|
|
|
Dictionary::Ptr macros = GetMacros();
|
|
|
|
|
|
|
|
if (macros && macros->Contains(macro)) {
|
|
|
|
*result = macros->Get(macro);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2013-08-20 11:06:04 +02:00
|
|
|
|
|
|
|
void Notification::InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes) const
|
|
|
|
{
|
|
|
|
DynamicObject::InternalSerialize(bag, attributeTypes);
|
|
|
|
|
|
|
|
bag->Set("notification_command", m_NotificationCommand);
|
|
|
|
bag->Set("notification_interval", m_NotificationInterval);
|
|
|
|
bag->Set("notification_period", m_NotificationPeriod);
|
|
|
|
bag->Set("last_notification", m_LastNotification);
|
|
|
|
bag->Set("next_notification", m_NextNotification);
|
|
|
|
bag->Set("notification_number", m_NotificationNumber);
|
|
|
|
bag->Set("macros", m_Macros);
|
|
|
|
bag->Set("users", m_Users);
|
|
|
|
bag->Set("groups", m_Groups);
|
|
|
|
bag->Set("times", m_Times);
|
|
|
|
bag->Set("notification_type_filter", m_NotificationTypeFilter);
|
|
|
|
bag->Set("notification_state_filter", m_NotificationStateFilter);
|
|
|
|
bag->Set("host_name", m_HostName);
|
|
|
|
bag->Set("export_macros", m_ExportMacros);
|
|
|
|
bag->Set("service", m_Service);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Notification::InternalDeserialize(const Dictionary::Ptr& bag, int attributeTypes)
|
|
|
|
{
|
|
|
|
DynamicObject::InternalDeserialize(bag, attributeTypes);
|
|
|
|
|
|
|
|
m_NotificationCommand = bag->Get("notification_command");
|
|
|
|
m_NotificationInterval = bag->Get("notification_interval");
|
|
|
|
m_NotificationPeriod = bag->Get("notification_period");
|
|
|
|
m_LastNotification = bag->Get("last_notification");
|
|
|
|
m_NextNotification = bag->Get("next_notification");
|
|
|
|
m_NotificationNumber = bag->Get("notification_number");
|
|
|
|
m_Macros = bag->Get("macros");
|
|
|
|
m_Users = bag->Get("users");
|
|
|
|
m_Groups = bag->Get("groups");
|
|
|
|
m_Times = bag->Get("times");
|
|
|
|
m_NotificationTypeFilter = bag->Get("notification_type_filter");
|
|
|
|
m_NotificationStateFilter = bag->Get("notification_state_filter");
|
|
|
|
m_HostName = bag->Get("host_name");
|
|
|
|
m_ExportMacros = bag->Get("export_macros");
|
|
|
|
m_Service = bag->Get("service");
|
|
|
|
}
|