Merge pull request #8998 from Icinga/bugfix/icingadb-program-start-milliseconds

Icinga DB: set value in milliseconds for program_start in stats/heartbeat
This commit is contained in:
Julian Brost 2021-11-08 18:18:19 +01:00 committed by GitHub
commit 848f1ae167
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;