From dae7bf4657895ba1283cdd56c1a7d7c836681aa3 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 28 Sep 2022 14:49:04 +0200 Subject: [PATCH] Macro: Log the object where a macro is not found fixes #3759 --- modules/monitoring/library/Monitoring/Object/Macro.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/library/Monitoring/Object/Macro.php b/modules/monitoring/library/Monitoring/Object/Macro.php index 15721eadf..3f67154bc 100644 --- a/modules/monitoring/library/Monitoring/Object/Macro.php +++ b/modules/monitoring/library/Monitoring/Object/Macro.php @@ -68,8 +68,13 @@ class Macro try { $value = $object->$macro; } catch (Exception $e) { + $objectName = $object->getName(); + if ($object instanceof Service) { + $objectName = $object->getHost()->getName() . '!' . $objectName; + } + $value = null; - Logger::debug('Unable to resolve macro "%s". An error occured: %s', $macro, $e); + Logger::debug('Unable to resolve macro "%s" on object "%s". An error occured: %s', $macro, $objectName, $e); } return $value !== null ? $value : $macro;