Hi guys,
I recently discovered a strange behavior in IcingaDB-Web. When clicking on the Host History tab some servers show “Invalid host state 2” and no data.
This behavior started to show after upgrading to IcingaDB.
I already tried to create a new host config (with same host ID), reduce the config to the bare minimum but without success.
Changing the Host ID to something new worked. Changing it back results in the same error. That looks to me as if something got screwed up in the database during the migration.
Running a SQL query with one of the affected hostnames returns seemingly correct values. (see below) The host ID looks strange, but seems to work. (What data type is this?)
Looking at the php file in GitHub, mentioned in the Log, it seems that a state “2” is not expected:
But Host state “2” is DOWN according to this document:
Where does the host state come from?
Any ideas what is happening and if there is a way to get this fixed without having to rename all affected hosts?
Further information follows below.
best regards,
Andreas
Here is the Application Log record:
InvalidArgumentException in /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Common/HostStates.php:71 with message: Invalid host state 2
#0 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Widget/ItemList/BaseHistoryListItem.php(250): Icinga\Module\Icingadb\Common\HostStates::text()
#1 /usr/share/icinga-php/ipl/vendor/ipl/web/src/Common/BaseListItem.php(121): Icinga\Module\Icingadb\Widget\ItemList\BaseHistoryListItem->assembleVisual()
#2 /usr/share/icinga-php/ipl/vendor/ipl/web/src/Common/BaseListItem.php(141): ipl\Web\Common\BaseListItem->createVisual()
#3 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(344): ipl\Web\Common\BaseListItem->assemble()
#4 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(566): ipl\Html\HtmlDocument->ensureAssembled()
#5 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(390): ipl\Html\HtmlDocument->render()
#6 /usr/share/icinga-php/ipl/vendor/ipl/html/src/BaseHtmlElement.php(297): ipl\Html\HtmlDocument->renderUnwrapped()
#7 /usr/share/icinga-php/ipl/vendor/ipl/html/src/BaseHtmlElement.php(365): ipl\Html\BaseHtmlElement->renderContent()
#8 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(568): ipl\Html\BaseHtmlElement->renderUnwrapped()
#9 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(390): ipl\Html\HtmlDocument->render()
#10 /usr/share/icinga-php/ipl/vendor/ipl/html/src/BaseHtmlElement.php(297): ipl\Html\HtmlDocument->renderUnwrapped()
#11 /usr/share/icinga-php/ipl/vendor/ipl/html/src/BaseHtmlElement.php(365): ipl\Html\BaseHtmlElement->renderContent()
#12 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(568): ipl\Html\BaseHtmlElement->renderUnwrapped()
#13 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(390): ipl\Html\HtmlDocument->render()
#14 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(568): ipl\Html\HtmlDocument->renderUnwrapped()
#15 /usr/share/icinga-php/ipl/vendor/ipl/web/src/Compat/ViewRenderer.php(62): ipl\Html\HtmlDocument->render()
#16 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action/Helper/ViewRenderer.php(970): ipl\Web\Compat\ViewRenderer->render()
#17 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action/HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#18 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Web/Controller.php(484): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#19 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Icinga\Module\Icingadb\Web\Controller->dispatch()
#20 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Front.php(954): Icinga\Web\Controller\Dispatcher->dispatch()
#21 /usr/share/php/Icinga/Application/Web.php(294): Zend_Controller_Front->dispatch()
#22 /usr/share/php/Icinga/Application/webrouter.php(105): Icinga\Application\Web->dispatch()
#23 /usr/share/icingaweb2/public/index.php(4): require_once(String)
#24 {main}
Test SQL Query:
select host.id,host.name,history.event_type from host inner join history on host.id=history.host_id where host.name="pfhn-vm-dc2.am.p-f.biz";
(skipped a lot of data here)
| < !▒▒F▒▒▒p۸▒▒▒G▒▒ | pfhn-vm-dc2.am.p-f.biz | state_change | 1714326007628 |
| < !▒▒F▒▒▒p۸▒▒▒G▒▒ | pfhn-vm-dc2.am.p-f.biz | state_change | 1714326122852 |
| < !▒▒F▒▒▒p۸▒▒▒G▒▒ | pfhn-vm-dc2.am.p-f.biz | state_change | 1714326238077 |
| < !▒▒F▒▒▒p۸▒▒▒G▒▒ | pfhn-vm-dc2.am.p-f.biz | notification | 1714326238147 |
| < !▒▒F▒▒▒p۸▒▒▒G▒▒ | pfhn-vm-dc2.am.p-f.biz | notification | 1714326238147 |
| < !▒▒F▒▒▒p۸▒▒▒G▒▒ | pfhn-vm-dc2.am.p-f.biz | state_change | 1716442960924 |
26866 rows in set
(I just made the query up to see if I get any reasonable results, no actual code from Icinga here.)
What would be the correct SQL query?
Give as much information as you can, e.g.
- Icinga Web 2 version 2.12.2
- Used modules and their versions (System - About)
- businessprocess 2.5.1
- dependency_plugin 0.0.0
- doc 2.12.2
- grafana 3.0.1
- icingadb 1.1.3
- map 2.0.0
- migrate 2.12.2
- reactbundle 0.7.0
- x509 1.3.2
- Icinga 2 version used (
icinga2 --version
) r2.14.5-1 - PHP version used (
php --version
) 8.0.30 - Server operating system and version RHEL 8.10