From: Michael Insel Date: Wed, 27 Dec 2017 19:07:56 +0000 (+0100) Subject: Fix for wrong attribute in ITL mongodb CheckCommand X-Git-Tag: v2.9.0~242^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=refs%2Fpull%2F5914%2Fhead;p=icinga2 Fix for wrong attribute in ITL mongodb CheckCommand This corrects the attribute mongodb_address to mongodb_host, if the old attribute is set Icinga will use that and output a Log message to the Log. refs #5817 --- diff --git a/itl/plugins-contrib.d/databases.conf b/itl/plugins-contrib.d/databases.conf index 5b6208657..959b4c9cf 100644 --- a/itl/plugins-contrib.d/databases.conf +++ b/itl/plugins-contrib.d/databases.conf @@ -618,7 +618,7 @@ object CheckCommand "mongodb" { arguments = { "-H" = { - value = "$mongodb_address$" + value = "$mongodb_host$" description = "The hostname you want to connect to" } "-P" = { @@ -688,7 +688,18 @@ object CheckCommand "mongodb" { } } - vars.mongodb_address = "$check_address$" + vars.mongodb_host = {{ + var mongodbAddress = macro("$mongodb_address$") + var checkAddress = macro("$check_address$") + + if (mongodbAddress) { + log(LogWarning, "CheckerComponent", "The attribute 'mongodb_address' is deprecated, use 'mongodb_host' instead.") + return mongodbAddress + } else { + return checkAddress + } + }} + vars.mongodb_perfdata = true vars.mongodb_action = "connections" }