Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty result set with non-matching filters in Livestatus stats query #5626

Closed
yoshi314 opened this issue Sep 27, 2017 · 5 comments
Closed

Empty result set with non-matching filters in Livestatus stats query #5626

yoshi314 opened this issue Sep 27, 2017 · 5 comments
Labels
area/livestatus Legacy interface bug Something isn't working help wanted Extra attention is needed
Milestone

Comments

@yoshi314
Copy link

I've detailed the problem in Thruk bug tracker : sni/Thruk#762

Basically, i cannot connect via livestatus from the same host, but i can from remote host.

@dnsmichi
Copy link
Contributor

Please fill in the issue template as proposed by GitHub next time.

Reading the linked issue makes me believe that Thruk cannot handle empty result values when a filter does not match.

Technically such a filter

GET services
ResponseHeader: fixed16
OutputFormat: json
Filter: check_type = 1
Filter: has_been_checked = 1
Stats: sum percent_state_change
Stats: min percent_state_change
Stats: max percent_state_change

could match or not. If it matches, the stats aggregators will calculate possible values. As seen in the other issue.

[[0.0000000000e+00,0.0000000000e+00,0.0000000000e+00]]

If nothing matches, there is no requirement to calculate anything. The caller must know that nothing matches and maybe re-adjust the filter.

[]

If we would return a fake zero result set here, this would indicate that something matches, but the stats calculation actually did not.

Imho the current implementation works as it should. The caller should check the returned values and decide upon them what to do.

@dnsmichi dnsmichi added needs feedback We'll only proceed once we hear from you again area/livestatus Legacy interface labels Sep 28, 2017
@dnsmichi dnsmichi changed the title livestatus appears broken on 2.7.1 Empty result set with non-matching filters in Livestatus stats query Sep 28, 2017
@yoshi314
Copy link
Author

I think you really should talk it out between yourselves. The thruk dev has responded that this seems to indeed to be a bug. (I just hate to be the middleman here)

sni/Thruk#762 (comment)

@dnsmichi
Copy link
Contributor

I don't like ping-pong either, since every information is hidden in the linked issue, and not here. I'm open for discussions and a patch if this is indeed a bug. @gunnarbeutner 's opinion is also required on the matter :)

@theseal
Copy link

theseal commented Oct 12, 2017

Any update in this issue? Having the same problem with thruk/lmd.

@dnsmichi
Copy link
Contributor

I've looked into the code to implement a simple fix. Unfortunately it is not an easy one, so this requires one to find the time to create a patch. Feel free to investigate here, the code parts are found here

https://github.com/Icinga/icinga2/blob/master/lib/livestatus/livestatusquery.cpp#L514

Possible workaround - modify Thruk's code to accept empty results too, instead of accessing a key in a null object.

@dnsmichi dnsmichi added bug Something isn't working help wanted Extra attention is needed and removed needs feedback We'll only proceed once we hear from you again labels Oct 13, 2017
@dnsmichi dnsmichi added this to the 2.8.1 milestone Dec 7, 2017
@dnsmichi dnsmichi closed this as completed Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/livestatus Legacy interface bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants