Icinga / icingadb-web

Icinga DB Web – UI for Icinga DB – Provides a graphical interface to your Icinga monitoring
GNU General Public License v2.0
67 stars 21 forks source link

Broken history if config objects are not synchronized yet #609

Closed kayuma closed 2 years ago

kayuma commented 2 years ago

Describe the bug

When clicking on History -> Event Overview I get the following stack trace:

Uncaught TypeError: Argument 1 passed to Icinga\Module\Icingadb\Util\PluginOutput::setCommandName() must be of the type string, null given, called in /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Widget/ItemList/BaseHistoryListItem.php on line 125 and defined in /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Util/PluginOutput.php:112 Stack trace:

0 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Widget/ItemList/BaseHistoryListItem.php(125): Icinga\Module\Icingadb\Util\PluginOutput->setCommandName()

1 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Common/BaseListItem.php(73): Icinga\Module\Icingadb\Widget\ItemList\BaseHistoryListItem->assembleCaption()

2 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Common/ListItemCommonLayout.php(23): Icinga\Module\Icingadb\Common\BaseListItem->createCaption()

3 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Common/BaseListItem.php(91): Icinga\Module\Icingadb\Widget\ItemList\HistoryListItem->assembleMain()

4 /usr/sha

0 [internal function]: Icinga\Application\Web->Icinga\Application{closure}()

1 {main}

To Reproduce

Just navigate to History -> Event Overwiev

Your Environment

Include as many relevant details about the environment you experienced the problem in.

Running Icinga Web 2 with the container image "docker.io/icinga/icingaweb2:2.11.1" Fresh setup (no upgrade) with a master - agent setup and basic disk monitoring. Nothing special.

nilmerg commented 2 years ago

Hi,

just a random guess, but is there a chance that you or someone else has de-commissioned (removed) a service or host at the same time/day?

Does it occur randomly or permanently if you don't click on Load More. Does it only happen if you repeatedly click on Load More?

kayuma commented 2 years ago

Hi,

Thanks for getting back to me!

It occurs permanently and it doesn't display any "load more" button / link.

And yes, this is a fresh setup with no initial services and hosts. I've just started to setup an master/agent setup and configured a disk check for these to machines at the same day. But to be just clear, it's now many days later and the error still occurs.

krappi01 commented 2 years ago

Same here but other line:

Uncaught TypeError: Icinga\Module\Icingadb\Util\PluginOutput::setCommandName(): Argument #1 ($name) must be of type string, null given, called in /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Widget/ItemList/BaseHistoryListItem.php on line 135 and defined in /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Util/PluginOutput.php:112 Stack trace:

0 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Widget/ItemList/BaseHistoryListItem.php(135): Icinga\Module\Icingadb\Util\PluginOutput->setCommandName()

1 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Common/BaseListItem.php(73): Icinga\Module\Icingadb\Widget\ItemList\BaseHistoryListItem->assembleCaption()

2 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Common/ListItemMinimalLayout.php(17): Icinga\Module\Icingadb\Common\BaseListItem->createCaption()

3 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Common/BaseListItem.php(82): Icinga\Module\Icingadb\Widget\ItemList\HistoryListItemMinimal->assembleHeader()

4 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Common/ListItemMinimalLayout.php(24): Icinga\Module\Icingadb\Common\BaseListItem->createHeader()

5 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Common/BaseListItem.php(91): Icinga\Module\Icingadb\Widget\ItemList\HistoryListItemMinimal->assembleMain()

6 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Common/BaseListItem.php(162): Icinga\Module\Icingadb\Common\BaseListItem->createMain()

7 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(295): Icinga\Module\Icingadb\Common\BaseListItem->assemble()

8 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(497): ipl\Html\HtmlDocument->ensureAssembled()

9 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(339): ipl\Html\HtmlDocument->render()

10 /usr/share/icinga-php/ipl/vendor/ipl/html/src/BaseHtmlElement.php(255): ipl\Html\HtmlDocument->renderUnwrapped()

11 /usr/share/icinga-php/ipl/vendor/ipl/html/src/BaseHtmlElement.php(323): ipl\Html\BaseHtmlElement->renderContent()

12 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(499): ipl\Html\BaseHtmlElement->renderUnwrapped()

13 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(339): ipl\Html\HtmlDocument->render()

14 /usr/share/icinga-php/ipl/vendor/ipl/html/src/BaseHtmlElement.php(255): ipl\Html\HtmlDocument->renderUnwrapped()

15 /usr/share/icinga-php/ipl/vendor/ipl/html/src/BaseHtmlElement.php(323): ipl\Html\BaseHtmlElement->renderContent()

16 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(499): ipl\Html\BaseHtmlElement->renderUnwrapped()

17 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(339): ipl\Html\HtmlDocument->render()

18 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(499): ipl\Html\HtmlDocument->renderUnwrapped()

19 /usr/share/icinga-php/ipl/vendor/ipl/web/src/Compat/ViewRenderer.php(56): ipl\Html\HtmlDocument->render()

20 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action/Helper/ViewRenderer.php(964): ipl\Web\Compat\ViewRenderer->render()

21 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action/HelperBroker.php(272): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()

22 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Web/Controller.php(491): Zend_Controller_Action_HelperBroker->notifyPostDispatch()

23 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Icinga\Module\Icingadb\Web\Controller->dispatch()

24 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch()

25 /usr/share/php/Icinga/Application/Web.php(290): Zend_Controller_Front->dispatch()

26 /usr/share/php/Icinga/Application/webrouter.php(105): Icinga\Application\Web->dispatch()

27 /usr/share/icingaweb2/public/index.php(4): require_once('...')

28 {main}

thrown

It helped to use the null coalescing operator here to get an empty string instead:

$caption->addHtml(new PluginOutputContainer( (new PluginOutput($this->item->state->output)) ->setCommandName(($this->item->object_type === 'host' ? $this->item->host->checkcommand_name : $this->item->service->checkcommand_name) ?? '') ));

yhabteab commented 2 years ago

Same problem, with some random services and hosts the history view produces the following error:

Bildschirmfoto 2022-08-23 um 16 43 09

I have 1000's of random hosts with a lot of apply rules, service groups etc.. and before the initial confgs have ever been synced, icingadb is recording thousands of events in the history table, resulting in this error.