Icinga / icingaweb2-module-cube

Drill-down view for Icinga web 2 based on custom variables
GNU General Public License v2.0
45 stars 12 forks source link

Error trying to add a second dimension if the first applies to some hosts only #9

Closed buzzdeee closed 5 years ago

buzzdeee commented 7 years ago

Hi,

I'm with icingaweb2 2.4.0, I get to reporting/cube, and then add a first dimension, and that works, i.e. 'hostgroup'

Then getting under "show settings" and want to add another dimension, clicking on 'Add a dimension' The selection pops up, and on selection what I want, i.e. 'os', then instead of adding the second dimension the only thing I get is the following error message:

Undefined property: stdClass::$os

When I reverse the example, i.e. first dimension 'os' and then try second dimension 'hostgroup', the first dimension for the 'os' works, but then on the second dimension I get similar error message:

Undefined property: stdClass::$hostgroup

Running the module from git commit: 3107867c9aeb5c0df08f29d2489089d0e267e854

Thomas-Gelf commented 7 years ago

That's strange... are you using PostgreSQL or MySQL? And in case you get a full stack trace: could you please share the full output?

mateusz-gozdek-sociomantic commented 7 years ago

This is also happening to me. I think this is happening when some hosts don't have specific variable defined.

Here is the stacktrace:

Undefined property: stdClass::$lsbdistcodename

#0 /usr/share/icingaweb2/modules/cube/library/Cube/Ido/IdoHostStatusCubeRenderer.php(21): Icinga\Application\ApplicationBootstrap->Icinga\Application\{closure}(8, 'Undefined prope...', '/usr/share/icin...', 21, Array)
#1 /usr/share/icingaweb2/modules/cube/library/Cube/CubeRenderer.php(294): Icinga\Module\Cube\Ido\IdoHostStatusCubeRenderer->renderDimensionLabel('provider', Object(stdClass))
#2 /usr/share/icingaweb2/modules/cube/library/Cube/CubeRenderer.php(219): Icinga\Module\Cube\CubeRenderer->beginDimension('provider', Object(stdClass))
#3 /usr/share/icingaweb2/modules/cube/library/Cube/CubeRenderer.php(201): Icinga\Module\Cube\CubeRenderer->beginDimensionsUpFrom('provider', Object(stdClass))
#4 /usr/share/icingaweb2/modules/cube/library/Cube/CubeRenderer.php(190): Icinga\Module\Cube\CubeRenderer->beginDimensionsForRow(Object(stdClass))
#5 /usr/share/icingaweb2/modules/cube/library/Cube/CubeRenderer.php(176): Icinga\Module\Cube\CubeRenderer->renderRow(Object(stdClass))
#6 /usr/share/icingaweb2/modules/cube/library/Cube/Cube.php(290): Icinga\Module\Cube\CubeRenderer->render(Object(Icinga\Web\View))
#7 zend.view:///usr/share/icingaweb2/modules/cube/application/views/scripts/index/index.phtml(18): Icinga\Module\Cube\Cube->render(Object(Icinga\Web\View))
#8 /usr/share/php/Icinga/Web/View.php(231): include('zend.view:///us...')
#9 /usr/share/icingaweb2/library/vendor/Zend/View/Abstract.php(877): Icinga\Web\View->_run('/usr/share/icin...')
#10 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action/Helper/ViewRenderer.php(904): Zend_View_Abstract->render('index/index.pht...')
#11 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action/Helper/ViewRenderer.php(925): Zend_Controller_Action_Helper_ViewRenderer->renderScript('index/index.pht...', NULL)
#12 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action/Helper/ViewRenderer.php(964): Zend_Controller_Action_Helper_ViewRenderer->render()
#13 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action/HelperBroker.php(272): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#14 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(518): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#15 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch('indexAction')
#16 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#17 /usr/share/php/Icinga/Application/Web.php(389): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#18 /usr/share/php/Icinga/Application/webrouter.php(109): Icinga\Application\Web->dispatch()
#19 /usr/share/icingaweb2/public/index.php(4): require_once('/usr/share/php/...')
#20 {main}

Not tested steps to reproduce: define two hosts:

object Host "foo" {
  var.foo = "foo"
  var.bar = "bar"
}

object Host "bar"
  var.foo = "bar"
  # Missing var.bar
  #var.bar = "foo"
}

Then add two dimentions in cube: first foo as it's set for both hosts and then for bar. 2nd dimention should crash now.

dnsmichi commented 6 years ago

I'm not able to reproduce this.

voiprodrigo commented 6 years ago

This is also happening to me. Using IcingaWeb 2.5.3, and PostgreSQL

voiprodrigo commented 6 years ago

FYI, I reconfigured Icingaweb2 to use Mysql (MariaDB), and the problem went away.

buzzdeee commented 6 years ago

I don't feel alone anymore. But switching to a new DB backend, just because of this is a no-go. That would be the one and only mysql/mariadb I run. Everything runs happily on PostgreSQL.

voiprodrigo commented 6 years ago

@dnsmichi mentioned he could not reproduce. I wonder if it was tested only with MySQL?

dnsmichi commented 6 years ago

Right, this happens on PostgreSQL only. My previous tests only were with MySQL, this information came in later.

mbmif /usr/local/icinga2/etc/icinga2 (master *) # cat tests/c.conf
object Host "foo" {
  check_command = "dummy"
  vars.foo = "foo"
  vars.bar = "bar"
}

object Host "bar" {
  check_command = "dummy"
  vars.foo = "bar"
  # Missing var.bar
  #var.bar = "foo"
}
mbmif /usr/local/icinga2/etc/icinga2 (master *) # cat icinga2.conf

include "constants.conf"
include "zones.conf"
include <itl>
include <plugins>
include <plugins-contrib>
include <manubulon>
include <windows-plugins>
include <nscp>
include "features-enabled/*.conf"
//include_recursive "tests"
include "tests/c.conf"
mbmif /usr/local/icinga2/etc/icinga2 (master *) # icinga2 feature list
Disabled features: compatlog debuglog elasticsearch gelf graphite icingastatus ido-mysql influxdb livestatus logstash opentsdb perfdata statusdata syslog
Enabled features: api checker command ido-pgsql mainlog notification redis
mbmif /usr/local/icinga2/etc/icinga2 (master *) # cat /usr/local/icingaweb2/etc/modules/monitoring/backends.ini
...

[icinga2_ido_pgsql]
type = "ido"
resource = "icinga2_ido_pgsql"
disabled = "0"
mbmif /usr/local/icinga2/etc/icinga2 (master *) # cat /usr/local/icingaweb2/etc/resources.ini
...

[icinga2_ido_pgsql]
type = "db"
db = "pgsql"
host = "localhost"
port = "5432"
dbname = "icinga"
username = "icinga"
password = "icinga"

Steps to reproduce

Important: It does not work the other way around.

Undefined property: stdClass::$foo

#0 /usr/local/share/icingaweb2/modules/cube/library/Cube/Ido/IdoHostStatusCubeRenderer.php(21): Icinga\Application\ApplicationBootstrap->Icinga\Application\{closure}(Integer, String, String, Integer, Array)
#1 /usr/local/share/icingaweb2/modules/cube/library/Cube/CubeRenderer.php(294): Icinga\Module\Cube\Ido\IdoHostStatusCubeRenderer->renderDimensionLabel(String, Object(stdClass))
#2 /usr/local/share/icingaweb2/modules/cube/library/Cube/CubeRenderer.php(219): Icinga\Module\Cube\CubeRenderer->beginDimension(String, Object(stdClass))
#3 /usr/local/share/icingaweb2/modules/cube/library/Cube/CubeRenderer.php(201): Icinga\Module\Cube\CubeRenderer->beginDimensionsUpFrom(String, Object(stdClass))
#4 /usr/local/share/icingaweb2/modules/cube/library/Cube/CubeRenderer.php(190): Icinga\Module\Cube\CubeRenderer->beginDimensionsForRow(Object(stdClass))
#5 /usr/local/share/icingaweb2/modules/cube/library/Cube/CubeRenderer.php(176): Icinga\Module\Cube\CubeRenderer->renderRow(Object(stdClass))
#6 /usr/local/share/icingaweb2/modules/cube/library/Cube/Cube.php(290): Icinga\Module\Cube\CubeRenderer->render(Object(Icinga\Web\View))
#7 zend.view:///usr/local/share/icingaweb2/modules/cube/application/views/scripts/index/index.phtml(18): Icinga\Module\Cube\Cube->render(Object(Icinga\Web\View))
#8 /usr/local/share/icingaweb2/library/Icinga/Web/View.php(270): include(String)
#9 /usr/local/share/icingaweb2/library/vendor/Zend/View/Abstract.php(877): Icinga\Web\View->_run(String)
#10 /usr/local/share/icingaweb2/library/vendor/Zend/Controller/Action/Helper/ViewRenderer.php(904): Zend_View_Abstract->render()
#11 /usr/local/share/icingaweb2/library/vendor/Zend/Controller/Action/Helper/ViewRenderer.php(925): Zend_Controller_Action_Helper_ViewRenderer->renderScript(String, NULL)
#12 /usr/local/share/icingaweb2/library/vendor/Zend/Controller/Action/Helper/ViewRenderer.php(964): Zend_Controller_Action_Helper_ViewRenderer->render()
#13 /usr/local/share/icingaweb2/library/vendor/Zend/Controller/Action/HelperBroker.php(272): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#14 /usr/local/share/icingaweb2/library/vendor/Zend/Controller/Action.php(518): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#15 /usr/local/share/icingaweb2/library/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch(String)
#16 /usr/local/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#17 /usr/local/share/icingaweb2/library/Icinga/Application/Web.php(409): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#18 /usr/local/share/icingaweb2/library/Icinga/Application/webrouter.php(104): Icinga\Application\Web->dispatch()
#19 /usr/local/share/icingaweb2/public/index.php(4): require_once(String)
#20 {main}
nbuchwitz commented 6 years ago

I ran today in the same issue, should be fixed with #29

nilmerg commented 5 years ago

Since the related PR is merged >> Closed.