Icinga / icingaweb2-module-businessprocess

Create top-level views of your applications in a graphical editor. Rules express dependencies between existing hosts and services and let you alert on application level. Business processes are displayed in a tree or list overview.

Home Page:https://icinga.com/docs/businessprocess/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with IcingaDB

alamp1360 opened this issue · comments

The BusinessProzess Module displays an error:
Could not retrieve process state: Object of class DateTime could not be converted to number
when using the module in combination with IcingaDB.

After some debugging i found the issue:
In file library/BusinessProcess/State/IcingaDbState.php on line 125 there is a division:

    if ($row->state->last_state_change !== null) {
        $node->setLastStateChange($row->state->last_state_change/1000);
    }

But since that last_state_change is a DateTime Object, this cannot be done.

I fixed at least the error by adding a "->getTimeStamp()" at the end:

    if ($row->state->last_state_change !== null) {
        $node->setLastStateChange($row->state->last_state_change->getTimeStamp());
    }

I am not sure about the "/1000". I guess the the code expects some timestamp in milliseconds. But since getTimeStamp() returns seconds, i think it is safe to remove the /1000 as well...

Hope this helps...