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
2024-11-27 10:32:48 +00:00
2025-02-04 18:04:07 +07:00
2023-09-28 15:48:41 +02:00
2017-07-25 00:03:52 +03:00
2025-10-17 09:47:21 +00:00
2025-09-18 16:36:00 +02:00
2024-01-08 17:45:55 +00:00
2024-02-06 08:14:06 +00:00

Zabbix plugin for Grafana

Version Change Log Docs

Dashboard

Features

  • Select multiple metrics by using Regex
  • Create interactive and reusable dashboards with template variables
  • Show events on graphs with Annotations
  • Display active problems with Triggers panel
  • Transform and shape your data with metric processing functions (Avg, Median, Min, Max, Multiply, Summarize, Time shift, Alias)
  • Find problems faster with Alerting feature
  • Mix metrics from multiple data sources in the same dashboard or even graph
  • Discover and share dashboards in the official library

See all features overview and dashboards examples at Grafana-Zabbix Live demo site. Visit plugins page at grafana.com and check out available Grafana data sources, panels and dashboards.

Installation

Install by using grafana-cli

grafana-cli plugins install alexanderzobnin-zabbix-app

Or see more installation options in docs.

Getting started

First, configure Zabbix data source. Then you can create your first dashboard with step-by-step Getting started guide.

Documentation

Community Resources, Feedback, and Support

  • Found a bug? Want a new feature? Feel free to open an issue.
  • Have a question? You also can open issue, but for questions, it would be better to use Grafana Community portal.
Description
grafana zabbix fork
Readme Apache-2.0 18 MiB
Languages
TypeScript 68.4%
Go 22.8%
SCSS 5.3%
JavaScript 1.3%
Python 1%
Other 1.1%