Icinga/icingaweb2-module-businessprocess

Issue with IcingaDB

Closed this issue · 0 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...