Commit Graph

50 Commits

Author SHA1 Message Date
Wesley van Tilburg
4c29637fde Add Trigger and Problem structs
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 09:36:08 +00:00
Zoltán Bedi
05ab443cef fix(zabbix): prevent silent removal of itemTagFilter when no tags match regex (#2248)
Added a test to ensure that when a regex itemTagFilter does not match
any tags, the GetItems function returns an empty list instead of all
items. This addresses a bug where an empty tag filter would lead to
unintended behavior by removing the filter silently.

Fixes #2247
2026-01-26 09:50:49 +01:00
Jocelyn Collado-Kuri
0d64736e86 Adds support for host tags (#2140)
## Sumary
When dealing with multiple hosts, it can be hard for customers filter
through and figure out which host to query metric data from. This PR
aims to make this easier by adding support for host tags so that there
is another layer of filtering / grouping applied for hosts.

## Detailed explanation
- Adds new UI components to allow adding one or more host tag filter,
and a switch to choose between `AND/OR` and `OR` operators when using
more than one filter following Zabbix's UI:
  

https://github.com/user-attachments/assets/c971f5eb-7e93-4238-bd6b-902cc657c014


https://github.com/user-attachments/assets/5f8996de-684e-4ffa-b98e-8e205c4fc1df

- Modifies the existing `getHosts` function to make a call to the
backend with a few additional parameters to `extend` (essentially
extract) the host tags for a given selected group. No backend changes
were required for this.

## Why
To make it easier for customers to query metric data when dealing with
multiple hosts.

## How to test
- Go to explore or a dashboard and create a Zabbix query where the query
type is `Metrics`
- The easiest way to test is by selecting `/.*/` for Groups, checking
the returned `Hosts` they should all be there
- Add a host tag filter and change the keys and operators as well as
switching from `AND/OR` to `OR` you should see how the values returned
for `Host` changes

## Future work
Adding variable support for host tags once this is completed.

Fixes:
https://github.com/orgs/grafana/projects/457/views/40?pane=issue&itemId=3609900134&issue=grafana%7Coss-big-tent-squad%7C126
and https://github.com/grafana/grafana-zabbix/issues/927

---------

Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
2026-01-05 05:30:55 -08:00
Jocelyn Collado-Kuri
e073382983 Fix always fetch Zabbix version before issuing new requests (#2133)
Previously we were only fetching the version when the version was `0`.
This generally worked, but posed some problems when customers were
updating their Zabbix version, specifically when upgrading from a
version < `7.2.x` to `7.2.x` or above.

Before `7.2.x`, an `auth` parameter was still supported when issuing a
zabbix request, this was deprecated in `6.4.x` and later removed in
`7.2.x`. When a user was on a version < `7.2.x` all the outgoing
requests would add this `auth` parameter. When upgrading to `7.2.x` this
was a problem, because the version was not `0`, hence, not requiring
getting the version again, but also because we were still building the
request considering an older version and adding the `auth` parameter,
when this was no longer supported.

This PR removes the check for `version == 0`, though this now means that
every request that goes out will check the version before hand, I think
this will give us a more accurate representation of the version that
needs to be used.

fixes
https://github.com/orgs/grafana/projects/457/views/40?pane=issue&itemId=3683181283&issue=grafana%7Coss-big-tent-squad%7C135
2025-12-05 17:34:20 -08: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
Kristian Bremberg
6580bf8f6e Refactor regex pattern validation to use timeout-based approach (#2090)
- Remove isPathologicalRegex function and replace with MatchTimeout
- Simplify parseFilter by relying on runtime timeout protection
- Add comprehensive timeout test for pathological regex patterns
- Set 5-second timeout for all compiled regex operations
2025-09-24 14:27:16 +02:00
Zoltán Bedi
5db35450a2 Fix: Remove regex pattern length restriction (#2087)
In this PR I removed the regex pattern length restriction because from
multi value variables this length can be easly reached, also if the
regex is going to be too long it will be caught in the timeout.

Fixes #2086
2025-09-23 11:51:31 +02:00
Zoltán Bedi
6a1d3b6abe Add regex safety checks and tests for pathological patterns (#2083) 2025-09-17 23:16:55 +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
Ivana Huckova
58902e7ed9 Release 5.0.2 with error source fix for some downstream errors (#1980)
This PR fixes error source for 2 errors:
- parsing of invalid json response should be downstream error as we
expect to receive valid json from zabbix
- no host found error should be downstream. We are bumping sdk that
includes that fix
https://github.com/grafana/grafana-plugin-sdk-go/pull/1246.

As you can see - the invalid json parsing is now downstream error
<img width="1498" alt="image"
src="https://github.com/user-attachments/assets/88028dbe-0f73-47aa-8262-5729059ce12f"
/>
2025-02-27 12:30:19 +01:00
Zoltán Bedi
c2ffd31b1a Add error source (#1954)
Fixes  #1879
2025-02-04 12:40:33 +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
Muhammad Iqbal Alaydrus
dfe360bf1d item.get cache won't be hit if tags order are different (#1745)
* cache won't be hit if tags order are not the same

* unit test for get items with tags
2023-12-04 13:46:11 +01:00
Alexander Zobnin
c06683cd37 Fix backend linter errors 2023-08-30 12:48:38 +02:00
Alexander Zobnin
cef0a2e157 Fix app filter returning all items in case of wrong app, #1597 2023-08-01 13:13:51 +02:00
Alexander Zobnin
ac976945a5 Auth: Able to use API tokens for authentication (#1662)
* Auth: Able to use API tokens for authentication

* Update change log
2023-07-26 17:23:44 +02:00
Alexander Zobnin
24285a9483 Fix item tag filter, #1594 2023-03-23 14:40:22 +01:00
Alexander Zobnin
dd6798834a Improve tags performance (#1526)
Co-authored-by: Erik De Neve <erik.de.neve@telenet.be>
2023-03-21 12:28:34 +01:00
Alexander Zobnin
799875866a Fix matching 2022-09-01 10:30:55 +03:00
Alexander Zobnin
459722d0e4 Merge branch 'regexp2' of github.com:thetuxkeeper/grafana-zabbix into thetuxkeeper-regexp2 2022-09-01 09:38:40 +03:00
Alexander Zobnin
5777c2dd0f Query object ids explicitly 2022-07-12 09:18:16 +03:00
Alexander Zobnin
d2645a43b2 Fix fetching host groups, #1470 2022-07-08 14:48:57 +03:00
Daniel Poßmann
4fa13c9b87 extended parseFilter tests 2022-07-07 14:28:55 +02:00
Daniel Poßmann
70055b0682 switch to regexp2 for parsed filter 2022-07-07 14:28:55 +02:00
Alexander Zobnin
c0a33f2e7e Fix show disabled items toggle, closes #1249 2022-05-04 12:08:54 +03:00
Alexander Zobnin
8b0174f8a7 Implement internal plugin metric collection 2022-04-28 13:08:53 +03:00
Alexander Zobnin
c70c9e9ef6 Refactor: define slices with make() 2022-04-27 14:01:42 +03:00
Alexander Zobnin
37280079ac Fix returning apps when no host found, fixes #1427 2022-04-27 13:48:20 +03:00
Alexander Zobnin
0a4714f9e9 Fix parsing regex, #1318 2022-02-16 17:59:56 +03:00
Alexander Zobnin
78fe0dd7a9 Fix expanding item name with unicode params, fixes #1269 2021-08-25 12:06:25 +03:00
Alexander Zobnin
5ed80a60e7 Fix parsing timeout (use number instead of string), fixes #1254 2021-08-11 13:32:37 +03:00
Alexander Zobnin
63d2954f91 Cache valuemap.get request 2021-08-10 14:18:33 +03:00
Alexander Zobnin
abe45790f3 Remove unused debug logging 2021-08-10 14:14:28 +03:00
Alexander Zobnin
00e33fcc49 Fix using value mapping from zabbix, closes #1222 2021-08-10 13:41:56 +03:00
Alexander Zobnin
8efc020f33 Fix filtering by application 2021-08-10 12:51:43 +03:00
Alexander Zobnin
07721706f4 Don't query version if error happened 2021-08-09 16:36:15 +03:00
Alexander Zobnin
915973829d Support item tags, fixes #1258 2021-08-09 14:57:49 +03:00
Alexander Zobnin
4855cd0122 Fix codespell 2021-08-06 14:43:03 +03:00
Alexander Zobnin
c81a6ae8c3 Use backend queries for item id mode 2021-06-01 13:01:54 +03:00
Alexander Zobnin
7d5b7cad3e Align time series data if possible 2021-05-31 17:42:24 +03:00
Alexander Zobnin
7748508a5c Use time series format internally 2021-05-24 17:11:36 +03:00
Alexander Zobnin
e7a386cf8a Refactor history/trend queries 2021-05-24 15:31:56 +03:00
Alexander Zobnin
94b5c88366 Fix item filtering 2021-05-24 11:20:14 +03:00
Alexander Zobnin
37573e0152 Refactor filters 2021-05-24 10:46:28 +03:00
Alexander Zobnin
65e32c3b10 Refactor tests 2021-05-19 15:52:09 +03:00
Alexander Zobnin
badecc3aae Refactor: zabbix client 2021-05-19 13:17:46 +03:00
Alexander Zobnin
7990613e2c reorganize packages and add tests for zabbix datasource instance methods 2020-06-04 11:43:20 +03:00
Alexander Zobnin
61fee6ea12 Data queries (alerting) 2020-05-29 17:49:18 +03:00
vignesh-reddy
3f5719794a Backend: implement alerting query (#847)
* Unit tests for backend

* minor change

* Implemented querNumericItems in backend

* Added query type

* Set alerting to true

* Return TimeSeries from History

* Updated alerting feature

* Fix params marshal error

* Fix params more

* Update zabbixAPIConnector.js

* Numbers, I guess

* Params Output Type

* Output marshaling

* Unmarshal and decoder error catch

* HistoryPoint and Unmarshal fixes

* Unmarshal to History

* Revert "Update zabbixAPIConnector.js"

This reverts commit e0ffdff859b6f920893a47a709493f8076e38ef4.

* Fix unmarshaling for real

* Time range integer

* Use more zabbix.Items

* Update response_models.go

* Update zabbix_api.go

* Update models.go

* Update zabbix_api.go

* Tests

* Adding more unit tests and cleaning up additional logging

* Make history request param a pointer

* Actually store datasource in cache

* Debug logs and timings

* Handle panics gracefully

* Updated Regex filter parsing

* Removed must compile

* Clean up regex filter
2020-01-13 10:38:24 +03:00