mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-28 08:04:14 +02:00
ido: Implement support for runtimevariables.
This commit is contained in:
parent
17aedad7a7
commit
f65aa51177
@ -60,6 +60,17 @@ String DbConnection::GetTablePrefix(void) const
|
|||||||
return m_TablePrefix;
|
return m_TablePrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DbConnection::InsertRuntimeVariable(const String& key, const Value& value)
|
||||||
|
{
|
||||||
|
DbQuery query;
|
||||||
|
|
||||||
|
query.Fields = boost::make_shared<Dictionary>();
|
||||||
|
query.Fields->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||||
|
query.Fields->Set("varname", key);
|
||||||
|
query.Fields->Set("varvalue", value);
|
||||||
|
DbObject::OnQuery(query);
|
||||||
|
}
|
||||||
|
|
||||||
void DbConnection::ProgramStatusHandler(void)
|
void DbConnection::ProgramStatusHandler(void)
|
||||||
{
|
{
|
||||||
DbQuery query1;
|
DbQuery query1;
|
||||||
@ -89,6 +100,18 @@ void DbConnection::ProgramStatusHandler(void)
|
|||||||
query2.Fields->Set("failure_prediction_enabled", 1);
|
query2.Fields->Set("failure_prediction_enabled", 1);
|
||||||
query2.Fields->Set("process_performance_data", 1);
|
query2.Fields->Set("process_performance_data", 1);
|
||||||
DbObject::OnQuery(query2);
|
DbObject::OnQuery(query2);
|
||||||
|
|
||||||
|
DbQuery query3;
|
||||||
|
query3.Table = "runtimevariables";
|
||||||
|
query1.Type = DbQueryDelete;
|
||||||
|
query1.WhereCriteria = boost::make_shared<Dictionary>();
|
||||||
|
query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||||
|
DbObject::OnQuery(query1);
|
||||||
|
|
||||||
|
InsertRuntimeVariable("total_services", DynamicType::GetObjects("Service").size());
|
||||||
|
InsertRuntimeVariable("total_scheduled_services", DynamicType::GetObjects("Service").size());
|
||||||
|
InsertRuntimeVariable("total_hosts", DynamicType::GetObjects("Host").size());
|
||||||
|
InsertRuntimeVariable("total_scheduled_hosts", DynamicType::GetObjects("Host").size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DbConnection::SetObjectID(const DbObject::Ptr& dbobj, const DbReference& dbref)
|
void DbConnection::SetObjectID(const DbObject::Ptr& dbobj, const DbReference& dbref)
|
||||||
|
@ -74,6 +74,7 @@ private:
|
|||||||
std::set<DbObject::Ptr> m_StatusUpdates;
|
std::set<DbObject::Ptr> m_StatusUpdates;
|
||||||
static Timer::Ptr m_ProgramStatusTimer;
|
static Timer::Ptr m_ProgramStatusTimer;
|
||||||
|
|
||||||
|
static void InsertRuntimeVariable(const String& key, const Value& value);
|
||||||
static void ProgramStatusHandler(void);
|
static void ProgramStatusHandler(void);
|
||||||
|
|
||||||
friend class DbType;
|
friend class DbType;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user