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