Icinga / icingadb-web

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

Servicedetail view error with check_attempt higher then 5 #70

Closed MaBauMeBad closed 4 years ago

MaBauMeBad commented 4 years ago

Describe the bug

We updated our Test Enviroment to IcingaDB. With the new Web Module we get an Error message for the Service Check "CPU Load"(which ist he "load" Check from the Agent) and "Cluster Status" (which is Check command "cluster-status) at both Master Servers (currently the only Servers in this Enviroment).

`2020-04-29T13:02:59+02:00 - ERROR - InvalidArgumentException in /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/FormattedString.php:46 with message: ipl\Html\FormattedString::__construct expects parameter two to be iterable, got integer instead

0 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Widget/CheckAttempt.php(44): ipl\Html\FormattedString->__construct(String, Integer, Integer)

1 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(199): Icinga\Module\Icingadb\Widget\CheckAttempt->assemble()

2 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(348): ipl\Html\HtmlDocument->ensureAssembled()

3 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(226): ipl\Html\HtmlDocument->render()

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

5 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/BaseHtmlElement.php(339): ipl\Html\BaseHtmlElement->renderContent()

6 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(350): ipl\Html\BaseHtmlElement->renderUnwrapped()

7 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(226): ipl\Html\HtmlDocument->render()

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

9 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/BaseHtmlElement.php(339): ipl\Html\BaseHtmlElement->renderContent()

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

11 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(226): ipl\Html\HtmlDocument->render()

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

13 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/BaseHtmlElement.php(339): ipl\Html\BaseHtmlElement->renderContent()

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

15 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(226): ipl\Html\HtmlDocument->render()

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

17 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/BaseHtmlElement.php(339): ipl\Html\BaseHtmlElement->renderContent()

18 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(350): ipl\Html\BaseHtmlElement->renderUnwrapped()

19 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(226): ipl\Html\HtmlDocument->render()

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

21 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/BaseHtmlElement.php(339): ipl\Html\BaseHtmlElement->renderContent()

22 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(350): ipl\Html\BaseHtmlElement->renderUnwrapped()

23 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(226): ipl\Html\HtmlDocument->render()

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

25 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/BaseHtmlElement.php(339): ipl\Html\BaseHtmlElement->renderContent()

26 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(350): ipl\Html\BaseHtmlElement->renderUnwrapped()

27 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(226): ipl\Html\HtmlDocument->render()

28 /usr/share/icingaweb2/modules/ipl/vendor/ipl/html/src/HtmlDocument.php(350): ipl\Html\HtmlDocument->renderUnwrapped()

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

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

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

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

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

34 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))

35 /usr/share/php/Icinga/Application/Web.php(300): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))

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

37 /usr/share/icingaweb2/public/index.php(4): require_once(String)

38 {main}

`

Same Error message as #57, which was fixed with #66

BUT.. This happens only, if the check_attempts are higher then 5. I know this sounds strange, but this is what i can see after testing each value from 12 down to 5.

To Reproduce

Go in Service View and open "CPU Load" Service. This happens for both Servers, which are currently the only Server which we are Monitoring for Tests.

Expected behavior

The Service Detail View should open without Error Messages and any check_attempts value.

Screenshots

image

Your Environment

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

Additional context

Add any other context about the problem here.

lippserd commented 4 years ago

Hi,

Thanks for the report. This is a problem with the FormattedString construction here but easily fixable.

@nilmerg We already had problems w/ FormattedString::__construct() vs ::create() if I'm not mistaken. I opt that both methods have the same signature and we auto detect the array usage if there's only one parameter and it is an array. Do you agree?

All the best, Eric

nilmerg commented 4 years ago

No detection or any such magic in constructors. That's why we have https://github.com/Icinga/ipl-html/pull/23. I'm fine with both methods having different signatures. If we use the same signature for both we can also drop the factory method as then the only advantage it has is gone.

MaBauMeBad commented 4 years ago

Hi,

i tested again with manuelly patching the CheckAttempt.php from #66.

Result: Same Error, different Message:

image

We use IPL v0.5.0.

As example see below the Service definition for the "CPU Load" Service:

apply Service "load" {
  import host.vars.customer + "-service"

  check_command = "load"
  max_check_attempts = 6

  command_endpoint = host.name

  display_name = "CPU Load"

  assign where !host.vars.nrpe && regex("Linux|Windows", host.vars.os)
  ignore where host.vars.no_standard_services
  ignore where host.vars.none_standard
}
template Service "<host.vars.customer>-service" {
  import "generic-service"
}
template Service "generic-service" {
  max_check_attempts = 3
  check_interval = 5m
  retry_interval = 2m

  vars.pnp_check_arg1 = ""
  vars.department = "$host.vars.department$"
}

For me its not a duplicate or not really fixed. Please let me know if i can provide any more Details to support you. Thanks :)

nilmerg commented 4 years ago

Thanks. No the new traceback is already enough. :+1:

nilmerg commented 4 years ago

This will be fixed with https://github.com/Icinga/ipl-html/pull/32. Closing here.