Skip to content

Commit

Permalink
event|host|service: Allow to configure pluginoutput limit
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Jul 24, 2024
1 parent 092dca7 commit 9df7df7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions library/Icingadb/Widget/Detail/EventDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion library/Icingadb/Widget/Detail/ObjectDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 9df7df7

Please sign in to comment.