Icinga DB: set value in milliseconds for program_start in stats/heartbeat

This commit is contained in:
Julian Brost 2021-09-10 17:47:44 +02:00
parent 4c5f9db982
commit e46d83b6be
1 changed files with 7 additions and 5 deletions

View File

@ -1,6 +1,7 @@
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
#include "icingadb/icingadb.hpp"
#include "base/application.hpp"
#include "base/json.hpp"
#include "base/logger.hpp"
#include "base/serializer.hpp"
@ -38,13 +39,14 @@ Dictionary::Ptr IcingaDB::GetStats()
}));
}
typedef Dictionary::Ptr DP;
DP app = DP(DP(DP(stats->Get("IcingaApplication"))->Get("status"))->Get("icingaapplication"))->Get("app");
app->Set("program_start", TimestampToMilliseconds(Application::GetStartTime()));
auto localEndpoint (Endpoint::GetLocalEndpoint());
if (localEndpoint) {
typedef Dictionary::Ptr DP;
DP(DP(DP(DP(stats->Get("IcingaApplication"))->Get("status"))->Get("icingaapplication"))->Get("app"))
->Set("endpoint_id", GetObjectIdentifier(localEndpoint));
app->Set("endpoint_id", GetObjectIdentifier(localEndpoint));
}
return stats;