From 9df7df7c5e12d629c91c2a387dc97632147e4c3b Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 22 Jul 2024 17:20:40 +0200 Subject: [PATCH] event|host|service: Allow to configure pluginoutput limit --- library/Icingadb/Widget/Detail/EventDetail.php | 9 +++++++++ library/Icingadb/Widget/Detail/ObjectDetail.php | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/library/Icingadb/Widget/Detail/EventDetail.php b/library/Icingadb/Widget/Detail/EventDetail.php index aaf76082f..8b9bf99c4 100644 --- a/library/Icingadb/Widget/Detail/EventDetail.php +++ b/library/Icingadb/Widget/Detail/EventDetail.php @@ -6,6 +6,7 @@ use DateTime; use DateTimeZone; +use Icinga\Application\Config; use Icinga\Date\DateFormatter; use Icinga\Module\Icingadb\Common\Auth; use Icinga\Module\Icingadb\Common\Database; @@ -79,6 +80,10 @@ protected function assembleNotificationEvent(NotificationHistory $notification) ->setCommandName($notification->object_type === 'host' ? $this->event->host->checkcommand_name : $this->event->service->checkcommand_name) + ->setCharacterLimit( + Config::module('icingadb') + ->get('settings', 'plugin_output_character_limit', 10000) + ) ); CopyToClipboard::attachTo($notificationText); @@ -191,6 +196,10 @@ protected function assembleStateChangeEvent(StateHistory $stateChange) $commandOutput = new PluginOutputContainer( (new PluginOutput($stateChange->output . "\n" . $stateChange->long_output)) ->setCommandName($commandName) + ->setCharacterLimit( + Config::module('icingadb') + ->get('settings', 'plugin_output_character_limit', 10000) + ) ); CopyToClipboard::attachTo($commandOutput); diff --git a/library/Icingadb/Widget/Detail/ObjectDetail.php b/library/Icingadb/Widget/Detail/ObjectDetail.php index 4ba0e6984..b684980a8 100644 --- a/library/Icingadb/Widget/Detail/ObjectDetail.php +++ b/library/Icingadb/Widget/Detail/ObjectDetail.php @@ -6,6 +6,7 @@ use Exception; use Icinga\Application\ClassLoader; +use Icinga\Application\Config; use Icinga\Application\Hook; use Icinga\Application\Hook\GrapherHook; use Icinga\Application\Icinga; @@ -425,7 +426,10 @@ protected function createPluginOutput(): array } else { $pluginOutput = new PluginOutputContainer( PluginOutput::fromObject($this->object) - ->setCharacterLimit(10000) + ->setCharacterLimit( + Config::module('icingadb') + ->get('settings', 'plugin_output_character_limit', 10000) + ) ); CopyToClipboard::attachTo($pluginOutput); }