mirror of https://github.com/Icinga/icinga2.git
parent
98ba1c03d0
commit
829d07aefe
|
@ -49,7 +49,7 @@ void DbEvents::StaticInitialize()
|
||||||
/* History */
|
/* History */
|
||||||
Comment::OnCommentAdded.connect(std::bind(&DbEvents::AddCommentHistory, _1));
|
Comment::OnCommentAdded.connect(std::bind(&DbEvents::AddCommentHistory, _1));
|
||||||
Downtime::OnDowntimeAdded.connect(std::bind(&DbEvents::AddDowntimeHistory, _1));
|
Downtime::OnDowntimeAdded.connect(std::bind(&DbEvents::AddDowntimeHistory, _1));
|
||||||
Checkable::OnAcknowledgementSet.connect(std::bind(&DbEvents::AddAcknowledgementHistory, _1, _2, _3, _4, _5, _6));
|
Checkable::OnAcknowledgementSet.connect(std::bind(&DbEvents::AddAcknowledgementHistory, _1, _2, _3, _4, _5, _7));
|
||||||
|
|
||||||
Checkable::OnNotificationSentToAllUsers.connect(std::bind(&DbEvents::AddNotificationHistory, _1, _2, _3, _4, _5, _6, _7));
|
Checkable::OnNotificationSentToAllUsers.connect(std::bind(&DbEvents::AddNotificationHistory, _1, _2, _3, _4, _5, _6, _7));
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,7 @@ Dictionary::Ptr ApiActions::AcknowledgeProblem(const ConfigObject::Ptr& object,
|
||||||
Comment::AddComment(checkable, CommentAcknowledgement, HttpUtility::GetLastParameter(params, "author"),
|
Comment::AddComment(checkable, CommentAcknowledgement, HttpUtility::GetLastParameter(params, "author"),
|
||||||
HttpUtility::GetLastParameter(params, "comment"), persistent, timestamp);
|
HttpUtility::GetLastParameter(params, "comment"), persistent, timestamp);
|
||||||
checkable->AcknowledgeProblem(HttpUtility::GetLastParameter(params, "author"),
|
checkable->AcknowledgeProblem(HttpUtility::GetLastParameter(params, "author"),
|
||||||
HttpUtility::GetLastParameter(params, "comment"), sticky, notify, persistent, timestamp);
|
HttpUtility::GetLastParameter(params, "comment"), sticky, notify, persistent, Utility::GetTime(), timestamp);
|
||||||
|
|
||||||
return ApiActions::CreateResult(200, "Successfully acknowledged problem for object '" + checkable->GetName() + "'.");
|
return ApiActions::CreateResult(200, "Successfully acknowledged problem for object '" + checkable->GetName() + "'.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ void ApiEvents::FlappingChangedHandler(const Checkable::Ptr& checkable, const Me
|
||||||
|
|
||||||
void ApiEvents::AcknowledgementSetHandler(const Checkable::Ptr& checkable,
|
void ApiEvents::AcknowledgementSetHandler(const Checkable::Ptr& checkable,
|
||||||
const String& author, const String& comment, AcknowledgementType type,
|
const String& author, const String& comment, AcknowledgementType type,
|
||||||
bool notify, bool persistent, double expiry, const MessageOrigin::Ptr& origin)
|
bool notify, bool persistent, double, double expiry, const MessageOrigin::Ptr& origin)
|
||||||
{
|
{
|
||||||
std::vector<EventQueue::Ptr> queues = EventQueue::GetQueuesForType("AcknowledgementSet");
|
std::vector<EventQueue::Ptr> queues = EventQueue::GetQueuesForType("AcknowledgementSet");
|
||||||
auto inboxes (EventsRouter::GetInstance().GetInboxes(EventType::AcknowledgementSet));
|
auto inboxes (EventsRouter::GetInstance().GetInboxes(EventType::AcknowledgementSet));
|
||||||
|
@ -221,7 +221,7 @@ void ApiEvents::AcknowledgementSetHandler(const Checkable::Ptr& checkable,
|
||||||
inboxes.Push(std::move(result));
|
inboxes.Push(std::move(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiEvents::AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy, const MessageOrigin::Ptr& origin)
|
void ApiEvents::AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy, double, const MessageOrigin::Ptr& origin)
|
||||||
{
|
{
|
||||||
std::vector<EventQueue::Ptr> queues = EventQueue::GetQueuesForType("AcknowledgementCleared");
|
std::vector<EventQueue::Ptr> queues = EventQueue::GetQueuesForType("AcknowledgementCleared");
|
||||||
auto inboxes (EventsRouter::GetInstance().GetInboxes(EventType::AcknowledgementCleared));
|
auto inboxes (EventsRouter::GetInstance().GetInboxes(EventType::AcknowledgementCleared));
|
||||||
|
|
|
@ -29,8 +29,8 @@ public:
|
||||||
|
|
||||||
static void AcknowledgementSetHandler(const Checkable::Ptr& checkable,
|
static void AcknowledgementSetHandler(const Checkable::Ptr& checkable,
|
||||||
const String& author, const String& comment, AcknowledgementType type,
|
const String& author, const String& comment, AcknowledgementType type,
|
||||||
bool notify, bool persistent, double expiry, const MessageOrigin::Ptr& origin);
|
bool notify, bool persistent, double, double expiry, const MessageOrigin::Ptr& origin);
|
||||||
static void AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy, const MessageOrigin::Ptr& origin);
|
static void AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy, double, const MessageOrigin::Ptr& origin);
|
||||||
|
|
||||||
static void CommentAddedHandler(const Comment::Ptr& comment);
|
static void CommentAddedHandler(const Comment::Ptr& comment);
|
||||||
static void CommentRemovedHandler(const Comment::Ptr& comment);
|
static void CommentRemovedHandler(const Comment::Ptr& comment);
|
||||||
|
|
|
@ -15,8 +15,8 @@ using namespace icinga;
|
||||||
REGISTER_TYPE_WITH_PROTOTYPE(Checkable, Checkable::GetPrototype());
|
REGISTER_TYPE_WITH_PROTOTYPE(Checkable, Checkable::GetPrototype());
|
||||||
INITIALIZE_ONCE(&Checkable::StaticInitialize);
|
INITIALIZE_ONCE(&Checkable::StaticInitialize);
|
||||||
|
|
||||||
boost::signals2::signal<void (const Checkable::Ptr&, const String&, const String&, AcknowledgementType, bool, bool, double, const MessageOrigin::Ptr&)> Checkable::OnAcknowledgementSet;
|
boost::signals2::signal<void (const Checkable::Ptr&, const String&, const String&, AcknowledgementType, bool, bool, double, double, const MessageOrigin::Ptr&)> Checkable::OnAcknowledgementSet;
|
||||||
boost::signals2::signal<void (const Checkable::Ptr&, const String&, const MessageOrigin::Ptr&)> Checkable::OnAcknowledgementCleared;
|
boost::signals2::signal<void (const Checkable::Ptr&, const String&, double, const MessageOrigin::Ptr&)> Checkable::OnAcknowledgementCleared;
|
||||||
|
|
||||||
static Timer::Ptr l_CheckablesFireSuppressedNotifications;
|
static Timer::Ptr l_CheckablesFireSuppressedNotifications;
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ bool Checkable::IsAcknowledged() const
|
||||||
return const_cast<Checkable *>(this)->GetAcknowledgement() != AcknowledgementNone;
|
return const_cast<Checkable *>(this)->GetAcknowledgement() != AcknowledgementNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checkable::AcknowledgeProblem(const String& author, const String& comment, AcknowledgementType type, bool notify, bool persistent, double expiry, const MessageOrigin::Ptr& origin)
|
void Checkable::AcknowledgeProblem(const String& author, const String& comment, AcknowledgementType type, bool notify, bool persistent, double changeTime, double expiry, const MessageOrigin::Ptr& origin)
|
||||||
{
|
{
|
||||||
SetAcknowledgementRaw(type);
|
SetAcknowledgementRaw(type);
|
||||||
SetAcknowledgementExpiry(expiry);
|
SetAcknowledgementExpiry(expiry);
|
||||||
|
@ -133,10 +133,12 @@ void Checkable::AcknowledgeProblem(const String& author, const String& comment,
|
||||||
Log(LogInformation, "Checkable")
|
Log(LogInformation, "Checkable")
|
||||||
<< "Acknowledgement set for checkable '" << GetName() << "'.";
|
<< "Acknowledgement set for checkable '" << GetName() << "'.";
|
||||||
|
|
||||||
OnAcknowledgementSet(this, author, comment, type, notify, persistent, expiry, origin);
|
OnAcknowledgementSet(this, author, comment, type, notify, persistent, changeTime, expiry, origin);
|
||||||
|
|
||||||
|
SetAcknowledgementLastChange(changeTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checkable::ClearAcknowledgement(const String& removedBy, const MessageOrigin::Ptr& origin)
|
void Checkable::ClearAcknowledgement(const String& removedBy, double changeTime, const MessageOrigin::Ptr& origin)
|
||||||
{
|
{
|
||||||
ObjectLock oLock (this);
|
ObjectLock oLock (this);
|
||||||
|
|
||||||
|
@ -157,7 +159,9 @@ void Checkable::ClearAcknowledgement(const String& removedBy, const MessageOrigi
|
||||||
<< "Acknowledgement cleared for checkable '" << GetName() << "'.";
|
<< "Acknowledgement cleared for checkable '" << GetName() << "'.";
|
||||||
|
|
||||||
if (wasAcked) {
|
if (wasAcked) {
|
||||||
OnAcknowledgementCleared(this, removedBy, origin);
|
OnAcknowledgementCleared(this, removedBy, changeTime, origin);
|
||||||
|
|
||||||
|
SetAcknowledgementLastChange(changeTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,8 @@ public:
|
||||||
|
|
||||||
AcknowledgementType GetAcknowledgement();
|
AcknowledgementType GetAcknowledgement();
|
||||||
|
|
||||||
void AcknowledgeProblem(const String& author, const String& comment, AcknowledgementType type, bool notify = true, bool persistent = false, double expiry = 0, const MessageOrigin::Ptr& origin = nullptr);
|
void AcknowledgeProblem(const String& author, const String& comment, AcknowledgementType type, bool notify = true, bool persistent = false, double changeTime = Utility::GetTime(), double expiry = 0, const MessageOrigin::Ptr& origin = nullptr);
|
||||||
void ClearAcknowledgement(const String& removedBy, const MessageOrigin::Ptr& origin = nullptr);
|
void ClearAcknowledgement(const String& removedBy, double changeTime = Utility::GetTime(), const MessageOrigin::Ptr& origin = nullptr);
|
||||||
|
|
||||||
int GetSeverity() const override;
|
int GetSeverity() const override;
|
||||||
bool GetProblem() const override;
|
bool GetProblem() const override;
|
||||||
|
@ -112,8 +112,8 @@ public:
|
||||||
const NotificationType&, const CheckResult::Ptr&, const String&,
|
const NotificationType&, const CheckResult::Ptr&, const String&,
|
||||||
const String&, const MessageOrigin::Ptr&)> OnNotificationSentToAllUsers;
|
const String&, const MessageOrigin::Ptr&)> OnNotificationSentToAllUsers;
|
||||||
static boost::signals2::signal<void (const Checkable::Ptr&, const String&, const String&, AcknowledgementType,
|
static boost::signals2::signal<void (const Checkable::Ptr&, const String&, const String&, AcknowledgementType,
|
||||||
bool, bool, double, const MessageOrigin::Ptr&)> OnAcknowledgementSet;
|
bool, bool, double, double, const MessageOrigin::Ptr&)> OnAcknowledgementSet;
|
||||||
static boost::signals2::signal<void (const Checkable::Ptr&, const String&, const MessageOrigin::Ptr&)> OnAcknowledgementCleared;
|
static boost::signals2::signal<void (const Checkable::Ptr&, const String&, double, const MessageOrigin::Ptr&)> OnAcknowledgementCleared;
|
||||||
static boost::signals2::signal<void (const Checkable::Ptr&)> OnNextCheckUpdated;
|
static boost::signals2::signal<void (const Checkable::Ptr&)> OnNextCheckUpdated;
|
||||||
static boost::signals2::signal<void (const Checkable::Ptr&)> OnEventCommandExecuted;
|
static boost::signals2::signal<void (const Checkable::Ptr&)> OnEventCommandExecuted;
|
||||||
|
|
||||||
|
|
|
@ -147,6 +147,7 @@ abstract class Checkable : CustomVarObject
|
||||||
default {{{ return AcknowledgementNone; }}}
|
default {{{ return AcknowledgementNone; }}}
|
||||||
};
|
};
|
||||||
[state] Timestamp acknowledgement_expiry;
|
[state] Timestamp acknowledgement_expiry;
|
||||||
|
[state] Timestamp acknowledgement_last_change;
|
||||||
[state] bool force_next_notification;
|
[state] bool force_next_notification;
|
||||||
[no_storage] Timestamp last_check {
|
[no_storage] Timestamp last_check {
|
||||||
get;
|
get;
|
||||||
|
|
|
@ -473,7 +473,7 @@ Value ClusterEvents::ForceNextNotificationChangedAPIHandler(const MessageOrigin:
|
||||||
|
|
||||||
void ClusterEvents::AcknowledgementSetHandler(const Checkable::Ptr& checkable,
|
void ClusterEvents::AcknowledgementSetHandler(const Checkable::Ptr& checkable,
|
||||||
const String& author, const String& comment, AcknowledgementType type,
|
const String& author, const String& comment, AcknowledgementType type,
|
||||||
bool notify, bool persistent, double expiry, const MessageOrigin::Ptr& origin)
|
bool notify, bool persistent, double changeTime, double expiry, const MessageOrigin::Ptr& origin)
|
||||||
{
|
{
|
||||||
ApiListener::Ptr listener = ApiListener::GetInstance();
|
ApiListener::Ptr listener = ApiListener::GetInstance();
|
||||||
|
|
||||||
|
@ -494,6 +494,7 @@ void ClusterEvents::AcknowledgementSetHandler(const Checkable::Ptr& checkable,
|
||||||
params->Set("notify", notify);
|
params->Set("notify", notify);
|
||||||
params->Set("persistent", persistent);
|
params->Set("persistent", persistent);
|
||||||
params->Set("expiry", expiry);
|
params->Set("expiry", expiry);
|
||||||
|
params->Set("change_time", changeTime);
|
||||||
|
|
||||||
Dictionary::Ptr message = new Dictionary();
|
Dictionary::Ptr message = new Dictionary();
|
||||||
message->Set("jsonrpc", "2.0");
|
message->Set("jsonrpc", "2.0");
|
||||||
|
@ -546,12 +547,12 @@ Value ClusterEvents::AcknowledgementSetAPIHandler(const MessageOrigin::Ptr& orig
|
||||||
|
|
||||||
checkable->AcknowledgeProblem(params->Get("author"), params->Get("comment"),
|
checkable->AcknowledgeProblem(params->Get("author"), params->Get("comment"),
|
||||||
static_cast<AcknowledgementType>(static_cast<int>(params->Get("acktype"))),
|
static_cast<AcknowledgementType>(static_cast<int>(params->Get("acktype"))),
|
||||||
params->Get("notify"), params->Get("persistent"), params->Get("expiry"), origin);
|
params->Get("notify"), params->Get("persistent"), params->Get("change_time"), params->Get("expiry"), origin);
|
||||||
|
|
||||||
return Empty;
|
return Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterEvents::AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy, const MessageOrigin::Ptr& origin)
|
void ClusterEvents::AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy, double changeTime, const MessageOrigin::Ptr& origin)
|
||||||
{
|
{
|
||||||
ApiListener::Ptr listener = ApiListener::GetInstance();
|
ApiListener::Ptr listener = ApiListener::GetInstance();
|
||||||
|
|
||||||
|
@ -567,6 +568,7 @@ void ClusterEvents::AcknowledgementClearedHandler(const Checkable::Ptr& checkabl
|
||||||
if (service)
|
if (service)
|
||||||
params->Set("service", service->GetShortName());
|
params->Set("service", service->GetShortName());
|
||||||
params->Set("author", removedBy);
|
params->Set("author", removedBy);
|
||||||
|
params->Set("change_time", changeTime);
|
||||||
|
|
||||||
Dictionary::Ptr message = new Dictionary();
|
Dictionary::Ptr message = new Dictionary();
|
||||||
message->Set("jsonrpc", "2.0");
|
message->Set("jsonrpc", "2.0");
|
||||||
|
@ -608,7 +610,7 @@ Value ClusterEvents::AcknowledgementClearedAPIHandler(const MessageOrigin::Ptr&
|
||||||
return Empty;
|
return Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkable->ClearAcknowledgement(params->Get("author"), origin);
|
checkable->ClearAcknowledgement(params->Get("author"), params->Get("change_time"), origin);
|
||||||
|
|
||||||
return Empty;
|
return Empty;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,10 @@ public:
|
||||||
static Value ForceNextNotificationChangedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
static Value ForceNextNotificationChangedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||||
|
|
||||||
static void AcknowledgementSetHandler(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type,
|
static void AcknowledgementSetHandler(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type,
|
||||||
bool notify, bool persistent, double expiry, const MessageOrigin::Ptr& origin);
|
bool notify, bool persistent, double changeTime, double expiry, const MessageOrigin::Ptr& origin);
|
||||||
static Value AcknowledgementSetAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
static Value AcknowledgementSetAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||||
|
|
||||||
static void AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy, const MessageOrigin::Ptr& origin);
|
static void AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy, double changeTime, const MessageOrigin::Ptr& origin);
|
||||||
static Value AcknowledgementClearedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
static Value AcknowledgementClearedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||||
|
|
||||||
static Value ExecuteCommandAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
static Value ExecuteCommandAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||||
|
|
|
@ -60,15 +60,15 @@ void IcingaDB::ConfigStaticInitialize()
|
||||||
IcingaDB::StateChangeHandler(checkable, cr, type);
|
IcingaDB::StateChangeHandler(checkable, cr, type);
|
||||||
});
|
});
|
||||||
|
|
||||||
Checkable::OnAcknowledgementSet.connect([](const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, bool, bool persistent, double expiry, const MessageOrigin::Ptr&) {
|
Checkable::OnAcknowledgementSet.connect([](const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, bool, bool persistent, double changeTime, double expiry, const MessageOrigin::Ptr&) {
|
||||||
AcknowledgementSetHandler(checkable, author, comment, type, persistent, expiry);
|
AcknowledgementSetHandler(checkable, author, comment, type, persistent, changeTime, expiry);
|
||||||
});
|
});
|
||||||
Checkable::OnAcknowledgementCleared.connect([](const Checkable::Ptr& checkable, const String& removedBy, const MessageOrigin::Ptr&) {
|
Checkable::OnAcknowledgementCleared.connect([](const Checkable::Ptr& checkable, const String& removedBy, double changeTime, const MessageOrigin::Ptr&) {
|
||||||
AcknowledgementClearedHandler(checkable, removedBy);
|
AcknowledgementClearedHandler(checkable, removedBy, changeTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
/* triggered when acknowledged host/service goes back to ok and when the acknowledgement gets deleted */
|
/* triggered when acknowledged host/service goes back to ok and when the acknowledgement gets deleted */
|
||||||
Checkable::OnAcknowledgementCleared.connect([](const Checkable::Ptr& checkable, const String&, const MessageOrigin::Ptr&) {
|
Checkable::OnAcknowledgementCleared.connect([](const Checkable::Ptr& checkable, const String&, double, const MessageOrigin::Ptr&) {
|
||||||
IcingaDB::StateChangeHandler(checkable);
|
IcingaDB::StateChangeHandler(checkable);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1669,7 +1669,7 @@ void IcingaDB::SendNextUpdate(const Checkable::Ptr& checkable)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IcingaDB::SendAcknowledgementSet(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, bool persistent, double expiry)
|
void IcingaDB::SendAcknowledgementSet(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, bool persistent, double changeTime, double expiry)
|
||||||
{
|
{
|
||||||
if (!m_Rcon || !m_Rcon->IsConnected())
|
if (!m_Rcon || !m_Rcon->IsConnected())
|
||||||
return;
|
return;
|
||||||
|
@ -1683,7 +1683,7 @@ void IcingaDB::SendAcknowledgementSet(const Checkable::Ptr& checkable, const Str
|
||||||
"id", Utility::NewUniqueID(),
|
"id", Utility::NewUniqueID(),
|
||||||
"environment_id", SHA1(GetEnvironment()),
|
"environment_id", SHA1(GetEnvironment()),
|
||||||
"host_id", GetObjectIdentifier(host),
|
"host_id", GetObjectIdentifier(host),
|
||||||
"event_time", Convert::ToString(TimestampToMilliseconds(Utility::GetTime())),
|
"event_time", Convert::ToString(TimestampToMilliseconds(changeTime)),
|
||||||
"event_type", "ack_set",
|
"event_type", "ack_set",
|
||||||
"author", author,
|
"author", author,
|
||||||
"comment", comment,
|
"comment", comment,
|
||||||
|
@ -1716,7 +1716,7 @@ void IcingaDB::SendAcknowledgementSet(const Checkable::Ptr& checkable, const Str
|
||||||
m_Rcon->FireAndForgetQuery(std::move(xAdd), Prio::History);
|
m_Rcon->FireAndForgetQuery(std::move(xAdd), Prio::History);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IcingaDB::SendAcknowledgementCleared(const Checkable::Ptr& checkable, const String& removedBy)
|
void IcingaDB::SendAcknowledgementCleared(const Checkable::Ptr& checkable, const String& removedBy, double changeTime)
|
||||||
{
|
{
|
||||||
if (!m_Rcon || !m_Rcon->IsConnected())
|
if (!m_Rcon || !m_Rcon->IsConnected())
|
||||||
return;
|
return;
|
||||||
|
@ -1730,7 +1730,7 @@ void IcingaDB::SendAcknowledgementCleared(const Checkable::Ptr& checkable, const
|
||||||
"id", Utility::NewUniqueID(),
|
"id", Utility::NewUniqueID(),
|
||||||
"environment_id", SHA1(GetEnvironment()),
|
"environment_id", SHA1(GetEnvironment()),
|
||||||
"host_id", GetObjectIdentifier(host),
|
"host_id", GetObjectIdentifier(host),
|
||||||
"event_time", Convert::ToString(TimestampToMilliseconds(Utility::GetTime())),
|
"event_time", Convert::ToString(TimestampToMilliseconds(changeTime)),
|
||||||
"event_type", "ack_clear",
|
"event_type", "ack_clear",
|
||||||
"author", removedBy
|
"author", removedBy
|
||||||
});
|
});
|
||||||
|
@ -2007,7 +2007,7 @@ struct AuthorComment
|
||||||
String Comment;
|
String Comment;
|
||||||
};
|
};
|
||||||
|
|
||||||
void IcingaDB::AcknowledgementSetHandler(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, bool persistent, double expiry)
|
void IcingaDB::AcknowledgementSetHandler(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, bool persistent, double changeTime, double expiry)
|
||||||
{
|
{
|
||||||
auto rws (ConfigType::GetObjectsByType<IcingaDB>());
|
auto rws (ConfigType::GetObjectsByType<IcingaDB>());
|
||||||
|
|
||||||
|
@ -2015,12 +2015,12 @@ void IcingaDB::AcknowledgementSetHandler(const Checkable::Ptr& checkable, const
|
||||||
auto ac (Shared<AuthorComment>::Make(AuthorComment{author, comment}));
|
auto ac (Shared<AuthorComment>::Make(AuthorComment{author, comment}));
|
||||||
|
|
||||||
for (auto& rw : rws) {
|
for (auto& rw : rws) {
|
||||||
rw->m_WorkQueue.Enqueue([rw, checkable, ac, type, persistent, expiry]() { rw->SendAcknowledgementSet(checkable, ac->Author, ac->Comment, type, persistent, expiry); });
|
rw->m_WorkQueue.Enqueue([rw, checkable, ac, type, persistent, changeTime, expiry]() { rw->SendAcknowledgementSet(checkable, ac->Author, ac->Comment, type, persistent, changeTime, expiry); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IcingaDB::AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy)
|
void IcingaDB::AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy, double changeTime)
|
||||||
{
|
{
|
||||||
auto rws (ConfigType::GetObjectsByType<IcingaDB>());
|
auto rws (ConfigType::GetObjectsByType<IcingaDB>());
|
||||||
|
|
||||||
|
@ -2028,7 +2028,7 @@ void IcingaDB::AcknowledgementClearedHandler(const Checkable::Ptr& checkable, co
|
||||||
auto rb (Shared<String>::Make(removedBy));
|
auto rb (Shared<String>::Make(removedBy));
|
||||||
|
|
||||||
for (auto& rw : rws) {
|
for (auto& rw : rws) {
|
||||||
rw->m_WorkQueue.Enqueue([rw, checkable, rb]() { rw->SendAcknowledgementCleared(checkable, *rb); });
|
rw->m_WorkQueue.Enqueue([rw, checkable, rb, changeTime]() { rw->SendAcknowledgementCleared(checkable, *rb, changeTime); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,8 +67,8 @@ private:
|
||||||
void SendRemovedComment(const Comment::Ptr& comment);
|
void SendRemovedComment(const Comment::Ptr& comment);
|
||||||
void SendFlappingChanged(const Checkable::Ptr& checkable, const Value& value);
|
void SendFlappingChanged(const Checkable::Ptr& checkable, const Value& value);
|
||||||
void SendNextUpdate(const Checkable::Ptr& checkable);
|
void SendNextUpdate(const Checkable::Ptr& checkable);
|
||||||
void SendAcknowledgementSet(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, bool persistent, double expiry);
|
void SendAcknowledgementSet(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, bool persistent, double changeTime, double expiry);
|
||||||
void SendAcknowledgementCleared(const Checkable::Ptr& checkable, const String& removedBy);
|
void SendAcknowledgementCleared(const Checkable::Ptr& checkable, const String& removedBy, double changeTime);
|
||||||
|
|
||||||
std::vector<String> UpdateObjectAttrs(const ConfigObject::Ptr& object, int fieldType, const String& typeNameOverride);
|
std::vector<String> UpdateObjectAttrs(const ConfigObject::Ptr& object, int fieldType, const String& typeNameOverride);
|
||||||
Dictionary::Ptr SerializeState(const Checkable::Ptr& checkable);
|
Dictionary::Ptr SerializeState(const Checkable::Ptr& checkable);
|
||||||
|
@ -106,8 +106,8 @@ private:
|
||||||
static void CommentRemovedHandler(const Comment::Ptr& comment);
|
static void CommentRemovedHandler(const Comment::Ptr& comment);
|
||||||
static void FlappingChangedHandler(const Checkable::Ptr& checkable, const Value& value);
|
static void FlappingChangedHandler(const Checkable::Ptr& checkable, const Value& value);
|
||||||
static void NewCheckResultHandler(const Checkable::Ptr& checkable);
|
static void NewCheckResultHandler(const Checkable::Ptr& checkable);
|
||||||
static void AcknowledgementSetHandler(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, bool persistent, double expiry);
|
static void AcknowledgementSetHandler(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, bool persistent, double changeTime, double expiry);
|
||||||
static void AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy);
|
static void AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy, double changeTime);
|
||||||
|
|
||||||
void AssertOnWorkQueue();
|
void AssertOnWorkQueue();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue