Monitoring Wazuh agents in Zabbix via the REST API

Monitoring Wazuh agents in Zabbix via the REST API

Table of Contents

Wazuh is a popular open-source SIEM/XDR: agents on servers and workstations collect logs, file-integrity events and vulnerability data, and send them to the Wazuh manager. It works well — as long as the agents are actually connected.

The catch: when an agent stops reporting, Wazuh doesn’t make much noise about it. The server simply stops sending events, and nobody notices until someone needs those events. A host that is silent in your SIEM is a blind spot, and blind spots are exactly what attackers like.

Most teams already watch their servers with Zabbix. So instead of looking at the Wazuh dashboard every morning, let Zabbix check each agent and raise an alert like for any other problem.

Template: custom-zabbix-templates/wazuh-agent — Zabbix 6.4 and newer, no external scripts.

How it works

The template is linked to the same Zabbix host as the server running the Wazuh agent. Every 10 minutes a Zabbix Script item (JavaScript running on the Zabbix server or proxy):

  1. authenticates against the Wazuh API with basic auth and obtains a token;
  2. requests GET /agents?name=<host name> — the agent whose name matches the Zabbix host name;
  3. returns the agent’s data as JSON.

Two dependent items extract what matters:

Item Values
Agent status active, disconnected, pending, never_connected (or unavailable if the agent isn’t found)
Agent group config status synced / not synced

And triggers fire when something is wrong:

Trigger Severity
Wazuh Agent Disconnected Average
Wazuh Agent Unavailable (not found in Wazuh) Average
Wazuh Agent Pending Warning
Wazuh Agent Never Connected Warning
Wazuh Agent Config Not Synced Warning
Wazuh Agent No Data (the API check itself stopped working) Warning

Status triggers require two consecutive bad values, so a short agent restart doesn’t wake anyone up.

Setup

  1. Create an API user in Wazuh with read-only access to agents. Don’t use the admin account — the password is stored in a Zabbix macro.

  2. Import the template in Zabbix: Data collection → Templates → Import and select zabbix-wazuh-agent.json.

  3. Set the macros — ideally once on a host group or globally rather than on every host:

    Macro Example
    {$WAZUH.API.URL} https://wazuh.example.local:55000
    {$WAZUH.USER} zabbix-ro
    {$WAZUH.PASSWORD} (secret macro)
    {$WAZUH.HTTP.PROXY} optional, e.g. http://proxy:3128
    {$WAZUH.DATA.TIMEOUT} 10 (seconds)

    Mark {$WAZUH.PASSWORD} as a secret text macro so it is not shown in the UI.

  4. Link the template to the hosts that run a Wazuh agent.

Warning

The agent is looked up by the visible name of the Zabbix host. If the agent is registered in Wazuh as web01 but the Zabbix host is called web01.example.local, the lookup returns nothing and you get “Wazuh Agent Unavailable”. Keep the names consistent — or rename the host’s visible name in Zabbix.

The Zabbix server (or the proxy that monitors the host) needs network access to the Wazuh API, by default on TCP 55000. If it can only get there through a proxy, set {$WAZUH.HTTP.PROXY}.

Why “never_connected” and “pending” matter

  • never_connected usually means an agent was registered (often by an automated deployment) but never started or never reached the manager — a host you think is protected but isn’t.
  • pending means the agent registered but the handshake didn’t complete — typically a firewall or certificate issue.
  • not synced means the agent hasn’t received its group’s configuration, so it may be running with outdated rules.

All three are easy to miss in the Wazuh UI and obvious in a Zabbix problem list.

Summary

  • One template, linked to the hosts you already monitor; no scripts on the hosts.
  • Alerts when an agent disconnects, never connected, is stuck in pending or out of sync.
  • Use a read-only Wazuh API user and a secret macro for its password.
  • Keep Zabbix host names and Wazuh agent names aligned.

Building or tuning a security monitoring setup with Wazuh and Zabbix? Talk to us.

comments powered by Disqus

Related Posts

Are your network config backups actually working? Oxidized + Zabbix

Are your network config backups actually working? Oxidized + Zabbix

Oxidized is the de facto open-source tool for backing up network device configurations. It logs into switches, routers and firewalls — Cisco, Juniper, MikroTik, Fortinet, HPE/Aruba and dozens of others — downloads the running config and stores every version in Git. When a device dies or someone breaks the config, you have the last known good version and a diff of what changed.

Read More
Traefik 4xx/5xx errors in Zabbix without Prometheus

Traefik 4xx/5xx errors in Zabbix without Prometheus

Traefik sits in front of a lot of applications: as a Docker reverse proxy, as a Kubernetes ingress controller, or as an edge router on a single VM. That makes it the best place to see whether your applications are healthy from the user’s point of view — every failed request passes through it.

Read More
How to monitor your home internet connection — and prove it to your ISP

How to monitor your home internet connection — and prove it to your ISP

The video call freezes, the game lags, the trading terminal reconnects. A speed test five minutes later shows 500 Mbit/s and everything looks fine. You call your provider, they “see no issues on the line”, and suggest restarting the router.

Read More