diff --git a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php
index 4a787d309..37d1d48d7 100644
--- a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php
+++ b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php
@@ -3,6 +3,7 @@
 
 namespace Icinga\Module\Monitoring\Object;
 
+use stdClass;
 use InvalidArgumentException;
 use Icinga\Application\Config;
 use Icinga\Data\Filter\Filter;
@@ -456,18 +457,34 @@ abstract class MonitoredObject implements Filterable
             $customvars = $this->hostVariables;
         }
 
-        $this->customvars = array();
-        foreach ($customvars as $name => $value) {
-            if ($blacklistPattern && preg_match($blacklistPattern, $name)) {
-                $this->customvars[$name] = '***';
-            } else {
-                $this->customvars[$name] = $value;
-            }
-        }
+        $this->customvars = $this->obfuscateCustomVars($customvars, $blacklistPattern);
 
         return $this;
     }
 
+    /**
+     * Obfuscate custom variables recursively for $this->customvars.
+     *
+     * @param stdClass|array    $customvars         The custom variables to obfuscate
+     * @param string            $blacklistPattern   Which custom variables to obfuscate
+     *
+     * @return stdClass|array                       The obfuscated custom variables
+     */
+    protected function obfuscateCustomVars($customvars, $blacklistPattern)
+    {
+        $obfuscatedCustomVars = array();
+        foreach ($customvars as $name => $value) {
+            if ($blacklistPattern && preg_match($blacklistPattern, $name)) {
+                $obfuscatedCustomVars[$name] = '***';
+            } else {
+                $obfuscatedCustomVars[$name] = $value instanceof stdClass || is_array($value)
+                    ? $this->obfuscateCustomVars($value, $blacklistPattern)
+                    : $value;
+            }
+        }
+        return $customvars instanceof stdClass ? (object) $obfuscatedCustomVars : $obfuscatedCustomVars;
+    }
+
     /**
      * Fetch the host custom variables related to this object
      *