From d4a08f47ecb34b2b8fd304acbded726a1857b984 Mon Sep 17 00:00:00 2001 From: Manas Singh <00manassingh00@gmail.com> Date: Wed, 29 Apr 2026 07:11:31 +0530 Subject: [PATCH 1/4] docs: clarify OTLPMetricsWriter unavailability on Debian 11 and Ubuntu 22.04 --- doc/02-installation.md | 7 +++++++ doc/09-object-types.md | 6 ++++++ doc/14-features.md | 19 +++++++++++++++++++ doc/16-upgrading-icinga-2.md | 6 ++++++ 4 files changed, 38 insertions(+) diff --git a/doc/02-installation.md b/doc/02-installation.md index d369f5111b7..e760541670e 100644 --- a/doc/02-installation.md +++ b/doc/02-installation.md @@ -197,6 +197,13 @@ with `root` permissions unless noted otherwise. ```bash apt install icinga2 ``` + +!!! info + + On Debian 11 and Ubuntu 22.04, the official Icinga 2 packages currently do **not** + provide the `otlpmetrics` feature (`OTLPMetricsWriter`). These package builds disable + OpenTelemetry support because the default Protobuf compiler version in those distributions + is too old for the required OpenTelemetry code generation. diff --git a/doc/09-object-types.md b/doc/09-object-types.md index 3fe29702f2d..26b3f4ed47f 100644 --- a/doc/09-object-types.md +++ b/doc/09-object-types.md @@ -1878,6 +1878,12 @@ or any other OTLP-compatible backend that accepts OTLP data over HTTP. This conf [otlpmetrics feature](14-features.md#otlpmetrics-writer). You can find more information about OpenTelemetry and OTLP on the [OpenTelemetry website](https://opentelemetry.io/). +!!! info + + The official package builds for Debian 11 and Ubuntu 22.04 do not include this object type. + These builds disable OpenTelemetry support (`ICINGA2_WITH_OPENTELEMETRY=OFF`) because the + default Protobuf compiler version is too old for the required code generation. + A basic copy and pastable example configuration is shown below: ``` diff --git a/doc/14-features.md b/doc/14-features.md index c8c85419473..cc6afc2ef4f 100644 --- a/doc/14-features.md +++ b/doc/14-features.md @@ -663,6 +663,25 @@ In order to enable this feature, you can use the following command: icinga2 feature enable otlpmetrics ``` +!!! info + + **Package availability note (Debian 11 / Ubuntu 22.04):** + The official Icinga 2 packages for Debian 11 and Ubuntu 22.04 are built with + `-DICINGA2_WITH_OPENTELEMETRY=OFF`, because the default Protobuf compiler in these + distributions is too old for the OpenTelemetry code generation used by Icinga 2. + As a result, the `otlpmetrics` feature (and `OTLPMetricsWriter` type) is not available + in those package builds. + + You can verify this on a node with: + + ```bash + icinga2 feature list | grep otlpmetrics + ``` + + If you need `OTLPMetricsWriter` on these platforms, use one of the following: + 1. Build Icinga 2 from source with a newer Protobuf toolchain and `ICINGA2_WITH_OPENTELEMETRY=ON`. + 2. Use a newer distribution release where package dependencies satisfy the OpenTelemetry build requirements. + By default, the OTLPMetrics Writer expects the OpenTelemetry Collector or any other OTLP HTTP receiver to listen at `127.0.0.1` on port `4318` but most of the third-party backends use their own ports, so you may need to adjust the configuration accordingly. Additionally, the `metrics_endpoint` can vary based on the backend you are using. diff --git a/doc/16-upgrading-icinga-2.md b/doc/16-upgrading-icinga-2.md index ee67e0a82e3..ec7afe55f77 100644 --- a/doc/16-upgrading-icinga-2.md +++ b/doc/16-upgrading-icinga-2.md @@ -16,6 +16,12 @@ ElasticsearchWriter is deprecated in v2.16 and will be removed in v2.18. In case we suggest migrating to the new OTLPMetricsWriter as a replacement. The index data structure in Elasticsearch will be different though, so any third-party tools working with that data will need to be adapted as well. +!!! info + + The official Icinga 2 packages for Debian 11 and Ubuntu 22.04 are currently built without + OpenTelemetry support (`ICINGA2_WITH_OPENTELEMETRY=OFF`), so `OTLPMetricsWriter` is not + available there unless you build Icinga 2 with a newer Protobuf toolchain. + ### Deprecation of user-defined DSL Namespaces If you were previously using constructs like `namespace my_utils { ... }` in your config, we suggest From f795b6cc6b17947f84fed51316edf3e80feac59c Mon Sep 17 00:00:00 2001 From: Manas Singh <00manassingh00@gmail.com> Date: Wed, 29 Apr 2026 21:50:05 +0530 Subject: [PATCH 2/4] docs: note OTLP metrics package limitation on Debian 11 and Ubuntu 22.04 --- doc/02-installation.md | 6 ------ doc/14-features.md | 4 ---- 2 files changed, 10 deletions(-) diff --git a/doc/02-installation.md b/doc/02-installation.md index e760541670e..635f17771cf 100644 --- a/doc/02-installation.md +++ b/doc/02-installation.md @@ -198,12 +198,6 @@ with `root` permissions unless noted otherwise. apt install icinga2 ``` -!!! info - - On Debian 11 and Ubuntu 22.04, the official Icinga 2 packages currently do **not** - provide the `otlpmetrics` feature (`OTLPMetricsWriter`). These package builds disable - OpenTelemetry support because the default Protobuf compiler version in those distributions - is too old for the required OpenTelemetry code generation. diff --git a/doc/14-features.md b/doc/14-features.md index cc6afc2ef4f..1d9b9e931ae 100644 --- a/doc/14-features.md +++ b/doc/14-features.md @@ -678,10 +678,6 @@ icinga2 feature enable otlpmetrics icinga2 feature list | grep otlpmetrics ``` - If you need `OTLPMetricsWriter` on these platforms, use one of the following: - 1. Build Icinga 2 from source with a newer Protobuf toolchain and `ICINGA2_WITH_OPENTELEMETRY=ON`. - 2. Use a newer distribution release where package dependencies satisfy the OpenTelemetry build requirements. - By default, the OTLPMetrics Writer expects the OpenTelemetry Collector or any other OTLP HTTP receiver to listen at `127.0.0.1` on port `4318` but most of the third-party backends use their own ports, so you may need to adjust the configuration accordingly. Additionally, the `metrics_endpoint` can vary based on the backend you are using. From 1572e885025e71c1d35ca1433dc0c5858a60be48 Mon Sep 17 00:00:00 2001 From: Manas Singh <00manassingh00@gmail.com> Date: Thu, 30 Apr 2026 20:48:04 +0530 Subject: [PATCH 3/4] docs: note OTLP metrics package limitation on Debian 11 and Ubuntu 22.04 and Amazon Linux 2 --- AUTHORS | 1 + doc/02-installation.md | 1 - doc/09-object-types.md | 2 +- doc/14-features.md | 4 ++-- doc/16-upgrading-icinga-2.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/AUTHORS b/AUTHORS index 32938a9800a..74c88cd1561 100644 --- a/AUTHORS +++ b/AUTHORS @@ -175,6 +175,7 @@ Maciej Dems Magnus Bäck Maik Stuebner Malte Rabenseifner +Manas Singh <00manassingh00@gmail.com> Manuel Reiter Marc Rupprecht Marcus van Dam diff --git a/doc/02-installation.md b/doc/02-installation.md index 635f17771cf..d369f5111b7 100644 --- a/doc/02-installation.md +++ b/doc/02-installation.md @@ -197,7 +197,6 @@ with `root` permissions unless noted otherwise. ```bash apt install icinga2 ``` - diff --git a/doc/09-object-types.md b/doc/09-object-types.md index 26b3f4ed47f..ca45194ac59 100644 --- a/doc/09-object-types.md +++ b/doc/09-object-types.md @@ -1880,7 +1880,7 @@ on the [OpenTelemetry website](https://opentelemetry.io/). !!! info - The official package builds for Debian 11 and Ubuntu 22.04 do not include this object type. + The official package builds for Debian 11, Ubuntu 22.04 and Amazon Linux 2 do not include this object type. These builds disable OpenTelemetry support (`ICINGA2_WITH_OPENTELEMETRY=OFF`) because the default Protobuf compiler version is too old for the required code generation. diff --git a/doc/14-features.md b/doc/14-features.md index 1d9b9e931ae..69e18420da3 100644 --- a/doc/14-features.md +++ b/doc/14-features.md @@ -665,8 +665,8 @@ icinga2 feature enable otlpmetrics !!! info - **Package availability note (Debian 11 / Ubuntu 22.04):** - The official Icinga 2 packages for Debian 11 and Ubuntu 22.04 are built with + **Package availability note (Debian 11 / Ubuntu 22.04 / Amazon Linux 2):** + The official Icinga 2 packages for Debian 11, Ubuntu 22.04 and Amazon Linux 2 are built with `-DICINGA2_WITH_OPENTELEMETRY=OFF`, because the default Protobuf compiler in these distributions is too old for the OpenTelemetry code generation used by Icinga 2. As a result, the `otlpmetrics` feature (and `OTLPMetricsWriter` type) is not available diff --git a/doc/16-upgrading-icinga-2.md b/doc/16-upgrading-icinga-2.md index ec7afe55f77..dbd9567efbb 100644 --- a/doc/16-upgrading-icinga-2.md +++ b/doc/16-upgrading-icinga-2.md @@ -18,7 +18,7 @@ different though, so any third-party tools working with that data will need to b !!! info - The official Icinga 2 packages for Debian 11 and Ubuntu 22.04 are currently built without + The official Icinga 2 packages for Debian 11, Ubuntu 22.04 and Amazon Linux 2 are currently built without OpenTelemetry support (`ICINGA2_WITH_OPENTELEMETRY=OFF`), so `OTLPMetricsWriter` is not available there unless you build Icinga 2 with a newer Protobuf toolchain. From 6b72dba228d00061d949f1ce9b0f76d635bd5f27 Mon Sep 17 00:00:00 2001 From: Manas Singh <00manassingh00@gmail.com> Date: Wed, 6 May 2026 02:33:17 +0530 Subject: [PATCH 4/4] icingadb: use object identifiers for state history event IDs --- lib/icingadb/icingadb-objects.cpp | 2 +- lib/icingadb/icingadb-utility.cpp | 2 +- test/CMakeLists.txt | 1 + test/icingadb-eventid.cpp | 22 ++++++++++++++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 test/icingadb-eventid.cpp diff --git a/lib/icingadb/icingadb-objects.cpp b/lib/icingadb/icingadb-objects.cpp index c5dc084c0c8..b0aa6ffd0ec 100644 --- a/lib/icingadb/icingadb-objects.cpp +++ b/lib/icingadb/icingadb-objects.cpp @@ -1905,7 +1905,7 @@ void IcingaDB::SendStateChange(const ConfigObject::Ptr& object, const CheckResul auto eventTime (cr->GetExecutionEnd()); auto eventTs (TimestampToMilliseconds(eventTime)); - Array::Ptr rawId = new Array({m_EnvironmentId, object->GetName()}); + Array::Ptr rawId = new Array({m_EnvironmentId, GetObjectIdentifier(object)}); rawId->Add(eventTs); RedisConnection::Query xAdd ({ diff --git a/lib/icingadb/icingadb-utility.cpp b/lib/icingadb/icingadb-utility.cpp index 74dc9afe732..59be32f470e 100644 --- a/lib/icingadb/icingadb-utility.cpp +++ b/lib/icingadb/icingadb-utility.cpp @@ -92,7 +92,7 @@ String IcingaDB::GetObjectIdentifier(const ConfigObject::Ptr& object) */ String IcingaDB::CalcEventID(const char* eventType, const ConfigObject::Ptr& object, double eventTime, NotificationType nt) { - Array::Ptr rawId = new Array({object->GetName()}); + Array::Ptr rawId = new Array({GetObjectIdentifier(object)}); rawId->Insert(0, m_EnvironmentId); rawId->Insert(1, eventType); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 94296c38bd6..73ab8142bc3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -61,6 +61,7 @@ if(ICINGA2_WITH_PGSQL) endif() if(ICINGA2_WITH_ICINGADB) + list(APPEND types_test_SOURCES icingadb-eventid.cpp) list(APPEND types_test_SOURCES $) endif() diff --git a/test/icingadb-eventid.cpp b/test/icingadb-eventid.cpp new file mode 100644 index 00000000000..9ab235e890c --- /dev/null +++ b/test/icingadb-eventid.cpp @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: 2012 Icinga GmbH +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "icingadb/icingadb.hpp" +#include "icinga/host.hpp" +#include + +using namespace icinga; + +BOOST_AUTO_TEST_CASE(calc_event_id_uses_object_identifier) +{ + Host::Ptr host = new Host(); + host->SetName("master01"); + + host->SetIcingadbIdentifier("id-a"); + auto first = IcingaDB::CalcEventID("state_change", host, 1710000000.123); + + host->SetIcingadbIdentifier("id-b"); + auto second = IcingaDB::CalcEventID("state_change", host, 1710000000.123); + + BOOST_CHECK_NE(first, second); +}