2026-01-27 09:06:40 -05:00
|
|
|
// SPDX-FileCopyrightText: 2012 Icinga GmbH <https://icinga.com>
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2018-06-08 05:38:36 -04:00
|
|
|
|
2019-10-29 13:36:16 -04:00
|
|
|
#include "icingadb/icingadb.hpp"
|
2021-09-10 11:47:44 -04:00
|
|
|
#include "base/application.hpp"
|
2018-06-08 05:38:36 -04:00
|
|
|
#include "base/json.hpp"
|
|
|
|
|
#include "base/logger.hpp"
|
|
|
|
|
#include "base/serializer.hpp"
|
|
|
|
|
#include "base/statsfunction.hpp"
|
|
|
|
|
#include "base/convert.hpp"
|
|
|
|
|
|
|
|
|
|
using namespace icinga;
|
|
|
|
|
|
2019-10-29 12:32:29 -04:00
|
|
|
Dictionary::Ptr IcingaDB::GetStats()
|
2018-06-08 05:38:36 -04:00
|
|
|
{
|
2025-03-04 11:34:38 -05:00
|
|
|
Dictionary::Ptr status = new Dictionary();
|
|
|
|
|
IcingaApplication::StatsFunc(status, nullptr);
|
2019-12-02 08:46:10 -05:00
|
|
|
|
2025-03-04 11:34:38 -05:00
|
|
|
Dictionary::Ptr app(Dictionary::Ptr(status->Get("icingaapplication"))->Get("app"));
|
2021-09-10 11:47:44 -04:00
|
|
|
app->Set("program_start", TimestampToMilliseconds(Application::GetStartTime()));
|
2019-12-02 08:46:10 -05:00
|
|
|
|
2025-03-04 11:34:38 -05:00
|
|
|
if (auto localEndpoint(Endpoint::GetLocalEndpoint()); localEndpoint) {
|
2021-09-10 11:47:44 -04:00
|
|
|
app->Set("endpoint_id", GetObjectIdentifier(localEndpoint));
|
2019-12-02 08:46:10 -05:00
|
|
|
}
|
|
|
|
|
|
2025-03-04 11:34:38 -05:00
|
|
|
return new Dictionary{{ "IcingaApplication", new Dictionary{{"status", status}}}};
|
2018-06-08 05:38:36 -04:00
|
|
|
}
|