Bug in state history report?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
lmilkovic
Posts: 15
Joined: Wed Oct 13, 2010 2:31 am

Bug in state history report?

Post by lmilkovic »

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:

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 |
When I run the report, SQL query similar to the one below is executed:

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 25
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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Bug in state history report?

Post by scottwilkerson »

I have confirmed this bug and filed it on our tracker

http://tracker.nagios.com/view.php?id=259

Thanks for reporting this.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked