Commit Graph

1009 Commits

Author SHA1 Message Date
ismail simsek
3e626d3aa5 Add item count warning in query editor for large result sets (#2152)
## Summary

Adds a non-intrusive warning banner in the query editor that alerts
users when their query matches a large number of items (>= 500). This
helps users understand that their query may return a large amount of
data and suggests using more specific filters.

Part of https://github.com/grafana/oss-big-tent-squad/issues/127

## Changes

- Added `ITEM_COUNT_WARNING_THRESHOLD` constant (500 items) in
`src/datasource/constants.ts`
- Created new `ItemCountWarning` component in
`src/datasource/components/ItemCountWarning.tsx`
- Updated `MetricsQueryEditor` to track and report the count of items
matching the current filter
- Integrated the warning component into the main `QueryEditor` component

## How it works

- When items are loaded for the dropdown in the Metrics query editor,
the component counts how many items match the current item filter
- If using a regex filter like `/.*/`, it applies the regex to count
matching items
- If the count is >= 500, a warning banner appears at the top of the
query editor
- The warning is purely informational - queries still execute normally
- The warning only appears for the "Metrics" query type

## Screenshot

The warning appears as a subtle banner with a warning icon:

> I set the limit as 5 just to show the warning

<img width="901" height="298" alt="grafik"
src="https://github.com/user-attachments/assets/a9be8563-1b90-4581-ad15-4e7035b4166e"
/>

## Why

Queries that match thousands of items via wildcard filters (e.g.,
`/.*/`) can return massive amounts of data and potentially overload the
Zabbix server. This proactive warning helps users make informed
decisions about their query scope without adding friction to the normal
query flow.
2025-12-29 18:49:13 +01:00
Jocelyn Collado-Kuri
127367464e Standardization across Zabbix UI components (#2141)
## Summary

Throughout Zabbix we did not have a uniform UI - some drop-down were
using `Select` others `Combobox` others a custom one that we created.
Some had placeholders and others did not. This PR aims to standardize
our Zabbix UI across our query, variable and config editors

## Detailed summary 

- Migrate from `Select` to `Combobox` -> `Select` component is
deprecated
- Migrate from `HorizontalGroup` to `Stack` -> `HorizontalGroup` is also
deprecated
- Remove use of "custom" dropdown `MetricPickerMenu` in favor of
`Combobox` ensuring uniformity across our drop-down and removing
maintenance overhead for us down the line
- Standardize placeholders across all inputs

<img width="630" height="243" alt="Screenshot 2025-12-17 at 1 13 45 PM"
src="https://github.com/user-attachments/assets/9382057e-b443-4474-a9c8-850086d7f3d4"
/>

<img width="691" height="256" alt="Screenshot 2025-12-17 at 1 14 05 PM"
src="https://github.com/user-attachments/assets/a05ff2af-8603-4752-8d12-337dc381c0fd"
/>

## Why
To have a clean and standard UI and remove use of UI deprecated
packages.

## How to test
- Query Editor:
- By creating a new query in a dashboard or Explore and interacting with
all the different query types and drop-downs
     - All drop-downs should be searchable and have placeholders
- Config Editor:
- By going to a datasource and ensuring that the dropdown for Datasource
(when DB connection is enabled) and Auth type are responsive and working
as expected)


Fixes:
https://github.com/orgs/grafana/projects/457/views/40?pane=issue&itemId=3740545830&issue=grafana%7Coss-big-tent-squad%7C139
2025-12-18 14:28:29 +00:00
Jocelyn Collado-Kuri
ce4a8d3e19 Migrate from DatasourceAPI to DatasourceWithBackend (#2123)
This PR migrates the use of `DatasourceApi` to `DatasourceWithBackend`,
with this a couple additional improvements were made:

1. Migrate to use `interpolateVariablesInQuery` everywhere instead of
the custom `replaceTemplateVariables` we were using
2. Moves util functions out of `datasource.ts` and into the existing
`utils.ts`

<img width="1261" height="406" alt="Screenshot 2025-11-20 at 11 37
56 AM"
src="https://github.com/user-attachments/assets/9e396cf2-eab0-49d1-958c-963a2e896eba"
/>

Now we can see the `query` calls being made to the backend:
<img width="367" height="102" alt="Screenshot 2025-11-20 at 11 38 18 AM"
src="https://github.com/user-attachments/assets/a5a9a337-7f19-4f7c-9d04-9d30c0216fb2"
/>

Tested:
- By running queries from Explore and Dashboards (with and without
variables)
- By interacting with all the different Editors to make sure `ComboBox`
was working as expected


Next:
Once this is merged, we will next be able to slowly move away from using
the `ZabbixConnector` to make backend datasource calls.

Fixes:
[#131](https://github.com/orgs/grafana/projects/457/views/40?pane=issue&itemId=139450234&issue=grafana%7Coss-big-tent-squad%7C131)
2025-12-16 09:58:02 -08:00
ismail simsek
cc492b916d Update react-table to v8 (#2131)
Updating react-table to v8. 
- Migrating the existing table to v8
- Preserving the visuals and logic

What's done?
- Cell components are moved under `Cells` folder
- Old styles for react-table-6 is removed.
- Old types are removed
- All logic was preserved
- Some cell components are removed for simplicity


Fixes: https://github.com/grafana/oss-big-tent-squad/issues/125
2025-12-10 19:25:04 +01:00
ismail simsek
3da36ec2bb Chore: Convert problems to functional component (#2125)
This is a prerequisite for ugrading the react-table to v8.
- No logic change is introduced. 
- Update DataSourceRef imports. The old import was deprecated.
2025-12-03 14:55:35 +01:00
Jocelyn Collado-Kuri
89ae290942 Move health check to the backend (#2120)
This PR moves the health check to backend only leaving in the frontend
the functionality to test the dbconnector datasource.

Leaving the `dbconnector.testDataSource` should be fine since the
datasource types we allow for db connection with Zabbix already are
backend datasources, and so their health requests would go through the
backend.

Verified:
Clicking test and seeing a `health` request go out.

IMPORTANT: While testing this in the UI, I found a bug with the config
editor - whenever a change is made in the UI and tested, the changes
don't take effect (i.e. disabling trends, keeps `trends` set to `true`,
enabling db connection keep `dbConnectionEnabled` set to `false` and so
on.). Created a separate
[issue](https://github.com/orgs/grafana/projects/457/views/40?pane=issue&itemId=3627315751&issue=grafana%7Coss-big-tent-squad%7C132)
to fix this

Fixes https://github.com/grafana/oss-big-tent-squad/issues/124
Fixes https://github.com/grafana/grafana-zabbix/issues/2004
2025-11-25 14:54:18 -08:00
Jocelyn Collado-Kuri
86b7328f39 Variables: Allow fetching disabled items for Item type variable (#2109)
This PR adds support for showing disabled items when using the `Item`
type template variable. Similar to how we support disabled items today
in our query editor:


<img width="435" height="254" alt="Screenshot 2025-10-21 at 9 00 11 AM"
src="https://github.com/user-attachments/assets/832537c8-84c3-45fe-a85d-b16c8e15f759"
/>

In this example, the host contains a disabled item `CPU iowait time`

<img width="1763" height="46" alt="Screenshot 2025-10-21 at 9 02 08 AM"
src="https://github.com/user-attachments/assets/85419e88-280d-4dce-baee-bf403e1de05d"
/>

Which we can now show and hide from the variable in Grafana:



https://github.com/user-attachments/assets/eca9327e-40a6-4852-92e9-71ff1ad9ea32

I also removed some deprecated types and packages :)!
Fixes: #2025

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-28 19:57:55 -07:00
Jocelyn Collado-Kuri
045c708c69 Fix: ensure that applicationids parameter only gets passed when the datasource supports it. (#2110)
Zabbix 5.0.x supported filtering `Problems` feature with `applications`.
When this got removed, we removed the filter dropdown from the UI, but
failed to check whether applications were supported before sending out
the request with the parameters.

This was causing dashboards that had been created with zabbix version
`5.0.x` to fail when querying with newer versions of our plugin with
error: `Invalid params. Invalid parameter "/": unexpected parameter
"applicationids".`

These changes now ensure that we also check whether applications filter
should be supported before sending the backend request to fetch
problems.

How to test:
- use the attached JSON file. This was created using zabbix50 and
applying an `applicationids` filter for `Problems` query type OR

- run the `zabbix50` test environment:
    ```
       cd devenv/zabbix50
       docker-compose up -d
    ```
- create a dashboard that queries for `Problems` and filters with
applications then export the dashboard JSON
- stop the `zabbix50` test environment and start the `zabbix74` test
environment
    ```
          docker-compose stop
          cd ../zabbix74
          docker-compose up -d
     ```
- import the dashboard you created above, it should load and work as
expected.


Bottom panel was created using zabbix50 and it used the application
filter. Both panels now load as expected:
<img width="2558" height="1018" alt="Screenshot 2025-10-21 at 2 28
25 PM"
src="https://github.com/user-attachments/assets/9613d59b-3f88-420c-9897-f8d988b3d2f0"
/>

Fixes https://github.com/grafana/grafana-zabbix/issues/1852
2025-10-28 19:57:45 -07:00
HH-Harry
b7adcea1fb More info about acknowledges from zabbix (#2071)
This PR is trying to add functionality requested in [#2061 More info
about acknowledges from
zabbix](https://github.com/grafana/grafana-zabbix/issues/2061)

### Key features

- already described in [Enhancement
request](https://github.com/grafana/grafana-zabbix/issues/2061)

### How It Works

- using bitwise AND checks of [**action** field in zabbix
event.acknowledges](https://www.zabbix.com/documentation/current/en/manual/api/reference/event/acknowledge)
keywords are added at beginning of ack.message field on problem panel in
grafana in fllowing order:
  - (un)acknowledged
  - (un)supressed
  - changed severity

### Testing
- No testing was done, sorry

---------

Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
2025-09-18 14:18:47 +02:00
github-actions[bot]
b13d567eee chore: bump @grafana/create-plugin configuration to 5.26.4 (#2082)
Bumps
[`@grafana/create-plugin`](https://github.com/grafana/plugin-tools/tree/main/packages/create-plugin)
configuration from 4.2.1 to 5.26.4.

**Notes for reviewer:**
This is an auto-generated PR which ran `@grafana/create-plugin update`.
Please consult the create-plugin
[CHANGELOG.md](https://github.com/grafana/plugin-tools/blob/main/packages/create-plugin/CHANGELOG.md)
to understand what may have changed.
Please review the changes thoroughly before merging.

---------

Co-authored-by: grafana-plugins-platform-bot[bot] <144369747+grafana-plugins-platform-bot[bot]@users.noreply.github.com>
Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
2025-09-17 20:33:12 +02:00
Zoltán Bedi
e76741b453 Fix: alias functions in Services query type (#2078) 2025-09-17 20:22:12 +02:00
Zoltán Bedi
b95859cf52 Fix: Functions dropdown positioning (#2073)
Now it uses the position where it have enough space for it. Also removed
the input component as it didn't do anything.

<img width="2032" height="1167" alt="Screenshot 2025-09-05 at 14 29 00"
src="https://github.com/user-attachments/assets/0f75e4c3-ae7d-4200-b76c-e1f781f339ac"
/>

Fixes #2069
2025-09-15 20:12:36 +02:00
Zoltán Bedi
9089067e03 Fix: slaid is missing error (#2077)
In order to reproduce this you need to create a Service and an SLO. The
bug appears when an SLO is not set.


Fixes #1784
2025-09-15 20:11:59 +02:00
William Fitzjohn
c35fc5c41e Fix: [#2042] replaceAlias function ordering in the query editor causing buggy ui interactions (#2043)
Resolves #2042
Fixed a bug that caused strange behaviour when adding multiple
replaceAlias functions
2025-09-09 13:14:42 +02:00
Pavel Chalyk
b42bd2e3c2 Set correct link to the documentation (#2068)
* Link the PR to the related issue
https://github.com/grafana/grafana-zabbix/issues/2067
2025-08-08 08:25:37 +02:00
Kristina
cfe806fc05 Forward refID to resultant dataframe (#2065)
Fixes #1982

With a refID of `test test`
<img width="273" height="223" alt="Screenshot 2025-08-06 at 4 11 41 PM"
src="https://github.com/user-attachments/assets/1c20e70d-f2d2-40e7-a494-20aa4e1c3d07"
/>

Before
<img width="291" height="193" alt="Screenshot 2025-08-06 at 4 18 40 PM"
src="https://github.com/user-attachments/assets/b5ccb244-ac92-4929-b589-e5d01eebfad6"
/>

After
<img width="218" height="208" alt="Screenshot 2025-08-06 at 4 11 33 PM"
src="https://github.com/user-attachments/assets/6b0049b0-6829-4599-82dd-5af001e94690"
/>
2025-08-07 10:11:32 +02:00
Hugo Häggmark
6cc6dcabe1 Chore: removes props mutation (#2056)
While investigating some potential mutations
[here](https://ops.grafana-ops.net/d/83f4951f-2ef3-4260-91a0-39a031992b75/getmutationobserverproxy-logs)
I was able to find these mutating
[lines](https://github.com/grafana/grafana-zabbix/blob/main/src/datasource/components/ConfigEditor.tsx#L55-L57)

Although this works right now, this might not work in future Grafana
versions. This PR makes sure we don't mutate the props.

I haven't been able to test this manually so I could use some help to
make sure the plugin works as expected.

---------

Co-authored-by: ivanahuckova <ivana.huckova@gmail.com>
2025-07-18 12:14:27 +02:00
Zoltán Bedi
bb6ade69c8 Fix: Update Zabbix API connector to handle versioning for 'with_hosts' parameter (#2049)
This changes the version number for `with_hosts` to return `real_hosts`
when version is 6.0.0 or below.

In 6.2 `real_hosts` is deprecated.
https://www.zabbix.com/documentation/6.2/en/manual/api/reference/hostgroup/get

In 6.0 it isn't.
https://www.zabbix.com/documentation/6.0/en/manual/api/reference/hostgroup/get

Fixes https://github.com/grafana/grafana-zabbix/issues/2048
2025-07-10 17:28:04 +02:00
Christos Diamantis
30c0b0e982 Ability to execute "Manual event actions" on Zabbix Problems panel (#2024)
This PR resolves the below issues:
#2022 #1465 

Specifically, when executing a script on the problems panel, we do check
if the script scope is event or host.
Based on the script scope, the Zabbix API call is constructed
differently.

---------

Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
2025-07-09 13:56:14 +00:00
Sriram
8051b1408c [Bug fix] handle multiple service status (#2037)
Fixes https://github.com/grafana/grafana-zabbix/issues/2036

## Before fix

<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/e698a571-9e4b-4fbb-824e-7d7dc1b77137"
/>

## After fix

<img width="1397" alt="image"
src="https://github.com/user-attachments/assets/99882c1e-926a-4667-86cb-8b0f3468dac7"
/>
2025-06-18 10:30:05 +01:00
Zoltán Bedi
301326084a Fix: Variable item not filtering for item tag (#2006)
Fixes #1930
Fixes #1543 
Fixes #1329 

TODO

- [x] Add test
2025-05-09 20:08:44 +00:00
Zoltán Bedi
8136184a54 Fix: d.for.Each is not a function errors (#2005)
Fixes #2002
2025-05-05 13:58:42 +02:00
Zoltán Bedi
c0d212d3ae Feat: add option to show data source name (#2007)
Original [PR](https://github.com/grafana/grafana-zabbix/pull/2003)

Fixes #1766

---------

Co-authored-by: olaf <olaf@initworks.com>
2025-05-05 13:39:04 +02:00
Zoltán Bedi
8d06e049fb Enhance error handling in health check (#1998) 2025-03-25 12:12:40 +01:00
Zoltán Bedi
6034153046 Fix: host groups not showing in problems panel (#1965)
This PR fixes 2 issues mentioned below.
Fixes #1943
Fixes #1946

## Problems Panel not showing host groups:


[src/panel-triggers/components/Problems/Problems.tsx](0355f40fc2/src/panel-triggers/components/Problems/Problems.tsx)

![Image](https://github.com/user-attachments/assets/2d5d8207-dcd6-4e80-aef3-a9eadf4d3dc9)

### How to reproduce

1. Go to `Zabbix data source features` dashboard
2. Open Problems panel
3. In the panel config enable host groups field
4. Host groups should show up in the table

## Triggers not showing


![Image](https://github.com/user-attachments/assets/4319ebc1-bbdb-4648-b7d5-269e82351804)

### How to reproduce

1. Go to explore and select the zabbix ds
2. Select `Triggers` Query type
3. Add `Backend` as a group
4. Add `/.*/` as host
5. There should be 2 average triggers
2025-02-24 17:54:34 +01:00
Sriram
f4376363eb Fix problems panel broken when selecting triggers (#1960)
This PR fixes an issue where the problems panel breaks when you change
to query type to `Triggers`.

![](https://grafana.zendesk.com/attachments/token/MNBgVTPRKZkwa6TsMBbtBQdIp/?name=image.png)

How to reproduce:

1. Go to `Zabbix data source features` dashboard
2. Open Problems panel
3. Change`Query type` to `Triggers`
4. Select `Problems` from `Count by`
5. Change the `Group` to `Backend`
6. The problems panel should not error

---------

Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
2025-02-24 11:01:08 +01:00
Ivana Huckova
25354eea40 Release version 5.0.0: plugin now requires Grafana 10.4.8+ (#1945)
Changes:

- Use 10.4.8 as minimal supported Grafana version in plugins that
previously supported v9.
- Bump version to 5.0.0 as we are changing min supported Grafana version
2025-01-29 12:30:06 +01:00
yesoreyeram
374c83d17d initial fix 2025-01-03 09:18:37 +00:00
Ivana Huckova
dbcc008489 Fix querying and authentication for Zabbix v7.0+ (#1931)
* Fix querying for Zabbix v7.2+

* Update check from 7.2 to 7.0

* Fix also select acknowledges key

* Remove unsused methods

* release commit 4.6.0

---------

Co-authored-by: yesoreyeram <153843+yesoreyeram@users.noreply.github.com>
2024-12-17 01:02:43 +00:00
Ivana Huckova
3fa881d32b Merge pull request #1922 from grafana/ivana/deprecate-experimental
Replace `@grafana/experimental` with `@grafana/plugin-ui`
2024-11-28 14:38:39 +01:00
Sriram
e3c3c11e41 host id as alias function (#1913) 2024-11-27 10:32:48 +00:00
Ivana Huckova
fa7fca74a4 Replace @grafana/experimental with @grafana/plugin-ui 2024-11-26 16:53:15 +01:00
Sriram
2c41cea0c4 fixed a bug where mixed datasource with variable ref were not working (#1909) 2024-11-12 09:48:23 +00:00
Sriram
b27194930c fixed a bug where multiple SLA queries not handled correctly (#1910)
* fixed a bug where multiple SLA queries not handled correctly

* added test
2024-11-12 09:38:27 +00:00
Zoltán Bedi
a3adaaf25e Migrate example dashboards to more recent version 2024-10-17 11:30:11 +02:00
Ashley Harrison
fb1e764b0e move missing styles into plugin 2024-10-15 10:54:06 +01:00
Will Browne
b43ec24f32 add nested plugin paths to includes 2024-06-21 09:58:25 +01:00
Zoltán Bedi
09e12a0626 Fix: Problems panel failing for versions before 7.0.0 (#1840)
* Fix: Problems panel failing for versions before 7.0.0

* Add tests

* Use spy instead of new argument
2024-06-18 08:55:17 +01:00
Zoltán Bedi
7b97265ba4 Update src/datasource/plugin.json
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2024-06-13 15:37:18 +02:00
Will Browne
712a3e6581 remove relative path info from executable field 2024-06-12 14:50:57 +01:00
Zoltán Bedi
aecdb4bbee Add support for v7 (#1835)
* Add support for v7

* Bump version
2024-06-10 14:53:15 +02:00
Sriram
3ebc05d242 fixes for scenes framework (#1822)
* removed scenes object from caching hash

* update backend deps
2024-04-29 11:45:10 +01:00
Gareth Dawson
965a990501 commit 2024-04-08 12:08:39 +01:00
Sriram
c4065fb0f3 config updates (#1800)
* cleanup

* update create plugin config and query help fix

* query types file

* Update docker-compose.yml

Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>

* addressed review comments

---------

Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
2024-03-13 15:20:53 +00:00
Zoltán Bedi
a5fbbda757 Fix: API token reset not working (#1797) 2024-03-06 14:36:08 +01:00
Sriram
a7c2672020 Merge pull request #1763 from grafana/docs-website-update
Docs website update
2024-01-10 13:27:46 +00:00
Gábor Farkas
541ba8cd82 handle changed postgres-plugin-id 2024-01-08 15:47:41 +01:00
Sriramajeyam Sugumaran
ef24d1fcb4 setup docs hirearchy 2023-12-20 11:32:04 +00:00
Sriramajeyam Sugumaran
94c5afc5d4 moved documentation 2023-12-20 07:10:48 +00:00
Gareth Dawson
3654866fc4 Merge pull request #1743 from grafana/gareth/legacy-forms
legacy form migration
2023-11-20 10:07:39 +00:00