mirror of
https://github.com/Icinga/icinga2.git
synced 2025-09-23 17:57:54 +02:00
parent
a5a869f390
commit
e52b2b6509
@ -97,8 +97,10 @@ void DbEvents::NextCheckChangedHandler(const Checkable::Ptr& checkable, double n
|
|||||||
else
|
else
|
||||||
query1.Table = "hoststatus";
|
query1.Table = "hoststatus";
|
||||||
|
|
||||||
query1.Type = DbQueryUpdate;
|
query1.Type = DbQueryInsert | DbQueryUpdate;
|
||||||
query1.Category = DbCatState;
|
query1.Category = DbCatState;
|
||||||
|
query1.StatusUpdate = true;
|
||||||
|
query1.Object = DbObject::GetOrCreateByObject(checkable);
|
||||||
|
|
||||||
Dictionary::Ptr fields1 = new Dictionary();
|
Dictionary::Ptr fields1 = new Dictionary();
|
||||||
fields1->Set("next_check", DbValue::FromTimestamp(nextCheck));
|
fields1->Set("next_check", DbValue::FromTimestamp(nextCheck));
|
||||||
@ -128,8 +130,10 @@ void DbEvents::FlappingChangedHandler(const Checkable::Ptr& checkable, FlappingS
|
|||||||
else
|
else
|
||||||
query1.Table = "hoststatus";
|
query1.Table = "hoststatus";
|
||||||
|
|
||||||
query1.Type = DbQueryUpdate;
|
query1.Type = DbQueryInsert | DbQueryUpdate;
|
||||||
query1.Category = DbCatState;
|
query1.Category = DbCatState;
|
||||||
|
query1.StatusUpdate = true;
|
||||||
|
query1.Object = DbObject::GetOrCreateByObject(checkable);
|
||||||
|
|
||||||
Dictionary::Ptr fields1 = new Dictionary();
|
Dictionary::Ptr fields1 = new Dictionary();
|
||||||
fields1->Set("is_flapping", CompatUtility::GetCheckableIsFlapping(checkable));
|
fields1->Set("is_flapping", CompatUtility::GetCheckableIsFlapping(checkable));
|
||||||
@ -164,8 +168,10 @@ void DbEvents::LastNotificationChangedHandler(const Notification::Ptr& notificat
|
|||||||
else
|
else
|
||||||
query1.Table = "hoststatus";
|
query1.Table = "hoststatus";
|
||||||
|
|
||||||
query1.Type = DbQueryUpdate;
|
query1.Type = DbQueryInsert | DbQueryUpdate;
|
||||||
query1.Category = DbCatState;
|
query1.Category = DbCatState;
|
||||||
|
query1.StatusUpdate = true;
|
||||||
|
query1.Object = DbObject::GetOrCreateByObject(checkable);
|
||||||
|
|
||||||
Dictionary::Ptr fields1 = new Dictionary();
|
Dictionary::Ptr fields1 = new Dictionary();
|
||||||
fields1->Set("last_notification", DbValue::FromTimestamp(now_bag.first));
|
fields1->Set("last_notification", DbValue::FromTimestamp(now_bag.first));
|
||||||
@ -223,8 +229,10 @@ void DbEvents::EnableChangedHandlerInternal(const Checkable::Ptr& checkable, boo
|
|||||||
else
|
else
|
||||||
query1.Table = "hoststatus";
|
query1.Table = "hoststatus";
|
||||||
|
|
||||||
query1.Type = DbQueryUpdate;
|
query1.Type = DbQueryInsert | DbQueryUpdate;
|
||||||
query1.Category = DbCatState;
|
query1.Category = DbCatState;
|
||||||
|
query1.StatusUpdate = true;
|
||||||
|
query1.Object = DbObject::GetOrCreateByObject(checkable);
|
||||||
|
|
||||||
Dictionary::Ptr fields1 = new Dictionary();
|
Dictionary::Ptr fields1 = new Dictionary();
|
||||||
|
|
||||||
@ -618,7 +626,10 @@ void DbEvents::TriggerDowntime(const Checkable::Ptr& checkable, const Downtime::
|
|||||||
else
|
else
|
||||||
query4.Table = "hoststatus";
|
query4.Table = "hoststatus";
|
||||||
|
|
||||||
query4.Type = DbQueryUpdate;
|
query4.Type = DbQueryInsert | DbQueryUpdate;
|
||||||
|
query4.Category = DbCatState;
|
||||||
|
query4.StatusUpdate = true;
|
||||||
|
query4.Object = DbObject::GetOrCreateByObject(checkable);
|
||||||
|
|
||||||
Dictionary::Ptr fields4 = new Dictionary();
|
Dictionary::Ptr fields4 = new Dictionary();
|
||||||
fields4->Set("scheduled_downtime_depth", checkable->GetDowntimeDepth());
|
fields4->Set("scheduled_downtime_depth", checkable->GetDowntimeDepth());
|
||||||
@ -707,8 +718,10 @@ void DbEvents::AddAcknowledgementInternal(const Checkable::Ptr& checkable, Ackno
|
|||||||
else
|
else
|
||||||
query1.Table = "hoststatus";
|
query1.Table = "hoststatus";
|
||||||
|
|
||||||
query1.Type = DbQueryUpdate;
|
query1.Type = DbQueryInsert | DbQueryUpdate;
|
||||||
query1.Category = DbCatAcknowledgement;
|
query1.Category = DbCatState;
|
||||||
|
query1.StatusUpdate = true;
|
||||||
|
query1.Object = DbObject::GetOrCreateByObject(checkable);
|
||||||
|
|
||||||
Dictionary::Ptr fields1 = new Dictionary();
|
Dictionary::Ptr fields1 = new Dictionary();
|
||||||
fields1->Set("acknowledgement_type", type);
|
fields1->Set("acknowledgement_type", type);
|
||||||
|
@ -254,7 +254,6 @@ void DbObject::SendVarsStatusUpdate(void)
|
|||||||
query.Table = "customvariablestatus";
|
query.Table = "customvariablestatus";
|
||||||
query.Type = DbQueryInsert | DbQueryUpdate;
|
query.Type = DbQueryInsert | DbQueryUpdate;
|
||||||
query.Category = DbCatState;
|
query.Category = DbCatState;
|
||||||
query.StatusUpdate = true;
|
|
||||||
query.Fields = fields;
|
query.Fields = fields;
|
||||||
|
|
||||||
query.WhereCriteria = new Dictionary();
|
query.WhereCriteria = new Dictionary();
|
||||||
|
@ -143,8 +143,11 @@ Dictionary::Ptr HostDbObject::GetStatusFields(void) const
|
|||||||
fields->Set("next_notification", DbValue::FromTimestamp(CompatUtility::GetCheckableNotificationNextNotification(host)));
|
fields->Set("next_notification", DbValue::FromTimestamp(CompatUtility::GetCheckableNotificationNextNotification(host)));
|
||||||
fields->Set("no_more_notifications", Empty);
|
fields->Set("no_more_notifications", Empty);
|
||||||
fields->Set("notifications_enabled", CompatUtility::GetCheckableNotificationsEnabled(host));
|
fields->Set("notifications_enabled", CompatUtility::GetCheckableNotificationsEnabled(host));
|
||||||
|
{
|
||||||
|
ObjectLock olock(host);
|
||||||
fields->Set("problem_has_been_acknowledged", CompatUtility::GetCheckableProblemHasBeenAcknowledged(host));
|
fields->Set("problem_has_been_acknowledged", CompatUtility::GetCheckableProblemHasBeenAcknowledged(host));
|
||||||
fields->Set("acknowledgement_type", CompatUtility::GetCheckableAcknowledgementType(host));
|
fields->Set("acknowledgement_type", CompatUtility::GetCheckableAcknowledgementType(host));
|
||||||
|
}
|
||||||
fields->Set("current_notification_number", CompatUtility::GetCheckableNotificationNotificationNumber(host));
|
fields->Set("current_notification_number", CompatUtility::GetCheckableNotificationNotificationNumber(host));
|
||||||
fields->Set("passive_checks_enabled", CompatUtility::GetCheckablePassiveChecksEnabled(host));
|
fields->Set("passive_checks_enabled", CompatUtility::GetCheckablePassiveChecksEnabled(host));
|
||||||
fields->Set("active_checks_enabled", CompatUtility::GetCheckableActiveChecksEnabled(host));
|
fields->Set("active_checks_enabled", CompatUtility::GetCheckableActiveChecksEnabled(host));
|
||||||
|
@ -139,8 +139,11 @@ Dictionary::Ptr ServiceDbObject::GetStatusFields(void) const
|
|||||||
fields->Set("next_notification", DbValue::FromTimestamp(CompatUtility::GetCheckableNotificationNextNotification(service)));
|
fields->Set("next_notification", DbValue::FromTimestamp(CompatUtility::GetCheckableNotificationNextNotification(service)));
|
||||||
fields->Set("no_more_notifications", Empty);
|
fields->Set("no_more_notifications", Empty);
|
||||||
fields->Set("notifications_enabled", CompatUtility::GetCheckableNotificationsEnabled(service));
|
fields->Set("notifications_enabled", CompatUtility::GetCheckableNotificationsEnabled(service));
|
||||||
|
{
|
||||||
|
ObjectLock olock(service);
|
||||||
fields->Set("problem_has_been_acknowledged", CompatUtility::GetCheckableProblemHasBeenAcknowledged(service));
|
fields->Set("problem_has_been_acknowledged", CompatUtility::GetCheckableProblemHasBeenAcknowledged(service));
|
||||||
fields->Set("acknowledgement_type", CompatUtility::GetCheckableAcknowledgementType(service));
|
fields->Set("acknowledgement_type", CompatUtility::GetCheckableAcknowledgementType(service));
|
||||||
|
}
|
||||||
fields->Set("current_notification_number", CompatUtility::GetCheckableNotificationNotificationNumber(service));
|
fields->Set("current_notification_number", CompatUtility::GetCheckableNotificationNotificationNumber(service));
|
||||||
fields->Set("passive_checks_enabled", CompatUtility::GetCheckablePassiveChecksEnabled(service));
|
fields->Set("passive_checks_enabled", CompatUtility::GetCheckablePassiveChecksEnabled(service));
|
||||||
fields->Set("active_checks_enabled", CompatUtility::GetCheckableActiveChecksEnabled(service));
|
fields->Set("active_checks_enabled", CompatUtility::GetCheckableActiveChecksEnabled(service));
|
||||||
|
@ -628,8 +628,6 @@ void IdoMysqlConnection::InternalExecuteQuery(const DbQuery& query, DbQueryType
|
|||||||
hasid = GetConfigUpdate(query.Object);
|
hasid = GetConfigUpdate(query.Object);
|
||||||
else if (query.StatusUpdate)
|
else if (query.StatusUpdate)
|
||||||
hasid = GetStatusUpdate(query.Object);
|
hasid = GetStatusUpdate(query.Object);
|
||||||
else
|
|
||||||
ASSERT(!"Invalid query flags.");
|
|
||||||
|
|
||||||
if (!hasid)
|
if (!hasid)
|
||||||
upsert = true;
|
upsert = true;
|
||||||
@ -703,14 +701,12 @@ void IdoMysqlConnection::InternalExecuteQuery(const DbQuery& query, DbQueryType
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query.Object) {
|
if (type == DbQueryInsert && query.Object) {
|
||||||
if (query.ConfigUpdate)
|
if (query.ConfigUpdate) {
|
||||||
SetConfigUpdate(query.Object, true);
|
|
||||||
else if (query.StatusUpdate)
|
|
||||||
SetStatusUpdate(query.Object, true);
|
|
||||||
|
|
||||||
if (type == DbQueryInsert && query.ConfigUpdate)
|
|
||||||
SetInsertID(query.Object, GetLastInsertID());
|
SetInsertID(query.Object, GetLastInsertID());
|
||||||
|
SetConfigUpdate(query.Object, true);
|
||||||
|
} else if (query.StatusUpdate)
|
||||||
|
SetStatusUpdate(query.Object, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == DbQueryInsert && query.Table == "notifications" && query.NotificationObject) { // FIXME remove hardcoded table name
|
if (type == DbQueryInsert && query.Table == "notifications" && query.NotificationObject) { // FIXME remove hardcoded table name
|
||||||
|
@ -698,20 +698,18 @@ void IdoPgsqlConnection::InternalExecuteQuery(const DbQuery& query, DbQueryType
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query.Object) {
|
if (type == DbQueryInsert && query.Object) {
|
||||||
if (query.ConfigUpdate)
|
if (query.ConfigUpdate) {
|
||||||
SetConfigUpdate(query.Object, true);
|
|
||||||
else if (query.StatusUpdate)
|
|
||||||
SetStatusUpdate(query.Object, true);
|
|
||||||
|
|
||||||
if (type == DbQueryInsert && query.ConfigUpdate) {
|
|
||||||
String idField = query.IdColumn;
|
String idField = query.IdColumn;
|
||||||
|
|
||||||
if (idField.IsEmpty())
|
if (idField.IsEmpty())
|
||||||
idField = query.Table.SubStr(0, query.Table.GetLength() - 1) + "_id";
|
idField = query.Table.SubStr(0, query.Table.GetLength() - 1) + "_id";
|
||||||
|
|
||||||
SetInsertID(query.Object, GetSequenceValue(GetTablePrefix() + query.Table, idField));
|
SetInsertID(query.Object, GetSequenceValue(GetTablePrefix() + query.Table, idField));
|
||||||
}
|
|
||||||
|
SetConfigUpdate(query.Object, true);
|
||||||
|
} else if (query.StatusUpdate)
|
||||||
|
SetStatusUpdate(query.Object, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == DbQueryInsert && query.Table == "notifications" && query.NotificationObject) { // FIXME remove hardcoded table name
|
if (type == DbQueryInsert && query.Table == "notifications" && query.NotificationObject) { // FIXME remove hardcoded table name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user