From 7bc50d5aa784b641c59034feac2bef7f4cc95083 Mon Sep 17 00:00:00 2001 From: William Calliari <42240136+w1ll-i-code@users.noreply.github.com> Date: Thu, 27 Nov 2025 09:34:44 +0100 Subject: [PATCH] Get string representation of endpoint version Create a new function with which to get a string representation of that endpoints icinga version. --- lib/remote/endpoint.cpp | 11 +++++++++-- lib/remote/endpoint.hpp | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/remote/endpoint.cpp b/lib/remote/endpoint.cpp index 751f89539..32b109f40 100644 --- a/lib/remote/endpoint.cpp +++ b/lib/remote/endpoint.cpp @@ -6,10 +6,8 @@ #include "remote/apilistener.hpp" #include "remote/jsonrpcconnection.hpp" #include "remote/zone.hpp" -#include "base/configtype.hpp" #include "base/utility.hpp" #include "base/exception.hpp" -#include "base/convert.hpp" using namespace icinga; @@ -172,3 +170,12 @@ double Endpoint::GetSecondsProcessingMessages() const { return m_InputProcessingTime; } + +String Endpoint::GetIcingaVersionString() const { + unsigned long version = GetIcingaVersion(); + auto bugfix = version % 100; + version /= 100; + auto minor = version % 100; + auto major = version / 100; + return String() + std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(bugfix); +} diff --git a/lib/remote/endpoint.hpp b/lib/remote/endpoint.hpp index 0cd015bf9..f59a03a46 100644 --- a/lib/remote/endpoint.hpp +++ b/lib/remote/endpoint.hpp @@ -61,6 +61,8 @@ public: double GetSecondsProcessingMessages() const override; + String GetIcingaVersionString() const; + protected: void OnAllConfigLoaded() override;