]> granicus.if.org Git - icinga2/commitdiff
Fix for wrong attribute in ITL mongodb CheckCommand 5914/head
authorMichael Insel <michael@insel.email>
Wed, 27 Dec 2017 19:07:56 +0000 (20:07 +0100)
committerMichael Insel <michael@insel.email>
Wed, 27 Dec 2017 19:19:39 +0000 (20:19 +0100)
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

itl/plugins-contrib.d/databases.conf

index 5b62086576823fe1a5c9a0c676195690d023947c..959b4c9cf1a1674abb9db1b3db7fc09f0fa2a417 100644 (file)
@@ -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"
 }