44 Commits

Author SHA1 Message Date
renovate-sh-app[bot]
3ea69e2f8e fix(deps): update module golang.org/x/net to v0.48.0 (#2176)
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [golang.org/x/net](https://pkg.go.dev/golang.org/x/net) | [`v0.46.0` →
`v0.48.0`](https://cs.opensource.google/go/x/net/+/refs/tags/v0.46.0...refs/tags/v0.48.0)
|
![age](https://developer.mend.io/api/mc/badges/age/go/golang.org%2fx%2fnet/v0.48.0?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/go/golang.org%2fx%2fnet/v0.46.0/v0.48.0?slim=true)
|

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

## Need help?
You can ask for more help in the following Slack channel:
#proj-renovate-self-hosted. In that channel you can also find ADR and
FAQ docs in the Resources section.

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi42NC4xIiwidXBkYXRlZEluVmVyIjoiNDIuNjQuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsidXBkYXRlLW1pbm9yIl19-->

---------

Signed-off-by: renovate-sh-app[bot] <219655108+renovate-sh-app[bot]@users.noreply.github.com>
Co-authored-by: renovate-sh-app[bot] <219655108+renovate-sh-app[bot]@users.noreply.github.com>
Co-authored-by: Jocelyn Collado-Kuri <jcolladokuri@icloud.com>
2026-01-09 10:45:48 +01:00
ismail simsek
04fca562b0 feat(backend): Add query guardrails to prevent potential issues (#2149)
## Summary

Implements query guardrails in the backend to prevent execution of
expensive or malformed queries that could impact customer environments.

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

## Changes

### New guardrails added:

1. **Item ID validation** (`queryItemIdData`)
   - Validates that item IDs are non-empty
   - Validates that item IDs contain only numeric values

2. **Time range validation** (`QueryData`)
   - Validates that `From` timestamp is before `To` timestamp

3. **API method allowlist** (`ZabbixAPIHandler`)
- Only allows Zabbix API methods defined in the frontend type
`zabbixMethodName`
   - Blocks any write/delete/update operations not in the allowlist

### New files:
- `pkg/datasource/guardrails.go` - Validation functions and error
definitions
- `pkg/datasource/guardrails_test.go` - Unit tests for all validation
functions

### Modified files:
- `pkg/datasource/datasource.go` - Added time range validation
- `pkg/datasource/zabbix.go` - Added item ID validation  
- `pkg/datasource/resource_handler.go` - Added API method validation

## Reasoning
- Allowed functions might be unnecessary as we've already prevent using
those in
[types.ts](https://github.com/grafana/grafana-zabbix/blob/main/src/datasource/zabbix/types.ts#L1-L23)
but it's nice to be cautious.
- itemid and time validation is just for sanity. 
- Time range validation will be necessary in the future to warn user
agains running expensive queries.
2025-12-29 18:57:17 +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
Alexander Zobnin
c06683cd37 Fix backend linter errors 2023-08-30 12:48:38 +02: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
cf6b19e189 Query option to override use trends option, fixes #1442 2022-12-29 14:07:02 +01:00
Alexander Zobnin
7153a83926 Fix data processing when trend data fetched from DB, closes #1445 2022-05-06 12:43:46 +03:00
Alexander Zobnin
c0a33f2e7e Fix show disabled items toggle, closes #1249 2022-05-04 12:08:54 +03:00
Alexander Zobnin
1f98dc7f4c Skip alignment only if item interval twice less than query interval 2021-09-23 13:43:33 +03:00
Alexander Zobnin
9133b0aaed Skip data alignment if item interval less than query interval 2021-09-23 12:52:21 +03:00
Alexander Zobnin
c00a0e1c3f Fix db connection query post processing 2021-09-20 17:56:26 +03:00
Alexander Zobnin
3f77f14d05 Sort trend data, fixes #1300 2021-09-15 17:14:35 +03:00
Alexander Zobnin
fcef21b0fb Interpolate series to make stacking work properly in case of different intervals, #1211 2021-09-15 16:06:53 +03:00
Alexander Zobnin
ee5223f0ab Align multiple series to the same interval with interpolation, fix #1211 2021-08-25 11:19:19 +03:00
Alexander Zobnin
00e33fcc49 Fix using value mapping from zabbix, closes #1222 2021-08-10 13:41:56 +03:00
Alexander Zobnin
915973829d Support item tags, fixes #1258 2021-08-09 14:57:49 +03:00
Alexander Zobnin
2a836b9ecd Don't align IT services data 2021-08-06 13:22:43 +03:00
Alexander Zobnin
d1f639f568 Fix data alignment on the backend 2021-08-06 11:50:06 +03:00
Alexander Zobnin
e12b8cbefb Handle db connection response on the backend 2021-08-04 18:07:38 +03:00
Alexander Zobnin
16fe4795b3 Disable alignment for trend data 2021-06-01 13:16:22 +03:00
Alexander Zobnin
c81a6ae8c3 Use backend queries for item id mode 2021-06-01 13:01:54 +03:00
Alexander Zobnin
7276e4ba09 Fix handling null interval 2021-05-31 18:25:12 +03:00
Alexander Zobnin
f908ab7264 Downsample data 2021-05-31 18:15:01 +03:00
Alexander Zobnin
7d5b7cad3e Align time series data if possible 2021-05-31 17:42:24 +03:00
Alexander Zobnin
98b6a34fb1 Fix trend values count and sum 2021-05-28 11:54:43 +03:00
Alexander Zobnin
4e6a77cad0 Fix trendValue/consolidateBy 2021-05-28 11:38:31 +03:00
Alexander Zobnin
43e9527a0f Implement timeShift 2021-05-27 14:16:10 +03:00
Alexander Zobnin
9a63a1f70f Return multiple frames (frame per series) 2021-05-27 13:28:14 +03:00
Alexander Zobnin
24e9129fbe Implement sortSeries 2021-05-27 12:57:09 +03:00
Alexander Zobnin
62d569cd53 Implement percentileAgg 2021-05-27 10:13:48 +03:00
Alexander Zobnin
3f7cabcd53 initial pipeline for functions processing 2021-05-24 17:46:49 +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
b42d665e9e Refactor: remove unused types 2021-05-19 18:15:29 +03:00
Alexander Zobnin
badecc3aae Refactor: zabbix client 2021-05-19 13:17:46 +03:00
Alexander Zobnin
68c7e20d27 Merge branch 'master' into backend-functions 2021-05-19 09:08:05 +03:00
Alexander Zobnin
3410593f9e Fix compatibility with Zabbix 5.4 (skip applications filter) (#1214)
* Fix queries in Zabbix 5.4 (applications not supported)

* Fix alerting queries in Zabbix 5.4
2021-05-18 17:22:49 +03:00
Alexander Zobnin
8cdc2a3ae9 rename convertHistory 2021-03-09 18:23:34 +03:00
Alexander Zobnin
83618178f0 Use Data frames response format (#1099)
* Use data frames for numeric data

* Use data frames for text data

* Use data frames for IT services

* fix multiple series

* Convert to the wide format if possible

* Fix table format for text data

* Add refId to the data frames

* Align time series from Zabbix API

* Fill gaps with nulls

* Fix moving average functions

* Option for disabling data alignment

* remove unused logging

* Add labels to data frames

* Detect units

* Set min and max for if percent unit used

* Use value mapping from Zabbix

* Rename unitConverter -> convertZabbixUnit

* More units

* Add missing points in front of each series

* Fix handling table data

* fix db connector data frames handling

* fix it services data frames handling

* Detect all known grafana units

* Chore: remove unused logging

* Fix problems format

* Debug logging: show original units

* Add global option for disabling data alignment

* Add tooltip for the disableDataAlignment feature

* Add note about query options

* Functions for aligning timeseries on the backend
2020-12-22 15:33:14 +03:00
Alexander Zobnin
d6b8992433 Refine log messages 2020-08-25 13:36:36 +03:00
Alexander Zobnin
620c60b1f5 Add debug message in case of expired auth token 2020-06-04 18:31:09 +03:00
Alexander Zobnin
516b4f2045 fix expired token renewal 2020-06-04 17:53:10 +03:00
Alexander Zobnin
95c8e9cfa6 move cache to datasource_cache 2020-06-04 12:10:34 +03:00
Alexander Zobnin
7990613e2c reorganize packages and add tests for zabbix datasource instance methods 2020-06-04 11:43:20 +03:00