ddurieux / glpi_app_grafana

GNU Affero General Public License v3.0
23 stars 13 forks source link

Differences in results #24

Open zbuk78 opened 6 years ago

zbuk78 commented 6 years ago

Hi David! I vave a problem setting up a Singlestat panel so that it shows me the exact same number of items found in glpi. Here's an example: https://my.glpi.address/glpi/front/computer.php?is_deleted=0&criteria[0][field]=5150&criteria[0][searchtype]=morethan&_select_criteria[0][value]=-4DAY&criteria[0][value]=-4DAY&search=Szukaj&itemtype=Computer&start=0&_glpi_csrf_token=292d836fc52c10bc8d1a418730329b84 This search returns the number 1108. Then I paste the link to a grafana query field, check count elements checkbox, in third tab (Options) I change Stats to Current, which gives me result of 1 item. When I chenge Stats to Total it returns 1090. I couldn't find any explenation on how to use this plugin properly to get the same results as in glpi. Thanks for Your help.

ddurieux commented 6 years ago

Be carefull, because you have the time restriction in grafana, it can modify the counter

zbuk78 commented 6 years ago

Yes, changing date range I get different results, but still none of them (even with last 50 years) is the same results in glpi and grafana. What's more, when I run Query Inspector, then I have three different results: glpi - 1176 Query inspector returns 1099 and on grafana's singlestat I have 1077 machines. I realize that may not be a bug and I have misconfigured something, but I'm just not able to get results that would be exactly the same.

ddurieux commented 6 years ago

Ok, I will try to check / reproduce

zbuk78 commented 6 years ago

One more strange thing I've noticed is that some queries show good results in Query Inspector and after a while the url changes itself for one searching tickets (even though I paste the url to look for ie. virtual machines) and the request ends up with something like that:

request:Object method:"GET" url:"api/datasources/proxy/8/search/ticket?is_deleted=0&criteria[0][field]=12&criteria[0][searchtype]=equals&criteria[0][value]=all&search=Rechercher&itemtype=Ticket&start=0&criteria[1][link]=AND&criteria[1][field]=15&criteria[1][searchtype]=morethan&_select_criteria[1][value]=0&_criteria[1][value]=-49624586&criteria[1][value]=1968-06-05 15:23:34&criteria[2][link]=AND&criteria[2][field]=15&criteria[2][searchtype]=lessthan&_select_criteria[2][value]=0&_criteria[2][value]=1528212214&criteria[2][value]=2018-06-05 15:23:34&forcedisplay[0]=0&giveItems=true&forcedisplay[1]=1&forcedisplay[3]=3&forcedisplay[13]=13&forcedisplay[4]=4&forcedisplay[5]=5&forcedisplay[15]=15&range=2000-2399" response:Object totalcount:42630 count:400 sort:1 order:"ASC"

Before that result I have this one: request:Object method:"GET" url:"api/datasources/proxy/8/search/computer?is_deleted=0&criteria[0][field]=5150&criteria[0][searchtype]=morethan&_select_criteria[0][value]=-1WEEK&criteria[0][value]=-1WEEK&criteria[1][link]=AND&criteria[1][field]=40&criteria[1][searchtype]=equals&criteria[1][value]=26&criteria[2][link]=OR&criteria[2][field]=40&criteria[2][searchtype]=equals&criteria[2][value]=15&search=Szukaj&itemtype=Computer&start=0&_glpi_csrf_token=8209811f9da600ba98e78b98dbcc0745&criteria[3][link]=AND&criteria[3][field]=5150&criteria[3][searchtype]=morethan&_select_criteria[3][value]=0&_criteria[3][value]=1370446314&criteria[3][value]=2013-06-05 15:31:54&criteria[4][link]=AND&criteria[4][field]=5150&criteria[4][searchtype]=lessthan&_select_criteria[4][value]=0&_criteria[4][value]=1528212714&criteria[4][value]=2018-06-05 15:31:54&forcedisplay[0]=0&range=0-399" response:Object totalcount:337 count:337 sort:1 which is the exact number returned by glpi, but the number displayed on singlestat is 322.

yoshi314 commented 6 years ago

also noticing this, simple query for computers that have not been updated with fusioninventory since last week is off by ~100

eprogres commented 5 years ago

Hi David, Did you reproduce the problem? Any progress with this issue?

ddurieux commented 5 years ago

I planned to work on grafana this friday

eprogres commented 5 years ago

grafana_screen

nothing better than screenshot Query inspector in line totalcount:1236 shows correct value, same number in glpi but in indicator we got 1095 which is wrong. Time range in query is correct (in example last 7 days)

we try to count returned objects - checked option "Count elements"

ddurieux commented 5 years ago

You define 'total' in 'stat' field in tab 'options' ?

eprogres commented 5 years ago

total

Yes we did still wrong number

eprogres commented 5 years ago

dashboard.txt

ddurieux commented 5 years ago

Hello, can you try with this patch: https://github.com/ddurieux/glpi_app_grafana/commit/21d0b1a81911937ae6f6f6f2790a7c0f0fe4b9ac

eprogres commented 5 years ago

zrzut ekranu z 2018-11-05 14-43-36

still discrepancy in results :(

Marsnet100 commented 5 years ago

is there any progress ? this plugin would be very valuable for us :|

ddurieux commented 5 years ago

Not had yet time to check, can you see if you have already the problem with version 1.3 ?

kowalskimn commented 5 years ago

We're still observing a constant offset between query inspector results and displayed results.

The difference varies every day, but seems fixed when changing time ranges in grafana.