[pkg-nagios-changes] [Git][nagios-team/icinga2][master] 4 commits: New upstream version 2.14.5
Bas Couwenberg (@sebastic)
gitlab at salsa.debian.org
Thu Feb 6 05:00:27 GMT 2025
Bas Couwenberg pushed to branch master at Debian Nagios Maintainer Group / icinga2
Commits:
22348650 by Bas Couwenberg at 2025-02-06T05:43:42+01:00
New upstream version 2.14.5
- - - - -
eda1f61f by Bas Couwenberg at 2025-02-06T05:44:11+01:00
Update upstream source from tag 'upstream/2.14.5'
Update to upstream version '2.14.5'
with Debian dir 36c4119f3501e5c13967ca4d445a45d78ae1f14a
- - - - -
3514c589 by Bas Couwenberg at 2025-02-06T05:44:28+01:00
New upstream release.
- - - - -
d89add7c by Bas Couwenberg at 2025-02-06T05:45:33+01:00
Set distribution to unstable.
- - - - -
13 changed files:
- AUTHORS
- CHANGELOG.md
- ICINGA2_VERSION
- debian/changelog
- doc/02-installation.md
- doc/03-monitoring-basics.md
- doc/21-development.md
- doc/23-migrating-from-icinga-1x.md
- lib/base/perfdatavalue.cpp
- lib/remote/jsonrpcconnection-pki.cpp
- test/CMakeLists.txt
- test/base-utility.cpp
- test/icinga-perfdata.cpp
Changes:
=====================================
AUTHORS
=====================================
@@ -21,6 +21,7 @@ Andres Ivanov <andres at andres.wtf>
Andrew Jaffie <ajaffie at gmail.com>
Andrew Meyer <ameyer+secure at nodnetwork.org>
Andy Grunwald <andygrunwald at gmail.com>
+Angel Roman <angel.r.roman77 at gmail.com>
Ant1x <37016240+Ant1x at users.noreply.github.com>
Arnd Hannemann <arnd at arndnet.de>
Assaf Flatto <assaf at aikilinux.com>
@@ -163,6 +164,7 @@ Luca Lesinigo <luca at lm-net.it>
Lucas Bremgartner <breml at users.noreply.github.com>
Lucas Fairchild-Madar <lucas.madar at gmail.com>
Luiz Amaral <luiz.amaral at innogames.com>
+Maciej Dems <maciej.dems at p.lodz.pl>
Magnus Bäck <magnus at noun.se>
Maik Stuebner <maik at stuebner.info>
Malte Rabenseifner <mail at malte-rabenseifner.de>
=====================================
CHANGELOG.md
=====================================
@@ -7,6 +7,27 @@ documentation before upgrading to a new release.
Released closed milestones can be found on [GitHub](https://github.com/Icinga/icinga2/milestones?state=closed).
+## 2.14.5 (2025-02-06)
+
+This release fixes a regression introduced in 2.14.4 that caused the `icinga2 node setup`,
+`icinga2 node wizard`, and `icinga2 pki request` commands to fail if a certificate was
+requested from a node that has to forward the request to another node for signing.
+Additionally, it fixes a small bug in the performance data normalization and includes
+various documentation improvements.
+
+### Bug Fixes
+
+* Don't close anonymous connections before sending the response for a certificate request #10337
+* Performance data: Don't discard min/max values even if crit/warn thresholds aren’t given #10339
+* Fix a failing test case on systems `time_t` is only 32 bits #10343
+
+### Documentation
+
+* Document the -X option for the mail-host-notification and mail-service-notification commands #10335
+* Include Nagios in the migration docs #10324
+* Remove RHEL 7 from installation instructions #10334
+* Add instructions for installing build dependencies on Windows Server #10336
+
## 2.14.4 (2025-01-23)
This bugfix release is focused on improving HA cluster stability and easing
=====================================
ICINGA2_VERSION
=====================================
@@ -1,2 +1,2 @@
-Version: 2.14.4
+Version: 2.14.5
Revision: 1
=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+icinga2 (2.14.5-1) unstable; urgency=medium
+
+ * Team upload.
+ * New upstream release.
+
+ -- Bas Couwenberg <sebastic at debian.org> Thu, 06 Feb 2025 05:45:24 +0100
+
icinga2 (2.14.4-1) unstable; urgency=medium
* Team upload.
=====================================
doc/02-installation.md
=====================================
@@ -100,16 +100,8 @@ subscription-manager repos --enable "codeready-builder-for-rhel-${OSVER}-${ARCH}
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-${OSVER}.noarch.rpm
```
-#### RHEL 7
-
-```bash
-subscription-manager repos --enable rhel-7-server-optional-rpms
-
-yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
-```
<!-- {% endif %} -->
-
<!-- {% if fedora %} -->
### Fedora Repository <a id="fedora-repository"></a>
@@ -214,14 +206,6 @@ dnf install icinga2
systemctl enable icinga2
systemctl start icinga2
```
-
-#### RHEL 7
-
-```bash
-yum install icinga2
-systemctl enable icinga2
-systemctl start icinga2
-```
<!-- {% endif %} -->
<!-- {% if fedora %} -->
@@ -314,12 +298,6 @@ The packages for RHEL depend on other packages which are distributed as part of
```bash
dnf install nagios-plugins-all
```
-
-#### RHEL 7
-
-```bash
-yum install nagios-plugins-all
-```
<!-- {% endif %} -->
<!-- {% if fedora %} -->
@@ -457,12 +435,6 @@ apt install icingadb-redis
```bash
dnf install icingadb-redis
```
-
-##### RHEL 7
-
-```bash
-yum install icingadb-redis
-```
<!-- {% endif %} -->
<!-- {% if sles %} -->
=====================================
doc/03-monitoring-basics.md
=====================================
@@ -2579,6 +2579,7 @@ information.
`notification_useremail` | **Required.** The notification's recipient(s). Defaults to `$user.email$`.
`notification_hoststate` | **Required.** Current state of host. Defaults to `$host.state$`.
`notification_type` | **Required.** Type of notification. Defaults to `$notification.type$`.
+ `notification_hostnotes` | **Optional.** The host's notes. Defaults to `$host.notes$`.
`notification_address` | **Optional.** The host's IPv4 address. Defaults to `$address$`.
`notification_address6` | **Optional.** The host's IPv6 address. Defaults to `$address6$`.
`notification_author` | **Optional.** Comment author. Defaults to `$notification.author$`.
@@ -2607,6 +2608,8 @@ information.
`notification_useremail` | **Required.** The notification's recipient(s). Defaults to `$user.email$`.
`notification_servicestate` | **Required.** Current state of host. Defaults to `$service.state$`.
`notification_type` | **Required.** Type of notification. Defaults to `$notification.type$`.
+ `notification_hostnotes` | **Optional.** The host's notes. Defaults to `$host.notes$`.
+ `notification_servicenotes` | **Optional.** The service's notes. Defaults to `$service.notes$`.
`notification_address` | **Optional.** The host's IPv4 address. Defaults to `$address$`.
`notification_address6` | **Optional.** The host's IPv6 address. Defaults to `$address6$`.
`notification_author` | **Optional.** Comment author. Defaults to `$notification.author$`.
=====================================
doc/21-development.md
=====================================
@@ -1736,10 +1736,12 @@ and don't care for the details,
1. ensure there are 35 GB free space on C:
2. run the following in an administrative Powershell:
- 1. `Enable-WindowsOptionalFeature -FeatureName "NetFx3" -Online`
- (reboot when asked!)
- 2. `powershell -NoProfile -ExecutionPolicy Bypass -Command "Invoke-Expression (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/Icinga/icinga2/master/doc/win-dev.ps1')"`
- (will take some time)
+ 1. Windows Server only:
+ `Enable-WindowsOptionalFeature -FeatureName NetFx3ServerFeatures -Online`
+ 2. `Enable-WindowsOptionalFeature -FeatureName NetFx3 -Online`
+ (reboot when asked!)
+ 3. `powershell -NoProfile -ExecutionPolicy Bypass -Command "Invoke-Expression (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/Icinga/icinga2/master/doc/win-dev.ps1')"`
+ (will take some time)
This installs everything needed for cloning and building Icinga 2
on the command line (Powershell) as follows:
=====================================
doc/23-migrating-from-icinga-1x.md
=====================================
@@ -1,4 +1,8 @@
-# Migration from Icinga 1.x <a id="migration"></a>
+# Migration from Icinga 1.x or Nagios <a id="migration"></a>
+
+!!! note
+
+ Icinga 1.x was originally a fork of Nagios. The information provided here also applies to Nagios.
## Configuration Migration <a id="configuration-migration"></a>
=====================================
lib/base/perfdatavalue.cpp
=====================================
@@ -363,20 +363,27 @@ String PerfdataValue::Format() const
result << unit;
+ std::string interm(";");
if (!GetWarn().IsEmpty()) {
- result << ";" << Convert::ToString(GetWarn());
+ result << interm << Convert::ToString(GetWarn());
+ interm.clear();
+ }
- if (!GetCrit().IsEmpty()) {
- result << ";" << Convert::ToString(GetCrit());
+ interm += ";";
+ if (!GetCrit().IsEmpty()) {
+ result << interm << Convert::ToString(GetCrit());
+ interm.clear();
+ }
- if (!GetMin().IsEmpty()) {
- result << ";" << Convert::ToString(GetMin());
+ interm += ";";
+ if (!GetMin().IsEmpty()) {
+ result << interm << Convert::ToString(GetMin());
+ interm.clear();
+ }
- if (!GetMax().IsEmpty()) {
- result << ";" << Convert::ToString(GetMax());
- }
- }
- }
+ interm += ";";
+ if (!GetMax().IsEmpty()) {
+ result << interm << Convert::ToString(GetMax());
}
return result.str();
=====================================
lib/remote/jsonrpcconnection-pki.cpp
=====================================
@@ -286,14 +286,6 @@ delayed_request:
Log(LogInformation, "JsonRpcConnection")
<< "Certificate request for CN '" << cn << "' is pending. Waiting for approval.";
- if (origin) {
- auto client (origin->FromClient);
-
- if (client && !client->GetEndpoint()) {
- client->Disconnect();
- }
- }
-
return result;
}
=====================================
test/CMakeLists.txt
=====================================
@@ -207,11 +207,12 @@ add_boost_test(base
icinga_perfdata/normalize
icinga_perfdata/uom
icinga_perfdata/warncritminmax
- icinga_perfdata/ignore_invalid_warn_crit_min_max
+ icinga_perfdata/ignore_warn_crit_ranges
icinga_perfdata/invalid
icinga_perfdata/multi
icinga_perfdata/scientificnotation
icinga_perfdata/parse_edgecases
+ icinga_perfdata/empty_warn_crit_min_max
methods_pluginnotificationtask/truncate_long_output
remote_configpackageutility/ValidateName
remote_url/id_and_path
=====================================
test/base-utility.cpp
=====================================
@@ -183,8 +183,12 @@ BOOST_AUTO_TEST_CASE(FormatDateTime) {
//
// These are expected to result in an error due to the intermediate struct tm not being able to represent these
// timestamps, so localtime_r() returns EOVERFLOW which makes the implementation throw an exception.
- BOOST_CHECK_THROW(Utility::FormatDateTime("%Y", std::nextafter(time_t_limit::min(), 0)), posix_error);
- BOOST_CHECK_THROW(Utility::FormatDateTime("%Y", std::nextafter(time_t_limit::max(), 0)), posix_error);
+ if constexpr (sizeof(time_t) > sizeof(int32_t)) {
+ BOOST_CHECK_THROW(Utility::FormatDateTime("%Y", std::nextafter(time_t_limit::min(), 0)), posix_error);
+ BOOST_CHECK_THROW(Utility::FormatDateTime("%Y", std::nextafter(time_t_limit::max(), 0)), posix_error);
+ } else {
+ BOOST_WARN_MESSAGE(false, "skipping test for struct tm overflow due to 32 bit time_t");
+ }
// Excessive format strings can result in something too large for the buffer, errors out to the empty string.
// Note: both returning the proper result or throwing an exception would be fine too, unfortunately, that's
@@ -205,8 +209,16 @@ BOOST_AUTO_TEST_CASE(FormatDateTime) {
}
// Out of range timestamps.
- BOOST_CHECK_THROW(Utility::FormatDateTime("%Y", std::nextafter(time_t_limit::min(), -double_limit::infinity())), negative_overflow);
- BOOST_CHECK_THROW(Utility::FormatDateTime("%Y", std::nextafter(time_t_limit::max(), +double_limit::infinity())), positive_overflow);
+ //
+ // At the limits of a 64 bit time_t, doubles can no longer represent each integer value, so a simple x+1 or x-1 can
+ // have x as the result, hence std::nextafter() is used to get the next representable value. However, around the
+ // limits of a 32 bit time_t, doubles still can represent decimal places and less than 1 is added or subtracted by
+ // std::nextafter() and casting back to time_t simply results in the limit again, so std::ceil()/std::floor() is
+ // used to round it to the next integer value that is actually out of range.
+ double negative_out_of_range = std::floor(std::nextafter(time_t_limit::min(), -double_limit::infinity()));
+ double positive_out_of_range = std::ceil(std::nextafter(time_t_limit::max(), +double_limit::infinity()));
+ BOOST_CHECK_THROW(Utility::FormatDateTime("%Y", negative_out_of_range), negative_overflow);
+ BOOST_CHECK_THROW(Utility::FormatDateTime("%Y", positive_out_of_range), positive_overflow);
}
BOOST_AUTO_TEST_SUITE_END()
=====================================
test/icinga-perfdata.cpp
=====================================
@@ -11,60 +11,60 @@ BOOST_AUTO_TEST_SUITE(icinga_perfdata)
BOOST_AUTO_TEST_CASE(empty)
{
Array::Ptr pd = PluginUtility::SplitPerfdata("");
- BOOST_CHECK(pd->GetLength() == 0);
+ BOOST_CHECK_EQUAL(pd->GetLength(), 0);
}
BOOST_AUTO_TEST_CASE(simple)
{
PerfdataValue::Ptr pdv = PerfdataValue::Parse("test=123456");
- BOOST_CHECK(pdv->GetLabel() == "test");
- BOOST_CHECK(pdv->GetValue() == 123456);
+ BOOST_CHECK_EQUAL(pdv->GetLabel(), "test");
+ BOOST_CHECK_EQUAL(pdv->GetValue(), 123456);
String str = pdv->Format();
- BOOST_CHECK(str == "test=123456");
+ BOOST_CHECK_EQUAL(str, "test=123456");
}
BOOST_AUTO_TEST_CASE(quotes)
{
Array::Ptr pd = PluginUtility::SplitPerfdata("'hello world'=123456");
- BOOST_CHECK(pd->GetLength() == 1);
-
+ BOOST_CHECK_EQUAL(pd->GetLength(), 1);
+
PerfdataValue::Ptr pdv = PerfdataValue::Parse("'hello world'=123456");
- BOOST_CHECK(pdv->GetLabel() == "hello world");
- BOOST_CHECK(pdv->GetValue() == 123456);
+ BOOST_CHECK_EQUAL(pdv->GetLabel(), "hello world");
+ BOOST_CHECK_EQUAL(pdv->GetValue(), 123456);
}
BOOST_AUTO_TEST_CASE(multiple)
{
Array::Ptr pd = PluginUtility::SplitPerfdata("testA=123456 testB=123456");
- BOOST_CHECK(pd->GetLength() == 2);
+ BOOST_CHECK_EQUAL(pd->GetLength(), 2);
String str = PluginUtility::FormatPerfdata(pd);
- BOOST_CHECK(str == "testA=123456 testB=123456");
+ BOOST_CHECK_EQUAL(str, "testA=123456 testB=123456");
}
BOOST_AUTO_TEST_CASE(multiline)
{
Array::Ptr pd = PluginUtility::SplitPerfdata(" 'testA'=123456 'testB'=123456");
- BOOST_CHECK(pd->GetLength() == 2);
+ BOOST_CHECK_EQUAL(pd->GetLength(), 2);
String str = PluginUtility::FormatPerfdata(pd);
- BOOST_CHECK(str == "testA=123456 testB=123456");
+ BOOST_CHECK_EQUAL(str, "testA=123456 testB=123456");
pd = PluginUtility::SplitPerfdata(" 'testA'=123456 \n'testB'=123456");
- BOOST_CHECK(pd->GetLength() == 2);
+ BOOST_CHECK_EQUAL(pd->GetLength(), 2);
str = PluginUtility::FormatPerfdata(pd);
- BOOST_CHECK(str == "testA=123456 testB=123456");
+ BOOST_CHECK_EQUAL(str, "testA=123456 testB=123456");
}
BOOST_AUTO_TEST_CASE(normalize)
{
Array::Ptr pd = PluginUtility::SplitPerfdata("testA=2m;3;4;1;5 testB=2foobar");
- BOOST_CHECK(pd->GetLength() == 2);
+ BOOST_CHECK_EQUAL(pd->GetLength(), 2);
String str = PluginUtility::FormatPerfdata(pd, true);
- BOOST_CHECK(str == "testA=120s;180;240;60;300 testB=2");
+ BOOST_CHECK_EQUAL(str, "testA=120s;180;240;60;300 testB=2");
}
BOOST_AUTO_TEST_CASE(uom)
@@ -72,219 +72,219 @@ BOOST_AUTO_TEST_CASE(uom)
PerfdataValue::Ptr pv = PerfdataValue::Parse("test=123456B");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 123456);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 123456);
BOOST_CHECK(!pv->GetCounter());
- BOOST_CHECK(pv->GetUnit() == "bytes");
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetMin() == Empty);
- BOOST_CHECK(pv->GetMax() == Empty);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "bytes");
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMax(), Empty);
String str = pv->Format();
- BOOST_CHECK(str == "test=123456B");
+ BOOST_CHECK_EQUAL(str, "test=123456B");
pv = PerfdataValue::Parse("test=1000ms;200;500");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 1);
- BOOST_CHECK(pv->GetUnit() == "seconds");
- BOOST_CHECK(pv->GetWarn() == 0.2);
- BOOST_CHECK(pv->GetCrit() == 0.5);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 1);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "seconds");
+ BOOST_CHECK_EQUAL(pv->GetWarn(), 0.2);
+ BOOST_CHECK_EQUAL(pv->GetCrit(), 0.5);
pv = PerfdataValue::Parse("test=1000ms");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 1);
- BOOST_CHECK(pv->GetUnit() == "seconds");
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetMin() == Empty);
- BOOST_CHECK(pv->GetMax() == Empty);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 1);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "seconds");
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMax(), Empty);
str = pv->Format();
- BOOST_CHECK(str == "test=1s");
+ BOOST_CHECK_EQUAL(str, "test=1s");
pv = PerfdataValue::Parse("test=1kAm");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 60 * 1000);
- BOOST_CHECK(pv->GetUnit() == "ampere-seconds");
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetMin() == Empty);
- BOOST_CHECK(pv->GetMax() == Empty);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 60 * 1000);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "ampere-seconds");
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMax(), Empty);
str = pv->Format();
- BOOST_CHECK(str == "test=60000As");
+ BOOST_CHECK_EQUAL(str, "test=60000As");
pv = PerfdataValue::Parse("test=1MA");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 1000 * 1000);
- BOOST_CHECK(pv->GetUnit() == "amperes");
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetMin() == Empty);
- BOOST_CHECK(pv->GetMax() == Empty);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 1000 * 1000);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "amperes");
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMax(), Empty);
str = pv->Format();
- BOOST_CHECK(str == "test=1000000A");
+ BOOST_CHECK_EQUAL(str, "test=1000000A");
pv = PerfdataValue::Parse("test=1gib");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 1024 * 1024 * 1024);
- BOOST_CHECK(pv->GetUnit() == "bits");
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetMin() == Empty);
- BOOST_CHECK(pv->GetMax() == Empty);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 1024 * 1024 * 1024);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "bits");
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMax(), Empty);
str = pv->Format();
- BOOST_CHECK(str == "test=1073741824b");
+ BOOST_CHECK_EQUAL(str, "test=1073741824b");
pv = PerfdataValue::Parse("test=1dBm");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 1);
- BOOST_CHECK(pv->GetUnit() == "decibel-milliwatts");
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetMin() == Empty);
- BOOST_CHECK(pv->GetMax() == Empty);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 1);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "decibel-milliwatts");
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMax(), Empty);
str = pv->Format();
- BOOST_CHECK(str == "test=1dBm");
+ BOOST_CHECK_EQUAL(str, "test=1dBm");
pv = PerfdataValue::Parse("test=1C");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 1);
- BOOST_CHECK(pv->GetUnit() == "degrees-celsius");
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetMin() == Empty);
- BOOST_CHECK(pv->GetMax() == Empty);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 1);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "degrees-celsius");
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMax(), Empty);
str = pv->Format();
- BOOST_CHECK(str == "test=1C");
+ BOOST_CHECK_EQUAL(str, "test=1C");
pv = PerfdataValue::Parse("test=1F");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 1);
- BOOST_CHECK(pv->GetUnit() == "degrees-fahrenheit");
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetMin() == Empty);
- BOOST_CHECK(pv->GetMax() == Empty);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 1);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "degrees-fahrenheit");
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMax(), Empty);
str = pv->Format();
- BOOST_CHECK(str == "test=1F");
+ BOOST_CHECK_EQUAL(str, "test=1F");
pv = PerfdataValue::Parse("test=1K");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 1);
- BOOST_CHECK(pv->GetUnit() == "degrees-kelvin");
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetMin() == Empty);
- BOOST_CHECK(pv->GetMax() == Empty);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 1);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "degrees-kelvin");
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMax(), Empty);
str = pv->Format();
- BOOST_CHECK(str == "test=1K");
+ BOOST_CHECK_EQUAL(str, "test=1K");
pv = PerfdataValue::Parse("test=1t");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 1000 * 1000);
- BOOST_CHECK(pv->GetUnit() == "grams");
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetMin() == Empty);
- BOOST_CHECK(pv->GetMax() == Empty);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 1000 * 1000);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "grams");
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMax(), Empty);
str = pv->Format();
- BOOST_CHECK(str == "test=1000000g");
+ BOOST_CHECK_EQUAL(str, "test=1000000g");
pv = PerfdataValue::Parse("test=1hl");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 100);
- BOOST_CHECK(pv->GetUnit() == "liters");
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetMin() == Empty);
- BOOST_CHECK(pv->GetMax() == Empty);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 100);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "liters");
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMax(), Empty);
str = pv->Format();
- BOOST_CHECK(str == "test=100l");
+ BOOST_CHECK_EQUAL(str, "test=100l");
pv = PerfdataValue::Parse("test=1lm");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 1);
- BOOST_CHECK(pv->GetUnit() == "lumens");
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetMin() == Empty);
- BOOST_CHECK(pv->GetMax() == Empty);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 1);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "lumens");
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMax(), Empty);
str = pv->Format();
- BOOST_CHECK(str == "test=1lm");
+ BOOST_CHECK_EQUAL(str, "test=1lm");
pv = PerfdataValue::Parse("test=1TO");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 1000.0 * 1000 * 1000 * 1000);
- BOOST_CHECK(pv->GetUnit() == "ohms");
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetMin() == Empty);
- BOOST_CHECK(pv->GetMax() == Empty);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 1000.0 * 1000 * 1000 * 1000);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "ohms");
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMax(), Empty);
str = pv->Format();
- BOOST_CHECK(str == "test=1000000000000O");
+ BOOST_CHECK_EQUAL(str, "test=1000000000000O");
pv = PerfdataValue::Parse("test=1PV");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 1000.0 * 1000 * 1000 * 1000 * 1000);
- BOOST_CHECK(pv->GetUnit() == "volts");
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetMin() == Empty);
- BOOST_CHECK(pv->GetMax() == Empty);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 1000.0 * 1000 * 1000 * 1000 * 1000);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "volts");
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMax(), Empty);
str = pv->Format();
- BOOST_CHECK(str == "test=1000000000000000V");
+ BOOST_CHECK_EQUAL(str, "test=1000000000000000V");
pv = PerfdataValue::Parse("test=1EWh");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 1000.0 * 1000 * 1000 * 1000 * 1000 * 1000);
- BOOST_CHECK(pv->GetUnit() == "watt-hours");
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetMin() == Empty);
- BOOST_CHECK(pv->GetMax() == Empty);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 1000.0 * 1000 * 1000 * 1000 * 1000 * 1000);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "watt-hours");
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMax(), Empty);
str = pv->Format();
- BOOST_CHECK(str == "test=1000000000000000000Wh");
+ BOOST_CHECK_EQUAL(str, "test=1000000000000000000Wh");
pv = PerfdataValue::Parse("test=1000mW");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 1);
- BOOST_CHECK(pv->GetUnit() == "watts");
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetMin() == Empty);
- BOOST_CHECK(pv->GetMax() == Empty);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 1);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "watts");
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMax(), Empty);
str = pv->Format();
- BOOST_CHECK(str == "test=1W");
+ BOOST_CHECK_EQUAL(str, "test=1W");
}
BOOST_AUTO_TEST_CASE(warncritminmax)
@@ -292,28 +292,37 @@ BOOST_AUTO_TEST_CASE(warncritminmax)
PerfdataValue::Ptr pv = PerfdataValue::Parse("test=123456B;1000;2000;3000;4000");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 123456);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 123456);
BOOST_CHECK(!pv->GetCounter());
- BOOST_CHECK(pv->GetUnit() == "bytes");
- BOOST_CHECK(pv->GetWarn() == 1000);
- BOOST_CHECK(pv->GetCrit() == 2000);
- BOOST_CHECK(pv->GetMin() == 3000);
- BOOST_CHECK(pv->GetMax() == 4000);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "bytes");
+ BOOST_CHECK_EQUAL(pv->GetWarn(), 1000);
+ BOOST_CHECK_EQUAL(pv->GetCrit(), 2000);
+ BOOST_CHECK_EQUAL(pv->GetMin(), 3000);
+ BOOST_CHECK_EQUAL(pv->GetMax(), 4000);
- BOOST_CHECK(pv->Format() == "test=123456B;1000;2000;3000;4000");
+ BOOST_CHECK_EQUAL(pv->Format(), "test=123456B;1000;2000;3000;4000");
}
-BOOST_AUTO_TEST_CASE(ignore_invalid_warn_crit_min_max)
+BOOST_AUTO_TEST_CASE(ignore_warn_crit_ranges)
{
PerfdataValue::Ptr pv = PerfdataValue::Parse("test=123456;1000:2000;0:3000;3000;4000");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 123456);
- BOOST_CHECK(pv->GetWarn() == Empty);
- BOOST_CHECK(pv->GetCrit() == Empty);
- BOOST_CHECK(pv->GetMin() == 3000);
- BOOST_CHECK(pv->GetMax() == 4000);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 123456);
+ BOOST_CHECK_EQUAL(pv->GetWarn(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetCrit(), Empty);
+ BOOST_CHECK_EQUAL(pv->GetMin(), 3000);
+ BOOST_CHECK_EQUAL(pv->GetMax(), 4000);
+
+ BOOST_CHECK_EQUAL(pv->Format(), "test=123456;;;3000;4000");
+}
- BOOST_CHECK(pv->Format() == "test=123456");
+BOOST_AUTO_TEST_CASE(empty_warn_crit_min_max)
+{
+ Array::Ptr pd = PluginUtility::SplitPerfdata("testA=5;;7;1;9 testB=5;7;;1;9 testC=5;;;1;9 testD=2m;;;1 testE=5;;7;;");
+ BOOST_CHECK_EQUAL(pd->GetLength(), 5);
+
+ String str = PluginUtility::FormatPerfdata(pd, true);
+ BOOST_CHECK_EQUAL(str, "testA=5;;7;1;9 testB=5;7;;1;9 testC=5;;;1;9 testD=120s;;;60 testE=5;;7");
}
BOOST_AUTO_TEST_CASE(invalid)
@@ -332,57 +341,57 @@ BOOST_AUTO_TEST_CASE(invalid)
BOOST_AUTO_TEST_CASE(multi)
{
Array::Ptr pd = PluginUtility::SplitPerfdata("test::a=3 b=4");
- BOOST_CHECK(pd->Get(0) == "test::a=3");
- BOOST_CHECK(pd->Get(1) == "test::b=4");
+ BOOST_CHECK_EQUAL(pd->Get(0), "test::a=3");
+ BOOST_CHECK_EQUAL(pd->Get(1), "test::b=4");
}
BOOST_AUTO_TEST_CASE(scientificnotation)
{
PerfdataValue::Ptr pdv = PerfdataValue::Parse("test=1.1e+1");
- BOOST_CHECK(pdv->GetLabel() == "test");
- BOOST_CHECK(pdv->GetValue() == 11);
+ BOOST_CHECK_EQUAL(pdv->GetLabel(), "test");
+ BOOST_CHECK_EQUAL(pdv->GetValue(), 11);
String str = pdv->Format();
- BOOST_CHECK(str == "test=11");
+ BOOST_CHECK_EQUAL(str, "test=11");
pdv = PerfdataValue::Parse("test=1.1e1");
- BOOST_CHECK(pdv->GetLabel() == "test");
- BOOST_CHECK(pdv->GetValue() == 11);
+ BOOST_CHECK_EQUAL(pdv->GetLabel(), "test");
+ BOOST_CHECK_EQUAL(pdv->GetValue(), 11);
str = pdv->Format();
- BOOST_CHECK(str == "test=11");
+ BOOST_CHECK_EQUAL(str, "test=11");
pdv = PerfdataValue::Parse("test=1.1e-1");
- BOOST_CHECK(pdv->GetLabel() == "test");
- BOOST_CHECK(pdv->GetValue() == 0.11);
+ BOOST_CHECK_EQUAL(pdv->GetLabel(), "test");
+ BOOST_CHECK_EQUAL(pdv->GetValue(), 0.11);
str = pdv->Format();
- BOOST_CHECK(str == "test=0.110000");
+ BOOST_CHECK_EQUAL(str, "test=0.110000");
pdv = PerfdataValue::Parse("test=1.1E1");
- BOOST_CHECK(pdv->GetLabel() == "test");
- BOOST_CHECK(pdv->GetValue() == 11);
+ BOOST_CHECK_EQUAL(pdv->GetLabel(), "test");
+ BOOST_CHECK_EQUAL(pdv->GetValue(), 11);
str = pdv->Format();
- BOOST_CHECK(str == "test=11");
+ BOOST_CHECK_EQUAL(str, "test=11");
pdv = PerfdataValue::Parse("test=1.1E-1");
- BOOST_CHECK(pdv->GetLabel() == "test");
- BOOST_CHECK(pdv->GetValue() == 0.11);
+ BOOST_CHECK_EQUAL(pdv->GetLabel(), "test");
+ BOOST_CHECK_EQUAL(pdv->GetValue(), 0.11);
str = pdv->Format();
- BOOST_CHECK(str == "test=0.110000");
+ BOOST_CHECK_EQUAL(str, "test=0.110000");
pdv = PerfdataValue::Parse("test=1.1E-1;1.2e+1;1.3E-1;1.4e-2;1.5E2");
- BOOST_CHECK(pdv->GetLabel() == "test");
- BOOST_CHECK(pdv->GetValue() == 0.11);
- BOOST_CHECK(pdv->GetWarn() == 12);
- BOOST_CHECK(pdv->GetCrit() == 0.13);
- BOOST_CHECK(pdv->GetMin() == 0.014);
- BOOST_CHECK(pdv->GetMax() == 150);
+ BOOST_CHECK_EQUAL(pdv->GetLabel(), "test");
+ BOOST_CHECK_EQUAL(pdv->GetValue(), 0.11);
+ BOOST_CHECK_EQUAL(pdv->GetWarn(), 12);
+ BOOST_CHECK_EQUAL(pdv->GetCrit(), 0.13);
+ BOOST_CHECK_EQUAL(pdv->GetMin(), 0.014);
+ BOOST_CHECK_EQUAL(pdv->GetMax(), 150);
str = pdv->Format();
- BOOST_CHECK(str == "test=0.110000;12;0.130000;0.014000;150");
+ BOOST_CHECK_EQUAL(str, "test=0.110000;12;0.130000;0.014000;150");
}
BOOST_AUTO_TEST_CASE(parse_edgecases)
@@ -390,18 +399,18 @@ BOOST_AUTO_TEST_CASE(parse_edgecases)
// Trailing decimal point
PerfdataValue::Ptr pv = PerfdataValue::Parse("test=23.");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 23.0);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 23.0);
// Leading decimal point
pv = PerfdataValue::Parse("test=.42");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 0.42);
+ BOOST_CHECK_EQUAL(pv->GetValue(), 0.42);
// E both as exponent and unit prefix
pv = PerfdataValue::Parse("test=+1.5E-15EB");
BOOST_CHECK(pv);
- BOOST_CHECK(pv->GetValue() == 1.5e3);
- BOOST_CHECK(pv->GetUnit() == "bytes");
+ BOOST_CHECK_EQUAL(pv->GetValue(), 1.5e3);
+ BOOST_CHECK_EQUAL(pv->GetUnit(), "bytes");
}
BOOST_AUTO_TEST_SUITE_END()
View it on GitLab: https://salsa.debian.org/nagios-team/icinga2/-/compare/68024658f862373ffdec9c43d23d5db0bbf9756a...d89add7c36031ac2cdc422441ea78e3540aab27f
--
View it on GitLab: https://salsa.debian.org/nagios-team/icinga2/-/compare/68024658f862373ffdec9c43d23d5db0bbf9756a...d89add7c36031ac2cdc422441ea78e3540aab27f
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-nagios-changes/attachments/20250206/8ad3e5bf/attachment-0001.htm>
More information about the pkg-nagios-changes
mailing list