NewWork mode: your Claude Code or Codex on work calls, answering from your project's codeSkip to content
Middle1 view

What is a Zabbix Trapper, and how can you send data to Zabbix from a bash script?

Practice

Asked at

AI answer

A Zabbix trapper is an item type that accepts values sent by an external system or script. Unlike regular polling, the server does not request this item itself: the sender transmits the value to the Zabbix server or proxy, usually on port 10051.

Create an item on the host with the Zabbix trapper type, set its key, and make sure the host name in the command matches the host’s technical name in Zabbix. Then send a value using zabbix_sender:

#!/usr/bin/env bash
set -euo pipefail

zabbix_sender -z zabbix.example.org -p 10051 \
  -s "host-name-in-Zabbix" -k app.queue.size -o 42

To send values from a file, you can use zabbix_sender -i file. If a value is not accepted, check the host name, key, item type, server/proxy availability, and access settings for trapper data.