# Zabbix 7.0 templates for Wazuh: manager, indexer, dashboard and agent

> Five Zabbix 7.0 templates for Wazuh 4.14: data sources, read-only users in API and OpenSearch, agent access through ACLs and upgrading from the old template.

Published: 2026-11-13. Category: Deployment. Tags: Wazuh 4. URL: https://wazuh.blog/en/blog/zabbix-7-wazuh-templates/ Polish original: https://wazuh.blog/blog/zabbix-7-szablony-wazuh/

Zabbix 7.0 can monitor every Wazuh component without extra agents on the server side: the manager and the indexer answer over REST, the dashboard through a status endpoint, and the agent writes its state to a local file. I describe the set of five templates I built along these lines, together with the read-only accounts they need.

The code, the YAML files and the README of each template are in the repository [adampielak/wazuh-zabbix-template](https://github.com/adampielak/wazuh-zabbix-template), licensed under Apache 2.0. I tested them with Wazuh 4.14.9, indexer and dashboard 2.19.6, and Zabbix 7.0.x with a 7.0.x proxy.

## What each template monitors

The directory layout follows the official Zabbix templates: one directory per template, a YAML file for import and a README with the macros, items, triggers and LLD rules.

| Template | Data source | Scope |
| --- | --- | --- |
| Wazuh manager by HTTP | Wazuh server API, port 55000, Script item with JWT login | API availability and version, daemon states, analysisd and remoted statistics, queues, configuration validation, cluster, ruleset synchronization, agent summary |
| Wazuh indexer by HTTP | OpenSearch REST, port 9200, HTTP agent items | cluster health, shard count and limit, disk watermarks, per node: heap, disk, CPU, file descriptors, thread pool rejections, circuit breakers, time of the last alert in `wazuh-alerts-*` |
| Wazuh dashboard by HTTP | `GET /api/status`, HTTP agent item | overall state, plugin states, heap, event loop delay, response times, connections, uptime |
| Wazuh agent by Zabbix agent (and the active variant) | agent state file, `VERSION.json`, process list | daemon processes, connection status, last keep-alive and ACK, event and message rates, buffer, state file age, version |
| Wazuh all-in-one | the three HTTP templates, linked | single-node installation |

The Wazuh agent has no REST API, so the agent template reads local files. The connection state of all agents is also collected by the manager template.

## Manager: one Script item and dependent items

The manager template logs in to the Wazuh server API and fetches all data with one Script item, and the remaining items are dependent. The Zabbix documentation describes the mechanism like this: the master item collects data in one query, its new value populates the dependent items, and dependent items cannot have a different update interval than the master item. A Script item runs JavaScript, and the execution timeout is between 1 and 600 seconds.

The login follows the Wazuh documentation. A `POST /security/user/authenticate` request with basic authentication returns a JWT. With `raw=true` the response contains only the token as plain text, without a JSON object. Later requests carry the `Authorization: Bearer` header.

The template groups four kinds of data:

- local node statistics: daemons, analysisd, remoted, wazuh-db, configuration;
- cluster data from the master node: the node list, ruleset synchronization;
- the agent summary and the check for available updates;
- errors of individual requests in a separate `API errors` item, so a refused endpoint does not stop the rest.

You collect local data from every node, so you link the template to one host per node. Cluster-wide data comes from the master only: on a worker node the LLD rule discovers nothing. For analysisd and remoted queues the warning and critical thresholds default to 80 and 95 percent, set by the `{$WAZUH.QUEUE.UTIL.MAX.WARN}` and `{$WAZUH.QUEUE.UTIL.MAX.CRIT}` macros. How to read the dropped-event counters is covered in the post [on losses in analysisd](/en/blog/analysisd-dropped-events/), and cluster operations in the post [on the Wazuh cluster](/en/blog/wazuh-cluster-operations/).

## Indexer and dashboard: HTTP agent items

The indexer template queries OpenSearch REST and discovers node data with an LLD rule. The address of one node (or a load balancer) is enough, because the statistics of the whole cluster come from a single query, so you link the template once per cluster. Two items concern ingest and are specific to Wazuh: the number of alerts indexed in a time window (macro `{$WAZUH.INDEXER.ALERTS.WINDOW}`, 10 minutes by default) and the time of the newest alert in the pattern `{$WAZUH.INDEXER.ALERTS.INDEX}`, `wazuh-alerts-*` by default. The "No alerts indexed" trigger catches the situation in which the cluster is green but no document reaches the index. A retention policy that can empty indices is covered in the post [on OpenSearch retention](/en/blog/opensearch-retention/).

The dashboard template reads `GET /api/status`. With the security plugin enabled, the endpoint requires authentication, so you need a user who can log in to the dashboard. From the response the template extracts the overall state, the states of the core and plugins, the Node.js heap and response times.

The templates do not verify certificates, because Wazuh generates self-signed certificates by default. The manager template has the `{$HTTP.TLS.VERIFY}` macro set to `none`. You set it to `full` when the Zabbix server or proxy trusts the API certificate.

The HTTP agent items in the indexer and dashboard templates do not set *SSL verify peer* and *SSL verify host*, and according to the repository README these fields do not accept macros. To verify the certificates, add the Wazuh root CA (`root-ca.pem`) to the trust store of the Zabbix server or proxy and enable both options on the template items after import.

## Read-only accounts

I use neither `wazuh-wui` nor `admin` for monitoring. Each component gets a separate account with minimal permissions.

### Wazuh server API

In 4.14 the RBAC reference assigns the following actions to the endpoints in use:

| Action | Resource | Template endpoints |
| --- | --- | --- |
| `manager:read` | `*:*:*` | `/manager/info`, `/manager/status`, `/manager/daemons/stats`, `/manager/configuration/validation` |
| `cluster:status` | `*:*:*` | `/cluster/status` |
| `cluster:read` | `node:id:*` | `/cluster/local/info`, `/cluster/healthcheck`, `/cluster/ruleset/synchronization` |
| `agent:read` | `agent:id:*` | `/agents/summary/status` |

The `/manager/version/check` endpoint has no RBAC action in the API specification, so any authenticated user can call it. These are the commands I use to create the user, the policies and the role (an administrator token is required in `TOKEN`):

```bash
API=https://wazuh-server:55000
H=(-k -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json")

curl "${H[@]}" -X POST "$API/security/users" -d '{"username":"zbx_monitor","password":"<password>"}'
curl "${H[@]}" -X POST "$API/security/policies" -d '{"name":"zbx_monitor_manager","policy":{"actions":["manager:read","cluster:status"],"resources":["*:*:*"],"effect":"allow"}}'
curl "${H[@]}" -X POST "$API/security/policies" -d '{"name":"zbx_monitor_cluster","policy":{"actions":["cluster:read"],"resources":["node:id:*"],"effect":"allow"}}'
curl "${H[@]}" -X POST "$API/security/policies" -d '{"name":"zbx_monitor_agents","policy":{"actions":["agent:read"],"resources":["agent:id:*"],"effect":"allow"}}'
curl "${H[@]}" -X POST "$API/security/roles" -d '{"name":"zbx_monitor"}'

# Use the IDs returned by the calls above.
curl "${H[@]}" -X POST "$API/security/roles/<role_id>/policies?policy_ids=<id1>,<id2>,<id3>"
curl "${H[@]}" -X POST "$API/security/users/<user_id>/roles?role_ids=<role_id>"
```

Store the password in the host macro as a secret (type Secret text). Zabbix then masks the value with asterisks and makes it unreadable after saving.

### Indexer

The indexer template needs the `cluster_monitor` action group and the `indices:data/read/search` permission on the alerts pattern. The OpenSearch documentation defines `cluster_monitor` as all cluster monitoring permissions, and the `search` group contains the `indices:data/read/search` action. I create the role, the user and the mapping through the security plugin API:

```bash
IDX=https://wazuh-indexer:9200

curl -k -u admin -X PUT "$IDX/_plugins/_security/api/roles/zabbix_monitor" -H "Content-Type: application/json" -d '{
  "cluster_permissions": ["cluster_monitor"],
  "index_permissions": [{"index_patterns": ["wazuh-alerts-*"], "allowed_actions": ["indices:data/read/search"]}]
}'
curl -k -u admin -X PUT "$IDX/_plugins/_security/api/internalusers/zbx_monitor" -H "Content-Type: application/json" -d '{"password": "<password>"}'
curl -k -u admin -X PUT "$IDX/_plugins/_security/api/rolesmapping/zabbix_monitor" -H "Content-Type: application/json" -d '{"users": ["zbx_monitor"]}'
```

You can also enter this account in the dashboard macros. The OpenSearch documentation accepts both `password` and `hash`, and the plugin hashes a plain-text password before storing it.

## Agent: reading the state through ACLs

The agent state file is `/var/ossec/var/run/wazuh-agentd.state`. According to the Wazuh documentation the agent refreshes it every 5 seconds by default, and the interval is set by `agent.state_interval` in the `internal_options.conf` file. The file contains, among others, `status`, `last_keepalive`, `last_ack`, `msg_count`, `msg_sent` and `msg_buffer`. The `connected` status means a connection established with the manager in the last 10 seconds, `disconnected` a lost connection or no ACK for 60 seconds, and `pending` waiting for the connection. The `msg_buffer` field is empty when the anti-flooding mechanism is disabled, and its capacity is covered in the post [on the agent buffer](/en/blog/wazuh-client-buffer/). Why the manager considers an agent disconnected is explained in the post [on disconnected agents](/en/blog/wazuh-agent-disconnections/).

The template reads this file with a `vfs.file.contents[...]` item and measures its age with `vfs.file.time[...,modify]` (the `modify` mode is the time of the last content modification). It counts daemon processes with the `proc.num[...]` key. The file age reveals a hung daemon that is still on the process list.

The Zabbix agent runs as the `zabbix` user, which has no access to `/var/ossec`. I grant access with POSIX ACLs (package `acl`):

```bash
setfacl -m u:zabbix:x /var/ossec /var/ossec/var /var/ossec/var/run
setfacl -m u:zabbix:r /var/ossec/VERSION.json /var/ossec/var/run/wazuh-agentd.state
setfacl -d -m u:zabbix:r /var/ossec /var/ossec/var/run
```

The first command grants the right to traverse the directories, the second the right to read two files. The third, with the `-d` option, sets default ACLs: according to the man page the operations then apply to the default ACL. The repository README notes that on some hosts the state file is created with mode 0640 and gets a new inode on every write. A plain ACL entry on the file would be lost after such a write, while a default entry on the `/var/ossec/var/run` directory is inherited by the new file. No Zabbix agent restart is needed. To revoke access, run the same commands with `-x` instead of `-m`, also for the default entries (`-d -x`).

### Why not the wazuh group

The simplest workaround is `usermod -aG wazuh zabbix`. I advise against it. The Wazuh agent runs the commands from `localfile` sources as root: the documentation describes that `command` and `full_command` execute the command as root, and remote sources of this type from `agent.conf` are ignored until `logcollector.remote_commands` is set to 1. This safeguard exists precisely so that the manager does not execute arbitrary commands with root privileges. The `wazuh` group can write to `/var/ossec/etc/ossec.conf`, so a member can add their own command to the configuration.

In Zabbix 7.0 the `system.run` key is denied by default, even with an empty `DenyKey`. If someone allows it with `AllowKey`, though, the `zabbix` user in the `wazuh` group has a path to root: it writes the configuration and the Wazuh agent runs the command. ACLs limit access to two files and do not open this path.

## Upgrading from the old template

The previous single file `template-wazuh-7.0.yaml` ("Template Wazuh API by Script") is replaced by the manager template. Some item keys are the same in both, and the Zabbix documentation states that the uniqueness criterion for an item is its key. When a template is linked, identical items that already exist on the host are updated as template items, and host-only items stay untouched. The steps:

1. Unlink the old template from the host with Unlink, not "Unlink and clear". The first leaves items, triggers and LLD rules on the host, the second removes them together with the history.
2. Link the new template. Items with matching keys move under the new template and keep their history.
3. Delete the items left over from the old template if they are no longer needed.

The Zabbix documentation notes that the Unlink option is meant precisely for preserving item history.

## Building from source

The YAML files and the READMEs are generated from the TypeScript code in the `tools/` directory:

```bash
bun tools/build.ts
```

You make changes in the sources, and the generated files are the build output. The UUIDs are derived from the template name and the item key, so a rebuild does not change them and a re-import updates the existing templates. After the import (Data collection, Templates, Import) you link the template to a host and set the `{$WAZUH.API.HOST}`, `{$WAZUH.INDEXER.HOST}` and `{$WAZUH.DASHBOARD.HOST}` macros together with the `USER` and `PASSWORD` pairs. The all-in-one file contains the three linked templates.

## What the documentation does not specify

The Wazuh documentation does not describe the permissions or the group of the `ossec.conf` and `wazuh-agentd.state` files. The write access of the `wazuh` group to `ossec.conf`, the 0640 mode of the state file and the new inode on every write come from the repository README and are not confirmed in the documentation, so check them on your own hosts with `ls -l` and `stat` before applying the ACLs.

## Sources

- https://github.com/adampielak/wazuh-zabbix-template
- https://documentation.wazuh.com/current/user-manual/reference/statistics-files/wazuh-agentd-state.html
- https://documentation.wazuh.com/current/user-manual/api/getting-started.html
- https://documentation.wazuh.com/current/user-manual/api/rbac/reference.html
- https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html
- https://raw.githubusercontent.com/wazuh/wazuh/v4.14.0/api/api/spec/spec.yaml
- https://www.zabbix.com/documentation/7.0/en/manual/config/items/itemtypes/script
- https://www.zabbix.com/documentation/7.0/en/manual/config/items/itemtypes/dependent_items
- https://www.zabbix.com/documentation/7.0/en/manual/config/items/itemtypes/zabbix_agent
- https://www.zabbix.com/documentation/7.0/en/manual/config/items/restrict_checks
- https://www.zabbix.com/documentation/7.0/en/manual/config/templates/linking
- https://www.zabbix.com/documentation/7.0/en/manual/config/macros/secret_macros
- https://docs.opensearch.org/docs/latest/security/access-control/default-action-groups/
- https://raw.githubusercontent.com/opensearch-project/documentation-website/main/_security/api/roles/create-role.md
- https://raw.githubusercontent.com/opensearch-project/documentation-website/main/_security/api/role-mappings/create-role-mapping.md
- https://raw.githubusercontent.com/opensearch-project/documentation-website/main/_security/api/users/create-user.md
- https://man7.org/linux/man-pages/man1/setfacl.1.html
