Get string representation of endpoint version

Create a new function with which to get a string representation of
that endpoints icinga version.
This commit is contained in:
William Calliari 2025-11-27 09:34:44 +01:00 committed by Johannes Schmidt
parent c0bf592ec9
commit 7bc50d5aa7
2 changed files with 11 additions and 2 deletions

View file

@ -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);
}

View file

@ -61,6 +61,8 @@ public:
double GetSecondsProcessingMessages() const override;
String GetIcingaVersionString() const;
protected:
void OnAllConfigLoaded() override;