Icinga / icingaweb2-module-idoreports

Icinga IDO Reports provides host and service availability reports for Icinga based on the monitoring database (IDO).
GNU General Public License v2.0
34 stars 13 forks source link

Support for state filters #40

Open K-razy opened 3 years ago

K-razy commented 3 years ago

Hello, Hope you are all fine,

My issue is that when i tried to create a filter for services they all end with "No Data Found" I have custom variables created with Director Modules and i was wondering if they are accessible.

To Reproduce

Create a Data Field with Director
Make it available with as Custom Vars for one or several host
Create a filter in Reporting Module and update the Report using _service_customfield = "value"
Result in : No data Found

My Environment Module version: Reporting 0.9.2 Dependent module versions: idoreports | 0.9.0 incubator | 0.6.0 ipl | v0.5.0 pdfexport | 0.9.1 reactbundle | 0.8.0

Icinga Web 2 version and modules (System - About): 2.8.2
Web browser and version: Mozilla Firefox version 84.0
Icinga 2 version used (icinga2 --version): r2.12.0-1
PHP version used (php --version): PHP 7.0.33-0+deb9u1
Server operating system and version: Debian Stretch

Hope i gave all the data to help me in this case.

Thanks in advance

Sincerely yours

KCS

nilmerg commented 3 years ago

Hi, two questions:

K-razy commented 3 years ago

Hello

Thanks a lot for your reply.

For the first question : The goal is to obtain only hosts matching the filter _service_customfield For the second question : Yes, they are visible in the monitoring module

Maybe, my explanation wasn't enough clear, Let me explain better :)

  1. I have one customvar called "memory_win_warn" having a value in percentage (ex. 15%) That means if a windows server's memory is less than 15% free, i will have a warning alert memory_win_war

  2. I currently have a warning alert on one host and on the monitoring dashboard, I can see the customvar Alert

  3. So i would like to build a report which gives me, for this current day (for example), the name of the hosts facing this issue and how long (percentage attached)

Here is the filter i tried Filter

Hope it sound more clear :)

Have a nice day

Regards

nilmerg commented 3 years ago

I see, but shouldn't you then be filtering for the service name and whether it has a problem? (e.g. service_description=monitoring-memory&service_problem=1 or if it's really only the warnings you're interested in: service_description=monitoring-memory&service_state=1)

The custom variable only reflects the service's configuration, it doesn't have any connection to the current state of the service.

K-razy commented 3 years ago

Hello,

My bad, I didn't know that service_description allows me to filter by the name. It exists for hosts object (host_name) However, when i tried to collect only the warning which i am only interested in it seems that it doesn't like it

image

i also tried with = service_description=monitoring-memory&_service_state=1 (with underscore if case it fit, still the same) I think when i add another argument with "&" it doesn't like it.

I really thank you for your time.

Have a nice day

KCS

nilmerg commented 3 years ago

Oh, I'm surprised this doesn't work when creating reports. It seems that it's currently not possible to filter for other columns than these:

This has also been mentioned already in #37. (The need for state filters)

So, I'm afraid, but this is currently not supported. :disappointed:

willfurnell commented 3 years ago

We have tried adding 'service_state', on lines 129 and 147 of https://github.com/Icinga/icingaweb2-module-idoreports/blob/68780eb96183ffc235891637b1dd0c5f3e1120cb/library/Idoreports/IdoReport.php, and then filtering by states 1, 2 and 3 but with no luck - only CRITICAL seems to be accounted for. (only filtering by service_state=0 actually returns any data). Looks like there's more involved with the SQL maybe?