Bug in state history report?
Posted: Wed May 16, 2012 3:31 pm
Hello everyone.
I'm running Nagios XI R2.2 and I have some issues with State History report.
Report itself works fine when I run the report for particular host, but fails when executed for hostgroup - i.e. I get no results (or I get much less results than expected). Still, when I run the report in the same timeframe for the host in the hostgroup, I do get some results.
I took some time to analyze this behaviour and I believe I found a bug in the report.
For example, my linux-servers hostgroup is described by the following row in the database, and has one host shown below:
When I run the report, SQL query similar to the one below is executed:
As shown above, nagios_statehistory.object_id IN ('9') part tries to filter the result to all hosts in the given hostgroup, but by doing so, it actually filters the result to all problems with the host itself (host has object_id = 9). Since there were no problems with the host itself (just with some of the services on that host), no results are found by the query.
Perhaps I'm missing something?
Is this expected behaviour, or known bug?
Luka
I'm running Nagios XI R2.2 and I have some issues with State History report.
Report itself works fine when I run the report for particular host, but fails when executed for hostgroup - i.e. I get no results (or I get much less results than expected). Still, when I run the report in the same timeframe for the host in the hostgroup, I do get some results.
I took some time to analyze this behaviour and I believe I found a bug in the report.
For example, my linux-servers hostgroup is described by the following row in the database, and has one host shown below:
Code: Select all
+-----------+-------------+---------------+----------------------------------------+--------------------+-----------+
| object_id | instance_id | objecttype_id | name1 | name2 | is_active |
+-----------+-------------+---------------+----------------------------------------+--------------------+-----------+
| 321 | 1 | 3 | linux-servers | NULL | 1 |
| 9 | 1 | 1 | localhost | NULL | 1 |
Code: Select all
SELECT obj1.objecttype_id as objecttype_id, obj1.name1 AS host_name, obj1.name2 AS service_description, nagios_statehistory.* FROM nagios_statehistory LEFT JOIN nagios_objects as obj1 ON nagios_statehistory.object_id=obj1.object_id WHERE TRUE AND state_time >= '2012-05-15 21:26:50' AND state_time <= '2012-05-16 21:26:50' AND nagios_statehistory.state_type = '1' AND nagios_statehistory.object_id IN ('9') AND nagios_statehistory.instance_id = '1' ORDER BY state_time DESC, statehistory_id DESC LIMIT 25Perhaps I'm missing something?
Is this expected behaviour, or known bug?
Luka