MCPcopy Create free account
hub / github.com/Icinga/icinga2 / SendStatusUpdate

Method SendStatusUpdate

lib/db_ido/dbobject.cpp:173–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173void DbObject::SendStatusUpdate()
174{
175 /* status attributes */
176 Dictionary::Ptr fields = GetStatusFields();
177
178 if (!fields)
179 return;
180
181 DbQuery query;
182 query.Table = GetType()->GetTable() + "status";
183 query.Type = DbQueryInsert | DbQueryUpdate;
184 query.Category = DbCatState;
185 query.Fields = fields;
186 query.Fields->Set(GetType()->GetIDColumn(), GetObject());
187
188 /* do not override endpoint_object_id for endpoints & zones */
189 if (query.Table != "endpointstatus" && query.Table != "zonestatus") {
190 String node = IcingaApplication::GetInstance()->GetNodeName();
191
192 Endpoint::Ptr endpoint = Endpoint::GetByName(node);
193 if (endpoint)
194 query.Fields->Set("endpoint_object_id", endpoint);
195 }
196
197 query.Fields->Set("instance_id", 0); /* DbConnection class fills in real ID */
198
199 query.Fields->Set("status_update_time", DbValue::FromTimestamp(Utility::GetTime()));
200 query.WhereCriteria = new Dictionary({
201 { GetType()->GetIDColumn(), GetObject() }
202 });
203 query.Object = this;
204 query.StatusUpdate = true;
205 OnQuery(query);
206
207 m_LastStatusUpdate = Utility::GetTime();
208
209 OnStatusUpdate();
210}
211
212void DbObject::SendVarsConfigUpdateHeavy()
213{

Callers 3

StateChangedHandlerMethod · 0.80
VersionChangedHandlerMethod · 0.80
UpdateObjectMethod · 0.80

Calls 4

GetTableMethod · 0.80
GetIDColumnMethod · 0.80
GetNodeNameMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected