grafana / grafana-zabbix

Zabbix plugin for Grafana dashboard
http://play.grafana-zabbix.org
Apache License 2.0
2.07k stars 458 forks source link

"Item tag" option in query variables doesn't work #1329

Open joachim-vertommen opened 3 years ago

joachim-vertommen commented 3 years ago

When using Zabbix 5.4 as data source and when defining a variable of the type 'Query', the query option 'Item tag' doesn't work. You can fill in whatever you want or you can leave it empty, it doesn't make a difference. The field just isn't taken into account.

The way it should work is like 'Application' did before Zabbix 5.4.

Software versions

Grafana Zabbix Grafana-Zabbix Plugin
8.1.5 5.4 4.2.4

image

drajv-y commented 3 years ago

And I encountered the same problem. If I select "Query Type = Item tag", the Item tag works as it should.

niektoniekde commented 2 years ago

Yeah I can definitely confirm this one. With query type "item" the "Item Tag" works as if regex '/.*/' is hard-coded.

SanderDelden commented 2 years ago

Can confirm this issue, we are encountering it as well.

Grafana Zabbix Zabbix Grafana plugin
8.2.5 5.4.7 4.2.4
weslley75 commented 2 years ago

Can confirm this issue, we are encountering it as well.

Grafana Zabbix Zabbix Grafana plugin 8.2.5 5.4.7 4.2.4

Same here!

kakvablyat commented 2 years ago

Can confirm this issue, we are encountering it as well.

Grafana [v8.3.5] Zabbix 5.4.10 Plugins Zabbix 4.2.3

lpolitowski commented 2 years ago

Unfortunately, problem still exists. I filled "Item tag" but there is no "tag" parameter in the query inspector. Tested on "Triggers" query mode.

Grafana v8.4.2 Plugin Zabbix 4.2.5 Zabbix 5.4.9

lucasfnds commented 2 years ago

Is there any solution for this?

Grafana v8.5.4 Plugin Zabbix 4.2.8 Zabbix 6.0.3

daFlo commented 2 years ago

+1

Grafana v9.1.1 Plugin Zabbix 4.2.9 Zabbix 6.2.1

renatoborges78 commented 2 years ago

@alexanderzobnin

As zabbix and Grafana have passed with major version changes, can't you prioritize this problem? because the item tag filter field is very important to improve the performance of the dashboard help us to filter, help please

Grafana v9.1.2 Plugin Zabbix 4.2.9 Zabbix 6.2.1

daFlo commented 2 years ago

@alexanderzobnin

I guess the fix is annoying but also we would be really grateful as we use this feature to filter the relevant items quite a lot. Thanks in advance.

Grafana v9.1.7 Plugin Zabbix 4.2.10 Zabbix 6.2.3

OCrylic commented 2 years ago

Hi,

Same problem with Zabbix 6.0.9 and Grafana 8.5.5.

Kerion commented 2 years ago

Same Problem...

Grafana v9.1.1 Plugin Zabbix 4.2.9 Zabbix 6.2.1

thuroc commented 2 years ago

Same same

Grafana v9.1.1 Plugin Zabbix 4.2.9 Zabbix 6.2.1

giovanny07 commented 2 years ago

Same problem

Grafana v8.5 Plugin 4.2.10 Zabbix 6.0.9

lmonasterio-undav commented 1 year ago

Same problem

Grafana v9.1.0 Plugin 4.2.10 Zabbix 6.0.9

jeanfelipenascimento commented 1 year ago

Same Problem

Grafana 8.4.6 Zabbix 6.2.0 Plugin 4.2.5

mbuyukkarakas commented 1 year ago

same problem

Grafana v9.1.0 Plugin 4.2.10 Zabbix 6.0.9

maba06 commented 1 year ago

Same Problem! I can't believe that this elementary problem it is still not fixed! 😱

Grafana 9.3.2 Plugin 4.2.5 Zabbix 5.4.12

RangersMS commented 1 year ago

I can't believe that this elementary problem it is still not fixed! 😱

Just my humble opinion but this is an open source project mostly run by a single person who also has a day job. I can see why it's not fixed yet. I think we should be thankful for the work he has already done! If it bothers you or you rely on it for business make a fork, fix the problem and make a pull request.

drkmdaniel commented 1 year ago

Confirmo que el problema continua usando Grafana 9.4.7 Zabbix 6.4.

Gracias por su atencion.

grinapo commented 1 year ago

@RangersMS Just my humble opinion but this is an open source project mostly run by a single person who also has a day job. I can see why it's not fixed yet.

I understand your sentiment but this issue is open since Oct, 2021.

Also it's a problem that fixing this would require considerable amount of reverse engineering effort, since it seems that the filtering is not done on the Zabbix API level but in javascript (when one sets Item tag and checks the offered fields in Item it seems that the filtering works then, but when displaying the graph it does not), so it is probably not a simple fix unless you know exactly what to touch.

I haven't found the obvious codepath in 5 minutes, and it was just a preliminary check about how easy this would be to fix. Probably the filtering is written and used in the UI codepath but not in the graph generating one.

Let's hope someone with knowledge of grafana plugin structure and JS will look at it someday.

grinapo commented 1 year ago

Good news, kind of: I have changed Zabbix datasource from "Browser" to "Server" and the Item Tag filtering now works. Let's call this a workaround…

maba06 commented 1 year ago

Good news, kind of: I have changed Zabbix datasource from "Browser" to "Server" and the Item Tag filtering now works. Let's call this a workaround…

My datasource settings are already set to "Server" (which is also the recommended setting) - but, I experience the issue anyway. So, unfortunately this isn't a (general) workaround.

Btw., as there is also still issue #1176 open (even already since March 2021), it is a really unsatisfying situation when trying to build more complex dashboards in Grafana using Zabbix as datasource. I very much hope that both issues will now be soon fixed... :-(

serdemo commented 5 months ago

Same problem. Grafana v9.3.2 Plugin alexanderzobnin-zabbix-app 4.4.9 Zabbix-server 6.0.21

daFlo commented 5 months ago

1 1/2 years later - same problem

Grafana v11.0.0 Plugin alexanderzobnin-zabbix-app 4.4.9 Zabbix-server 6.4.14

grinapo commented 4 months ago

Bad news: the switch is now gone so the problem does not seem to have a workaround anymore, as daFlo mentioned.

grafana Version 11.0.0 alexanderzobnin-zabbix-app @ 4.4.9

grinapo commented 4 months ago

Okay, call me officially confused.

I spent an non-insignificant amount of time to reverse engineer the golang code, and ended up in pkg/zabbix/methods.go which has a GetItems function which is possibly screwing me: it seemed that if I was using a regexp it failed while worked for fixed string. So I started inserting debug everywhere to see whether it's GetItemTags which makes fun of me or GetItems itself.

(In due time I realised that datasource/zabbix.go clunkily ignores to log the specific error msg in queryNumericItems which caused a lot of "Error getting Zabbix version" errors in log without actually specifying what the problem was; after some patching, figuring out that the build needs a lot of unmentioned tools, and/or requires grafana to disable signature checking, I got the error "context canceled" which made me wonder why a lost context is neither retried nor logged, but it results a bad zabbix version detection and probably breaks a lot of stuff when using old API on a new zabbix. Anyway.)

And after all patching and compiling (and forcing the patched plugin into grafana) I realised that it works flawlessly. (Apart from the broken version check which I have patched away to use a fixed "6.2" version, meh.)

So, either the broken version check broke the regex generation which broke the filtering, or simply something in my manual build environment fixed it. But I'm a bit tired now (of patching unknown code in an unknown language) to start gradually breaking it again. I'll try to get back to test it but no promises, unless Mr. Wizard figures it out first.

daFlo commented 4 months ago

Great to read that @grinapo is doing progress here... I guess we all would apprechiate having this fixed.

On the other hand reading your derivation was a little disappointing as it seems not to be a profound bug and then after over 2 1/2 years this is not fixed by the maintainer in his capacity as a Grafana employee. Guess he will be packed with other projects too much...

grinapo commented 4 months ago

I have a problem though: I have put back the original code (to test something) and now it works. I worry that it's either changing by restarts (so I cannot debug it easily) or mess up some internal state of grafana itself, which makes debugging also hard. I will try to put in debug logging points and see which part of the regex is failing but if it will not break itself I cannot go on much. Until then, try to restart your grafana and see whether it makes a difference. (But I'm still not happy to see that version check failed, I don't know how much it can break.)

erik-de-neve commented 1 week ago

Is this still on the roadmap ?