Задать вопрос
@KaLans

Как правильно распарсить JSON в Zabbix?

В Zabbix получаю json вида:
spoiler

{
    "ipv6nat": {
        "type": "info",
        "container": "ipv6nat",
        "state": "running",
        "started_at": "2025-09-09T02:25:48.597063398Z",
        "image": "robbertkl/ipv6nat"
    },
    "watchdog": {
        "type": "info",
        "container": "watchdog",
        "state": "running",
        "started_at": "2025-09-09T02:25:49.034715898Z",
        "image": "ghcr.io/watchdog:2.08"
    },
    "acme": {
        "type": "info",
        "container": "acme",
        "state": "running",
        "started_at": "2025-09-09T02:25:49.410248064Z",
        "image": "ghcr.io/acme:1.93"
    },
    "nginx": {
        "type": "info",
        "container": "nginx",
        "state": "running",
        "started_at": "2025-09-09T02:25:49.325908002Z",
        "image": "ghcr.io/nginx:1.03"
    },
    "rspamd": {
        "type": "info",
        "container": "rspamd",
        "state": "running",
        "started_at": "2025-09-09T02:43:16.428571722Z",
        "image": "ghcr.io/rspamd:2.2"
    },
    "ofelia": {
        "type": "info",
        "container": "ofelia",
        "state": "running",
        "started_at": "2025-09-09T02:25:49.047098625Z",
        "image": "mcuadros/ofelia:latest"
    },
    "dovecot": {
        "type": "info",
        "container": "dovecot",
        "state": "running",
        "started_at": "2025-09-09T02:25:49.397769582Z",
        "image": "ghcr.io/dovecot:2.34"
    },
    "php-fpm": {
        "type": "info",
        "container": "php-fpm",
        "state": "running",
        "started_at": "2025-09-09T02:25:49.207584334Z",
        "image": "ghcr.io/phpfpm:1.93"
    },
    "postfix": {
        "type": "info",
        "container": "postfix",
        "state": "running",
        "started_at": "2025-09-09T02:25:49.203080147Z",
        "image": "ghcr.io/postfix:1.80"
    },
    "clamd": {
        "type": "info",
        "container": "clamd",
        "state": "running",
        "started_at": "2025-09-09T02:25:49.014354072Z",
        "image": "ghcr.io/clamd:1.70"
    },
    "redis": {
        "type": "info",
        "container": "redis",
        "state": "running",
        "started_at": "2025-09-09T02:25:49.228263805Z",
        "image": "redis:7.4.2-alpine"
    },
    "mysql": {
        "type": "info",
        "container": "mysql",
        "state": "running",
        "started_at": "2025-09-09T02:25:48.915980879Z",
        "image": "mariadb:10.11"
    },
    "memcached": {
        "type": "info",
        "container": "memcached",
        "state": "running",
        "started_at": "2025-09-09T02:25:49.279423323Z",
        "image": "memcached:alpine"
    },
    "unbound": {
        "type": "info",
        "container": "unbound",
        "state": "running",
        "started_at": "2025-09-09T02:25:49.07675022Z",
        "image": "ghcr.io/unbound:1.24"
    },
    "olefy": {
        "type": "info",
        "container": "olefy",
        "state": "running",
        "started_at": "2025-09-09T02:25:49.269785294Z",
        "image": "ghcr.io/olefy:1.15"
    },
    "netfilter": {
        "type": "info",
        "container": "netfilter",
        "state": "running",
        "started_at": "2025-09-09T02:25:48.593228646Z",
        "image": "ghcr.io/netfilter:1.61"
    },
    "sogo": {
        "type": "info",
        "container": "sogo",
        "state": "running",
        "started_at": "2025-09-09T02:25:49.011224165Z",
        "image": "ghcr.io/sogo:1.133"
    },
    "dockerapi": {
        "type": "info",
        "container": "dockerapi",
        "state": "running",
        "started_at": "2025-09-09T02:25:49.082004656Z",
        "image": "ghcr.io/dockerapi:2.11"
    }
}



Хочу получить результат параметра "state":

В предобработке выбираю тип JSONPath и использую параметр $.ipv6nat.state

В результате получаю ошибку
"cannot extract value from json by path "$.ipv6nat.state": invalid object format, expected opening character '{' or '[' at: ''"

Мне кажется я уже перепробовал все варианты из документации
Ошибка одна и та же
  • Вопрос задан
  • 94 просмотра
Подписаться 2 Простой 7 комментариев
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы