From dbcc0084895f3e71128bd26a407210d3edad63e9 Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Tue, 17 Dec 2024 02:02:43 +0100 Subject: [PATCH] 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> --- CHANGELOG.md | 8 + devenv/zabbix72/bootstrap/Dockerfile | 17 + devenv/zabbix72/bootstrap/bootstrap_config.py | 75 +++ .../zabbix72/bootstrap/zbx_export_hosts.json | 427 +++++++++++++++++ .../zabbix72/bootstrap/zbx_export_hosts.xml | 432 ++++++++++++++++++ devenv/zabbix72/docker-compose.yml | 118 +++++ go.mod | 40 +- go.sum | 89 ++-- package.json | 2 +- pkg/zabbix/methods.go | 8 +- pkg/zabbix/zabbix.go | 6 +- pkg/zabbixapi/zabbix_api.go | 31 +- pkg/zabbixapi/zabbix_api_test.go | 10 +- .../zabbix_api/zabbixAPIConnector.test.ts | 26 ++ .../zabbix_api/zabbixAPIConnector.ts | 21 +- 15 files changed, 1226 insertions(+), 84 deletions(-) create mode 100644 devenv/zabbix72/bootstrap/Dockerfile create mode 100644 devenv/zabbix72/bootstrap/bootstrap_config.py create mode 100644 devenv/zabbix72/bootstrap/zbx_export_hosts.json create mode 100644 devenv/zabbix72/bootstrap/zbx_export_hosts.xml create mode 100644 devenv/zabbix72/docker-compose.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 5149f9b17..458f2e745 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## [4.6.0] - 2024-12-16 + +- Feature: Added support for Zabbix 7. ( Fixes [#1914](https://github.com/grafana/grafana-zabbix/issues/1914) ) +- Feature: Host ID alias function `$__zbx_host_id` ([#1913](https://github.com/grafana/grafana-zabbix/pull/1913)) +- Bug Fix: Fixed a bug where mixed datasource with variable ref were not working #1909 +- Bug Fix: Fixed a bug where multiple SLA queries not handled correctly #1910 +- Chore: Updated grafana plugin SDK + ## [4.5.7] - 2024-10-30 - Chore: Bump uplot to 1.6.31 diff --git a/devenv/zabbix72/bootstrap/Dockerfile b/devenv/zabbix72/bootstrap/Dockerfile new file mode 100644 index 000000000..ac31af8e7 --- /dev/null +++ b/devenv/zabbix72/bootstrap/Dockerfile @@ -0,0 +1,17 @@ +FROM python:3.12-slim-bullseye + +ENV ZBX_API_URL=http://zabbix-web:8080 +ENV ZBX_API_USER="Admin" +ENV ZBX_API_PASSWORD="zabbix" +ENV ZBX_CONFIG="zbx_export_hosts.json" +ENV ZBX_BOOTSTRAP_SCRIPT="bootstrap_config.py" + +RUN pip install zabbix_utils + +ADD ./bootstrap_config.py /bootstrap_config.py +ADD ${ZBX_CONFIG} /${ZBX_CONFIG} + +WORKDIR / + +# Run bootstrap_config.py when the container launches +CMD ["python", "/bootstrap_config.py"] diff --git a/devenv/zabbix72/bootstrap/bootstrap_config.py b/devenv/zabbix72/bootstrap/bootstrap_config.py new file mode 100644 index 000000000..c75721f50 --- /dev/null +++ b/devenv/zabbix72/bootstrap/bootstrap_config.py @@ -0,0 +1,75 @@ +import os +from zabbix_utils import ZabbixAPI + +zabbix_url = os.environ['ZBX_API_URL'] +zabbix_user = os.environ['ZBX_API_USER'] +zabbix_password = os.environ['ZBX_API_PASSWORD'] +print(zabbix_url, zabbix_user, zabbix_password) + +zapi = ZabbixAPI(zabbix_url) + +for i in range(10): + try: + zapi.login(user=zabbix_user, password=zabbix_password) + print("Connected to Zabbix API Version %s" % zapi.api_version()) + break + except Exception as e: + print(e) + +config_path = os.environ['ZBX_CONFIG'] +import_rules = { + 'discoveryRules': { + 'createMissing': True, + 'updateExisting': True + }, + 'graphs': { + 'createMissing': True, + 'updateExisting': True + }, + 'host_groups': { + 'createMissing': True + }, + 'hosts': { + 'createMissing': True, + 'updateExisting': True + }, + 'images': { + 'createMissing': True, + 'updateExisting': True + }, + 'items': { + 'createMissing': True, + 'updateExisting': True + }, + 'maps': { + 'createMissing': True, + 'updateExisting': True + }, + 'templateLinkage': { + 'createMissing': True, + }, + 'templates': { + 'createMissing': True, + 'updateExisting': True + }, + 'triggers': { + 'createMissing': True, + 'updateExisting': True + }, +} + +print("Importing Zabbix config from %s" % config_path) +with open(config_path, 'r') as f: + config = f.read() + + try: + import_result = zapi.configuration.import_(source=config, format="json", rules=import_rules) + if import_result == True: + print("Zabbix config imported successfully") + else: + print("Failed to import Zabbix config") + except Exception as e: + print(e) + +for h in zapi.host.get(output="extend"): + print(h['name']) diff --git a/devenv/zabbix72/bootstrap/zbx_export_hosts.json b/devenv/zabbix72/bootstrap/zbx_export_hosts.json new file mode 100644 index 000000000..164faf019 --- /dev/null +++ b/devenv/zabbix72/bootstrap/zbx_export_hosts.json @@ -0,0 +1,427 @@ +{ + "zabbix_export": { + "version": "7.0", + "host_groups": [ + { + "uuid": "2e427c268ac1468b9add94b65e2d6c14", + "name": "Backend" + }, + { + "uuid": "d97ba66b283544339628b71975a6e68d", + "name": "Frontend" + }, + { + "uuid": "dc579cd7a1a34222933f24f52a68bcd8", + "name": "Linux servers" + }, + { + "uuid": "6f6799aa69e844b4b3918f779f2abf08", + "name": "Zabbix servers" + } + ], + "hosts": [ + { + "host": "backend01", + "name": "backend01", + "templates": [ + { + "name": "Template ZAS Agent" + } + ], + "groups": [ + { + "name": "Backend" + }, + { + "name": "Linux servers" + } + ], + "interfaces": [ + { + "useip": "NO", + "dns": "zas_backend_01", + "interface_ref": "if1" + } + ], + "tags": [ + { + "tag": "backend" + }, + { + "tag": "service", + "value": "backend" + } + ], + "inventory_mode": "DISABLED" + }, + { + "host": "backend02", + "name": "backend02", + "templates": [ + { + "name": "Template ZAS Agent" + } + ], + "groups": [ + { + "name": "Backend" + }, + { + "name": "Linux servers" + } + ], + "interfaces": [ + { + "useip": "NO", + "dns": "zas_backend_02", + "interface_ref": "if1" + } + ], + "tags": [ + { + "tag": "backend" + }, + { + "tag": "service", + "value": "backend" + } + ], + "inventory_mode": "DISABLED" + }, + { + "host": "frontend01", + "name": "frontend01", + "templates": [ + { + "name": "Template ZAS Agent" + } + ], + "groups": [ + { + "name": "Frontend" + }, + { + "name": "Linux servers" + } + ], + "interfaces": [ + { + "useip": "NO", + "dns": "zas_frontend_01", + "interface_ref": "if1" + } + ], + "tags": [ + { + "tag": "frontend" + }, + { + "tag": "service", + "value": "frontend" + } + ], + "inventory_mode": "DISABLED" + }, + { + "host": "frontend02", + "name": "frontend02", + "templates": [ + { + "name": "Template ZAS Agent" + } + ], + "groups": [ + { + "name": "Frontend" + }, + { + "name": "Linux servers" + } + ], + "interfaces": [ + { + "useip": "NO", + "dns": "zas_frontend_02", + "interface_ref": "if1" + } + ], + "tags": [ + { + "tag": "frontend" + }, + { + "tag": "service", + "value": "frontend" + } + ], + "inventory_mode": "DISABLED" + }, + { + "host": "Zabbix server", + "name": "Zabbix server", + "templates": [ + { + "name": "Linux by Zabbix agent" + }, + { + "name": "Zabbix server health" + } + ], + "groups": [ + { + "name": "Zabbix servers" + } + ], + "interfaces": [ + { + "useip": "NO", + "dns": "zabbix-agent", + "interface_ref": "if1" + } + ], + "inventory_mode": "DISABLED" + } + ], + "template_groups": [ + { + "uuid": "7df96b18c230490a9a0a9e2307226338", + "name": "Templates" + } + ], + "templates": [ + { + "uuid": "2d7a65bb369c48199361913b223b1695", + "template": "Template ZAS Agent", + "name": "Template ZAS Agent", + "templates": [ + { + "name": "Zabbix agent" + } + ], + "groups": [ + { + "name": "Templates" + } + ], + "items": [ + { + "uuid": "e79d4215ec014b74923b905bb8f82410", + "name": "Incoming network traffic on eth0", + "key": "net.if.in[eth0]", + "history": "1d", + "units": "bps", + "tags": [ + { + "tag": "Application", + "value": "Network interfaces" + } + ] + }, + { + "uuid": "18b377dae9fe48d093c16ee7a7c93320", + "name": "Outgoing network traffic on eth0", + "key": "net.if.out[eth0]", + "history": "1d", + "units": "bps", + "tags": [ + { + "tag": "Application", + "value": "Network interfaces" + } + ] + }, + { + "uuid": "2479e055e91c476f9be93b5f363cfa2f", + "name": "Processor load (1 min average per core)", + "key": "system.cpu.load[percpu,avg1]", + "history": "1d", + "value_type": "FLOAT", + "description": "The processor load is calculated as system CPU load divided by number of CPU cores.", + "tags": [ + { + "tag": "Application", + "value": "CPU" + }, + { + "tag": "Application", + "value": "Performance" + } + ], + "triggers": [ + { + "uuid": "60e5484b60ca4061b21bd23f8364bd6e", + "expression": "last(/Template ZAS Agent/system.cpu.load[percpu,avg1])>2", + "name": "Processor load is too high on {HOST.NAME}", + "priority": "WARNING", + "tags": [ + { + "tag": "app", + "value": "performance" + }, + { + "tag": "type", + "value": "cpu" + } + ] + } + ] + }, + { + "uuid": "f0dd4221793c49889cf2789806afa597", + "name": "Processor load (15 min average per core)", + "key": "system.cpu.load[percpu,avg15]", + "history": "1d", + "value_type": "FLOAT", + "description": "The processor load is calculated as system CPU load divided by number of CPU cores.", + "tags": [ + { + "tag": "Application", + "value": "CPU" + }, + { + "tag": "Application", + "value": "Performance" + } + ] + }, + { + "uuid": "9a8b4a1f173b4f209723d820dc2e054a", + "name": "CPU $2 time", + "key": "system.cpu.util[,iowait]", + "history": "1d", + "value_type": "FLOAT", + "units": "%", + "description": "Amount of time the CPU has been waiting for I/O to complete.", + "tags": [ + { + "tag": "Application", + "value": "CPU" + }, + { + "tag": "Application", + "value": "Performance" + } + ], + "triggers": [ + { + "uuid": "ceb468b9eb434fa6bd4c8a5d7507fd87", + "expression": "avg(/Template ZAS Agent/system.cpu.util[,iowait],5m)>20", + "name": "Disk I/O is overloaded on {HOST.NAME}", + "priority": "WARNING", + "description": "OS spends significant time waiting for I/O (input/output) operations. It could be indicator of performance issues with storage system.", + "tags": [ + { + "tag": "disk" + }, + { + "tag": "type", + "value": "disk" + } + ] + } + ] + }, + { + "uuid": "e6d19d47cf60452ead1e791da2d5c0dc", + "name": "CPU $2 time", + "key": "system.cpu.util[,system]", + "history": "1d", + "value_type": "FLOAT", + "units": "%", + "description": "The time the CPU has spent running the kernel and its processes.", + "tags": [ + { + "tag": "Application", + "value": "CPU" + }, + { + "tag": "Application", + "value": "Performance" + } + ] + }, + { + "uuid": "2d81fbc139774306959712a627c99b9a", + "name": "CPU $2 time", + "key": "system.cpu.util[,user]", + "history": "1d", + "value_type": "FLOAT", + "units": "%", + "description": "The time the CPU has spent running users' processes that are not niced.", + "tags": [ + { + "tag": "Application", + "value": "CPU" + }, + { + "tag": "Application", + "value": "Performance" + } + ] + } + ] + } + ], + "graphs": [ + { + "uuid": "7aac0ec0c0e04b7a8bb6472d1faa7a09", + "name": "CPU load", + "ymin_type_1": "FIXED", + "graph_items": [ + { + "color": "009900", + "item": { + "host": "Template ZAS Agent", + "key": "system.cpu.load[percpu,avg1]" + } + }, + { + "sortorder": "2", + "color": "990000", + "item": { + "host": "Template ZAS Agent", + "key": "system.cpu.load[percpu,avg15]" + } + } + ] + }, + { + "uuid": "f25064d88b964a678fac7ea6095b238a", + "name": "CPU utilization", + "show_triggers": "NO", + "type": "STACKED", + "ymin_type_1": "FIXED", + "ymax_type_1": "FIXED", + "graph_items": [ + { + "sortorder": "4", + "drawtype": "FILLED_REGION", + "color": "999900", + "item": { + "host": "Template ZAS Agent", + "key": "system.cpu.util[,iowait]" + } + }, + { + "sortorder": "5", + "drawtype": "FILLED_REGION", + "color": "990000", + "item": { + "host": "Template ZAS Agent", + "key": "system.cpu.util[,system]" + } + }, + { + "sortorder": "6", + "drawtype": "FILLED_REGION", + "color": "000099", + "item": { + "host": "Template ZAS Agent", + "key": "system.cpu.util[,user]" + } + } + ] + } + ] + } +} diff --git a/devenv/zabbix72/bootstrap/zbx_export_hosts.xml b/devenv/zabbix72/bootstrap/zbx_export_hosts.xml new file mode 100644 index 000000000..8b1ddb776 --- /dev/null +++ b/devenv/zabbix72/bootstrap/zbx_export_hosts.xml @@ -0,0 +1,432 @@ + + + 6.2 + 2022-04-28T13:04:18Z + + + 2e427c268ac1468b9add94b65e2d6c14 + Backend + + + d97ba66b283544339628b71975a6e68d + Frontend + + + dc579cd7a1a34222933f24f52a68bcd8 + Linux servers + + + 6f6799aa69e844b4b3918f779f2abf08 + Zabbix servers + + + 7df96b18c230490a9a0a9e2307226338 + Templates + + + + + backend01 + backend01 + + + + + + Backend + + + Linux servers + + + + + NO + zas_backend_01 + if1 + + + + + backend + + + service + backend + + + DISABLED + + + backend02 + backend02 + + + + + + Backend + + + Linux servers + + + + + NO + zas_backend_02 + if1 + + + + + backend + + + service + backend + + + DISABLED + + + frontend01 + frontend01 + + + + + + Frontend + + + Linux servers + + + + + NO + zas_frontend_01 + if1 + + + + + frontend + + + service + frontend + + + DISABLED + + + frontend02 + frontend02 + + + + + + Frontend + + + Linux servers + + + + + NO + zas_frontend_02 + if1 + + + + + frontend + + + service + frontend + + + DISABLED + + + Zabbix server + Zabbix server + + + + + + + Zabbix servers + + + + + NO + zabbix-agent + if1 + + + DISABLED + + + + + + + + 7aac0ec0c0e04b7a8bb6472d1faa7a09 + CPU load + FIXED + + + 009900 + + Template ZAS Agent + system.cpu.load[percpu,avg1] + + + + 2 + 990000 + + Template ZAS Agent + system.cpu.load[percpu,avg15] + + + + + + f25064d88b964a678fac7ea6095b238a + CPU utilization + NO + STACKED + FIXED + FIXED + + + 4 + FILLED_REGION + 999900 + + Template ZAS Agent + system.cpu.util[,iowait] + + + + 5 + FILLED_REGION + 990000 + + Template ZAS Agent + system.cpu.util[,system] + + + + 6 + FILLED_REGION + 000099 + + Template ZAS Agent + system.cpu.util[,user] + + + + + + diff --git a/devenv/zabbix72/docker-compose.yml b/devenv/zabbix72/docker-compose.yml new file mode 100644 index 000000000..ae9e99efa --- /dev/null +++ b/devenv/zabbix72/docker-compose.yml @@ -0,0 +1,118 @@ +version: '3' + +services: + # Grafana + # grafana: + # image: grafana/grafana:10.1.2 + # ports: + # - '3001:3000' + # volumes: + # - ../..:/grafana-zabbix + # - ../dashboards:/devenv/dashboards + # - ../grafana.ini:/etc/grafana/grafana.ini:ro + # - '../datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml' + # - '../dashboards.yaml:/etc/grafana/provisioning/dashboards/dashboards.yaml' + # Zabbix + zabbix-server: + image: zabbix/zabbix-server-pgsql:alpine-7.2-latest + ports: + - '10051:10051' + depends_on: + - database + environment: + DB_SERVER_HOST: database + DB_SERVER_PORT: 5432 + POSTGRES_USER: zabbix + POSTGRES_PASSWORD: zabbix + POSTGRES_DB: zabbix + ZBX_TIMEOUT: 10 + ZBX_STARTPOLLERS: 10 + ZBX_STARTPOLLERSUNREACHABLE: 5 + ZBX_DEBUGLEVEL: 3 + + zabbix-web: + image: zabbix/zabbix-web-apache-pgsql:alpine-7.2-latest + ports: + - '8188:8080' + depends_on: + - database + - zabbix-server + environment: + ZBX_SERVER_HOST: zabbix-server + ZBX_SERVER_PORT: 10051 + DB_SERVER_HOST: database + DB_SERVER_PORT: 5432 + POSTGRES_USER: zabbix + POSTGRES_PASSWORD: zabbix + POSTGRES_DB: zabbix + + database: + image: postgres:16 + ports: + - '15432:5432' + command: postgres -c 'max_connections=1000' + environment: + POSTGRES_USER: zabbix + POSTGRES_PASSWORD: zabbix + + zabbix-agent: + image: zabbix/zabbix-agent:alpine-7.2-latest + environment: + ZBX_SERVER_HOST: zabbix-server + ZBX_SERVER_PORT: 10051 + + ######################################################### + # Bootstrap config + ######################################################### + + bootstrap: + build: ./bootstrap + environment: + ZBX_API_URL: http://zabbix-web:8080 + ZBX_API_USER: Admin + ZBX_API_PASSWORD: zabbix + depends_on: + - database + - zabbix-server + - zabbix-web + + ######################################################### + # Fake agents + ######################################################### + + # backend + redis_backend: + image: redis:alpine + + zas_backend_01: + build: ../zas-agent + volumes: + - ../zas-agent/conf/zas_scenario_backend.cfg:/etc/zas_scenario.cfg + environment: + REDIS_HOST: redis_backend + # restart: always + + zas_backend_02: + build: ../zas-agent + volumes: + - ../zas-agent/conf/zas_scenario_backend.cfg:/etc/zas_scenario.cfg + environment: + REDIS_HOST: redis_backend + + # frontend + redis_frontend: + image: redis:alpine + + zas_frontend_01: + build: ../zas-agent + volumes: + - ../zas-agent/conf/zas_scenario_frontend.cfg:/etc/zas_scenario.cfg + environment: + REDIS_HOST: redis_frontend + + zas_frontend_02: + build: ../zas-agent + volumes: + - ../zas-agent/conf/zas_scenario_frontend.cfg:/etc/zas_scenario.cfg + environment: + REDIS_HOST: redis_frontend diff --git a/go.mod b/go.mod index 9c5577a9f..88509f7a1 100644 --- a/go.mod +++ b/go.mod @@ -1,21 +1,23 @@ module github.com/alexanderzobnin/grafana-zabbix -go 1.22.1 +go 1.22.7 + +toolchain go1.23.3 require ( github.com/bitly/go-simplejson v0.5.1 github.com/dlclark/regexp2 v1.10.0 - github.com/grafana/grafana-plugin-sdk-go v0.260.1 + github.com/grafana/grafana-plugin-sdk-go v0.260.3 github.com/patrickmn/go-cache v2.1.0+incompatible github.com/prometheus/client_golang v1.20.5 github.com/stretchr/testify v1.10.0 - golang.org/x/net v0.31.0 + golang.org/x/net v0.32.0 gotest.tools v2.2.0+incompatible ) require ( github.com/BurntSushi/toml v1.4.0 // indirect - github.com/apache/arrow/go/v15 v15.0.2 // indirect + github.com/apache/arrow-go/v18 v18.0.1-0.20241212180703-82be143d7c30 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect @@ -30,10 +32,10 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect - github.com/goccy/go-json v0.10.2 // indirect + github.com/goccy/go-json v0.10.4 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/google/flatbuffers v23.5.26+incompatible // indirect + github.com/google/flatbuffers v24.3.25+incompatible // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/mux v1.8.1 // indirect @@ -48,8 +50,8 @@ require ( github.com/invopop/yaml v0.3.1 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.17.9 // indirect - github.com/klauspost/cpuid/v2 v2.2.5 // indirect + github.com/klauspost/compress v1.17.11 // indirect + github.com/klauspost/cpuid/v2 v2.2.9 // indirect github.com/magefile/mage v1.15.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattetti/filebuffer v1.0.1 // indirect @@ -63,11 +65,11 @@ require ( github.com/oklog/run v1.1.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect - github.com/pierrec/lz4/v4 v4.1.18 // indirect + github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.60.1 // indirect + github.com/prometheus/common v0.61.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect @@ -76,7 +78,7 @@ require ( github.com/unknwon/log v0.0.0-20200308114134-929b1006e34a // indirect github.com/urfave/cli v1.22.16 // indirect github.com/zeebo/xxh3 v1.0.2 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.57.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.57.0 // indirect go.opentelemetry.io/contrib/propagators/jaeger v1.32.0 // indirect go.opentelemetry.io/contrib/samplers/jaegerremote v0.26.0 // indirect @@ -87,16 +89,16 @@ require ( go.opentelemetry.io/otel/sdk v1.32.0 // indirect go.opentelemetry.io/otel/trace v1.32.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect - golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/sync v0.9.0 // indirect - golang.org/x/sys v0.27.0 // indirect - golang.org/x/text v0.20.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect - golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect + golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/mod v0.22.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/text v0.21.0 // indirect + golang.org/x/tools v0.28.0 // indirect + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect - google.golang.org/grpc v1.67.1 // indirect + google.golang.org/grpc v1.68.1 // indirect google.golang.org/protobuf v1.35.2 // indirect gopkg.in/fsnotify/fsnotify.v1 v1.4.7 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index b4a53b7ba..e984292d3 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,12 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/apache/arrow/go/v15 v15.0.2 h1:60IliRbiyTWCWjERBCkO1W4Qun9svcYoZrSLcyOsMLE= -github.com/apache/arrow/go/v15 v15.0.2/go.mod h1:DGXsR3ajT524njufqf95822i+KTh+yea1jass9YXgjA= +github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA= +github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA= +github.com/apache/arrow-go/v18 v18.0.1-0.20241212180703-82be143d7c30 h1:hXVi7QKuCQ0E8Yujfu9b0f0RnzZ72efpWvPnZgnJPrE= +github.com/apache/arrow-go/v18 v18.0.1-0.20241212180703-82be143d7c30/go.mod h1:RNuWDIiGjq5nndL2PyQrndUy9nMLwheA3uWaAV7fe4U= +github.com/apache/thrift v0.21.0 h1:tdPmh/ptjE1IJnhbhrcl2++TauVjy242rkV/UzJChnE= +github.com/apache/thrift v0.21.0/go.mod h1:W1H8aR/QRtYNvrPeFXBtobyRkd0/YVhTc6i07XIAgDw= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bitly/go-simplejson v0.5.1 h1:xgwPbetQScXt1gh9BmoJ6j9JMr3TElvuIyjR8pgdoow= @@ -51,14 +55,16 @@ github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+Gr github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= -github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= -github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.10.4 h1:JSwxQzIqKfmFX1swYPpUThQZp/Ka4wzJdK0LWVytLPM= +github.com/goccy/go-json v0.10.4/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/flatbuffers v23.5.26+incompatible h1:M9dgRyhJemaM4Sw8+66GHBu8ioaQmyPLg1b8VwK5WJg= -github.com/google/flatbuffers v23.5.26+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/flatbuffers v24.3.25+incompatible h1:CX395cjN9Kke9mmalRoL3d81AtFUxJM+yDthflgJGkI= +github.com/google/flatbuffers v24.3.25+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -68,8 +74,8 @@ github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e h1:JKmoR8x90Iww1 github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= -github.com/grafana/grafana-plugin-sdk-go v0.260.1 h1:KzbooQP9mv/9CPsn+SoUwGuomA8oUxO0iuIq6Rg/ekE= -github.com/grafana/grafana-plugin-sdk-go v0.260.1/go.mod h1:JriieK5Oc5v120QKhMs/LO55N0P3YI2ttEiVT1wfYsw= +github.com/grafana/grafana-plugin-sdk-go v0.260.3 h1:7ri52MhUMouQKf2q9z3RsxSX464FLD3mSJZCv65ux5g= +github.com/grafana/grafana-plugin-sdk-go v0.260.3/go.mod h1:X+6ipUy022esjdomutNjHbH67CbJJzEhkrvvfMbvL8A= github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= github.com/grafana/otel-profiling-go v0.5.1/go.mod h1:ftN/t5A/4gQI19/8MoWurBEtC6gFw8Dns1sJZ9W4Tls= github.com/grafana/pyroscope-go/godeltaprof v0.1.8 h1:iwOtYXeeVSAeYefJNaxDytgjKtUuKQbJqgAIjlnicKg= @@ -98,10 +104,12 @@ github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpR github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= -github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= -github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= -github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK4= +github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= +github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= +github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= +github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY= +github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -126,6 +134,10 @@ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 h1:AMFGa4R4MiIpspGNG7Z948v4n35fFGB3RR3G/ry4FWs= +github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= +github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 h1:+n/aFZefKZp7spd8DFdX7uMikMLXX4oubIzJF4kv/wI= +github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -145,8 +157,8 @@ github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaR github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= -github.com/pierrec/lz4/v4 v4.1.18 h1:xaKrnTkyoqfh1YItXl56+6KJNVYWlEEPuAQW9xsplYQ= -github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ= +github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -155,8 +167,8 @@ github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+ github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc= -github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= +github.com/prometheus/common v0.61.0 h1:3gv/GThfX0cV2lpO7gkTUwZru38mxevy90Bj8YFSRQQ= +github.com/prometheus/common v0.61.0/go.mod h1:zr29OCN/2BsJRaFwG8QOBr41D6kkchKbpeNH7pAjb/s= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= @@ -203,8 +215,8 @@ github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0 h1:yMkBS9yViCc7U7yeLzJPM2XizlfdVvBRSmsQDWu6qc0= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0/go.mod h1:n8MR6/liuGB5EmTETUBeU5ZgqMOlqKRxUaqPQBOANZ8= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.57.0 h1:qtFISDHKolvIxzSs0gIaiPUPR0Cucb0F2coHC7ZLdps= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.57.0/go.mod h1:Y+Pop1Q6hCOnETWTW4NROK/q1hv50hM7yDaUTjG8lp8= go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.57.0 h1:7F3XCD6WYzDkwbi8I8N+oYJWquPVScnRosKGgqjsR8c= go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.57.0/go.mod h1:Dk3C0BfIlZDZ5c6eVS7TYiH2vssuyUU3vUsgbrR+5V4= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.57.0 h1:DheMAlT6POBP+gh8RUH19EOTnQIor5QE0uSRPtzCpSw= @@ -236,23 +248,23 @@ go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= -golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= +golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= +golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= -golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191020152052-9984515f0562/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -263,35 +275,34 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= -golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= -golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= +golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -gonum.org/v1/gonum v0.12.0 h1:xKuo6hzt+gMav00meVPUlXwSdoEJP46BR+wdxQEFK2o= -gonum.org/v1/gonum v0.12.0/go.mod h1:73TDxJfAAHeA8Mk9mf8NlIppyhQNo5GLTcYeqgo2lvY= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= +gonum.org/v1/gonum v0.15.1 h1:FNy7N6OUZVUaWG9pTiD+jlhdQ3lMP+/LcTpJ6+a8sQ0= +gonum.org/v1/gonum v0.15.1/go.mod h1:eZTZuRFrzu5pcyjN5wJhcIhnUdNijYxX1T2IcrOGY0o= google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 h1:M0KvPgPmDZHPlbRbaNU1APr28TvwvvdUPlSv7PUvy8g= google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:dguCy7UOdZhTvLzDyt15+rOrawrpM4q7DD9dQ1P11P4= google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 h1:XVhgTWWV3kGQlwJHR3upFWZeTsei6Oks1apkZSeonIE= google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= -google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= -google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0= +google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw= google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/package.json b/package.json index 371b19da7..5bff7fbe3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grafana-zabbix", - "version": "4.5.7", + "version": "4.6.0", "description": "Zabbix plugin for Grafana", "homepage": "http://grafana-zabbix.org", "bugs": { diff --git a/pkg/zabbix/methods.go b/pkg/zabbix/methods.go index f65f2b492..5f98dd961 100644 --- a/pkg/zabbix/methods.go +++ b/pkg/zabbix/methods.go @@ -494,7 +494,13 @@ func (ds *Zabbix) GetAllGroups(ctx context.Context) ([]Group, error) { params := ZabbixAPIParams{ "output": []string{"name", "groupid"}, "sortfield": "name", - "real_hosts": true, + } + + // Zabbix v7.0 and later removed `real_hosts` parameter and replaced it with `with_hosts` + if ds.version < 70 { + params["real_hosts"] = true + } else { + params["with_hosts"] = true } result, err := ds.Request(ctx, &ZabbixAPIRequest{Method: "hostgroup.get", Params: params}) diff --git a/pkg/zabbix/zabbix.go b/pkg/zabbix/zabbix.go index 3cebbc03b..cae30e5f5 100644 --- a/pkg/zabbix/zabbix.go +++ b/pkg/zabbix/zabbix.go @@ -89,10 +89,10 @@ func (zabbix *Zabbix) request(ctx context.Context, method string, params ZabbixA // Skip auth for methods that are not required it if method == "apiinfo.version" { - return zabbix.api.RequestUnauthenticated(ctx, method, params) + return zabbix.api.RequestUnauthenticated(ctx, method, params, zabbix.version) } - result, err := zabbix.api.Request(ctx, method, params) + result, err := zabbix.api.Request(ctx, method, params, zabbix.version) notAuthorized := isNotAuthorized(err) isTokenAuth := zabbix.settings.AuthType == settings.AuthTypeToken if err == zabbixapi.ErrNotAuthenticated || (notAuthorized && !isTokenAuth) { @@ -141,7 +141,7 @@ func (zabbix *Zabbix) Authenticate(ctx context.Context) error { zabbixPassword = jsonData.Get("password").MustString() } - err = zabbix.api.Authenticate(ctx, zabbixLogin, zabbixPassword) + err = zabbix.api.Authenticate(ctx, zabbixLogin, zabbixPassword, zabbix.version) if err != nil { zabbix.logger.Error("Zabbix authentication error", "error", err) return err diff --git a/pkg/zabbixapi/zabbix_api.go b/pkg/zabbixapi/zabbix_api.go index 009d41e33..f0c9bca40 100644 --- a/pkg/zabbixapi/zabbix_api.go +++ b/pkg/zabbixapi/zabbix_api.go @@ -74,20 +74,20 @@ func (api *ZabbixAPI) SetAuth(auth string) { } // Request performs API request -func (api *ZabbixAPI) Request(ctx context.Context, method string, params ZabbixAPIParams) (*simplejson.Json, error) { +func (api *ZabbixAPI) Request(ctx context.Context, method string, params ZabbixAPIParams, version int) (*simplejson.Json, error) { if api.auth == "" { return nil, ErrNotAuthenticated } - return api.request(ctx, method, params, api.auth) + return api.request(ctx, method, params, api.auth, version) } // Request performs API request without authentication token -func (api *ZabbixAPI) RequestUnauthenticated(ctx context.Context, method string, params ZabbixAPIParams) (*simplejson.Json, error) { - return api.request(ctx, method, params, "") +func (api *ZabbixAPI) RequestUnauthenticated(ctx context.Context, method string, params ZabbixAPIParams, version int) (*simplejson.Json, error) { + return api.request(ctx, method, params, "", version) } -func (api *ZabbixAPI) request(ctx context.Context, method string, params ZabbixAPIParams, auth string) (*simplejson.Json, error) { +func (api *ZabbixAPI) request(ctx context.Context, method string, params ZabbixAPIParams, auth string, version int) (*simplejson.Json, error) { apiRequest := map[string]interface{}{ "jsonrpc": "2.0", "id": 2, @@ -95,7 +95,9 @@ func (api *ZabbixAPI) request(ctx context.Context, method string, params ZabbixA "params": params, } - if auth != "" { + // Zabbix v7.2 and later deprecated `auth` parameter and replaced it with using Auth header + // `auth` parameter throws an error in new versions so we need to add it only for older versions + if auth != "" && version < 70 { apiRequest["auth"] = auth } @@ -111,6 +113,9 @@ func (api *ZabbixAPI) request(ctx context.Context, method string, params ZabbixA metrics.ZabbixAPIQueryTotal.WithLabelValues(method).Inc() + if auth != "" { + req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", auth)) + } req.Header.Set("Content-Type", "application/json") req.Header.Set("User-Agent", "Grafana/grafana-zabbix") @@ -123,13 +128,13 @@ func (api *ZabbixAPI) request(ctx context.Context, method string, params ZabbixA } // Login performs API authentication and returns authentication token. -func (api *ZabbixAPI) Login(ctx context.Context, username string, password string) (string, error) { +func (api *ZabbixAPI) Login(ctx context.Context, username string, password string, version int) (string, error) { params := ZabbixAPIParams{ "username": username, "password": password, } - auth, err := api.request(ctx, "user.login", params, "") + auth, err := api.request(ctx, "user.login", params, "", version) if err != nil { return "", err } @@ -138,13 +143,13 @@ func (api *ZabbixAPI) Login(ctx context.Context, username string, password strin } // Login method for Zabbix prior to 5.4 -func (api *ZabbixAPI) LoginDeprecated(ctx context.Context, username string, password string) (string, error) { +func (api *ZabbixAPI) LoginDeprecated(ctx context.Context, username string, password string, version int) (string, error) { params := ZabbixAPIParams{ "user": username, "password": password, } - auth, err := api.request(ctx, "user.login", params, "") + auth, err := api.request(ctx, "user.login", params, "", version) if err != nil { return "", err } @@ -153,11 +158,11 @@ func (api *ZabbixAPI) LoginDeprecated(ctx context.Context, username string, pass } // Authenticate performs API authentication and sets authentication token. -func (api *ZabbixAPI) Authenticate(ctx context.Context, username string, password string) error { - auth, err := api.Login(ctx, username, password) +func (api *ZabbixAPI) Authenticate(ctx context.Context, username string, password string, version int) error { + auth, err := api.Login(ctx, username, password, version) if isDeprecatedUserParamError(err) { api.logger.Debug("user.login method error, switching to deprecated user parameter", "error", err) - auth, err = api.LoginDeprecated(ctx, username, password) + auth, err = api.LoginDeprecated(ctx, username, password, version) if err != nil { return err } diff --git a/pkg/zabbixapi/zabbix_api_test.go b/pkg/zabbixapi/zabbix_api_test.go index 625f184e7..6d3e585bb 100644 --- a/pkg/zabbixapi/zabbix_api_test.go +++ b/pkg/zabbixapi/zabbix_api_test.go @@ -7,9 +7,12 @@ import ( "github.com/stretchr/testify/assert" ) +var version = 65 + + func TestZabbixAPIUnauthenticatedQuery(t *testing.T) { zabbixApi, _ := MockZabbixAPI(`{"result":"sampleResult"}`, 200) - resp, err := zabbixApi.RequestUnauthenticated(context.Background(), "test.get", map[string]interface{}{}) + resp, err := zabbixApi.RequestUnauthenticated(context.Background(), "test.get", map[string]interface{}{}, version) assert.Equal(t, "sampleResult", resp.MustString()) assert.Nil(t, err) @@ -17,7 +20,7 @@ func TestZabbixAPIUnauthenticatedQuery(t *testing.T) { func TestLogin(t *testing.T) { zabbixApi, _ := MockZabbixAPI(`{"result":"secretauth"}`, 200) - err := zabbixApi.Authenticate(context.Background(), "user", "password") + err := zabbixApi.Authenticate(context.Background(), "user", "password", version) assert.Nil(t, err) assert.Equal(t, "secretauth", zabbixApi.auth) @@ -31,6 +34,7 @@ func TestZabbixAPI(t *testing.T) { mockApiResponseCode int expectedResult string expectedError error + version int }{ { name: "Simple request", @@ -54,7 +58,7 @@ func TestZabbixAPI(t *testing.T) { t.Run(tt.name, func(t *testing.T) { zabbixApi, _ := MockZabbixAPI(tt.mockApiResponse, tt.mockApiResponseCode) zabbixApi.auth = tt.auth - resp, err := zabbixApi.Request(context.Background(), "test.get", map[string]interface{}{}) + resp, err := zabbixApi.Request(context.Background(), "test.get", map[string]interface{}{}, version) if tt.expectedError != nil { assert.Equal(t, err, tt.expectedError) diff --git a/src/datasource/zabbix/connectors/zabbix_api/zabbixAPIConnector.test.ts b/src/datasource/zabbix/connectors/zabbix_api/zabbixAPIConnector.test.ts index d2ff32ea2..5369ae150 100644 --- a/src/datasource/zabbix/connectors/zabbix_api/zabbixAPIConnector.test.ts +++ b/src/datasource/zabbix/connectors/zabbix_api/zabbixAPIConnector.test.ts @@ -23,5 +23,31 @@ describe('Zabbix API connector', () => { zabbixAPIConnector.getProxies(); expect(zabbixAPIConnector.request).toHaveBeenCalledWith('proxy.get', { output: ['proxyid', 'host'] }); }); + + it('should send the with_hosts parameter when version is 7.0+', () => { + const zabbixAPIConnector = new ZabbixAPIConnector(true, true, 123); + zabbixAPIConnector.version = '7.0.0'; + zabbixAPIConnector.request = jest.fn(); + + zabbixAPIConnector.getGroups(); + expect(zabbixAPIConnector.request).toHaveBeenCalledWith('hostgroup.get', { + output: ['name', 'groupid'], + sortfield: 'name', + with_hosts: true, + }); + }); + + it('should send the real_hosts parameter when version is <7.0', () => { + const zabbixAPIConnector = new ZabbixAPIConnector(true, true, 123); + zabbixAPIConnector.version = '6.5.0'; + zabbixAPIConnector.request = jest.fn(); + + zabbixAPIConnector.getGroups(); + expect(zabbixAPIConnector.request).toHaveBeenCalledWith('hostgroup.get', { + output: ['name', 'groupid'], + sortfield: 'name', + real_hosts: true, + }); + }); }); }); diff --git a/src/datasource/zabbix/connectors/zabbix_api/zabbixAPIConnector.ts b/src/datasource/zabbix/connectors/zabbix_api/zabbixAPIConnector.ts index 845e08a44..58798ad8e 100644 --- a/src/datasource/zabbix/connectors/zabbix_api/zabbixAPIConnector.ts +++ b/src/datasource/zabbix/connectors/zabbix_api/zabbixAPIConnector.ts @@ -142,9 +142,15 @@ export class ZabbixAPIConnector { const params = { output: ['name', 'groupid'], sortfield: 'name', - real_hosts: true, }; + // Zabbix v7.0 and later deprecated `real_hosts` parameter and replaced it with `with_hosts` + if (semver.gte(this.version, '7.0.0')) { + params['with_hosts'] = true; + } else { + params['real_hosts'] = true; + } + return this.request('hostgroup.get', params); } @@ -612,10 +618,10 @@ export class ZabbixAPIConnector { time_from: timeFrom, time_till: timeTo, objectids: objectids, - select_acknowledges: 'extend', selectHosts: 'extend', value: showEvents, }; + params[getSelectAcknowledgesKey(this.version)] = 'extend'; if (limit) { params.limit = limit; @@ -639,13 +645,13 @@ export class ZabbixAPIConnector { evaltype: '0', sortfield: ['eventid'], sortorder: 'DESC', - select_acknowledges: 'extend', selectTags: 'extend', selectSuppressionData: ['maintenanceid', 'suppress_until'], groupids, hostids, applicationids, }; + params[getSelectAcknowledgesKey(this.version)] = 'extend'; if (limit) { params.limit = limit; @@ -675,12 +681,13 @@ export class ZabbixAPIConnector { output: 'extend', eventids: eventids, preservekeys: true, - select_acknowledges: 'extend', selectTags: 'extend', sortfield: 'clock', sortorder: 'DESC', }; + params[getSelectAcknowledgesKey(this.version)] = 'extend'; + return this.request('event.get', params); } @@ -699,10 +706,10 @@ export class ZabbixAPIConnector { output: 'extend', eventids: eventids, preservekeys: true, - select_acknowledges: 'extend', sortfield: 'clock', sortorder: 'DESC', }; + params[getSelectAcknowledgesKey(this.version)] = 'extend'; return this.request('event.get', params).then((events) => { return _.filter(events, (event) => event.acknowledges.length); @@ -976,3 +983,7 @@ export class ZabbixAPIError { return this.name + ' ' + this.data; } } + +function getSelectAcknowledgesKey(version: string) { + return semver.gte(version, '7.0.0') ? 'selectAcknowledges' : 'select_acknowledges'; +}