Zabbix MQTT monitoring with agent 2

Zabbix reads MQTT topics through the agent 2 MQTT plugin and the mqtt.get key, as active checks only. This page covers the setup, broker choice, TLS, wildcards and failure points for IoT and sensor data.

On this page

How Zabbix MQTT monitoring with agent 2 reads sensor data

When sensors or devices publish to an MQTT broker and you want those values in Zabbix, the agent 2 MQTT plugin and the mqtt.get item key do the work. The plugin ships with agent 2, runs active checks only, can monitor several brokers at once, and supports proxy and WebSocket connections. Each mqtt.get item takes four parameters in order: broker, topic, username and password. The broker address can use tcp://, ws:// or tls://, and if you omit the port, the key connects on the default port 1883. Wildcards are supported: + and # in the topic return the matching messages as JSON, so the item value is a structured document rather than a single number, and your items must extract the fields you need from it.

For TLS brokers, the key also takes CA, certificate and key files per named session, so each broker connection can use its own certificate material. Confirm the exact parameter names and session configuration in the agent 2 configuration file against the Zabbix MQTT integration page before you write item definitions, because the file layout and options are the parts most likely to differ between agent 2 versions in your environment. Test a single topic first in a non-production setup, then widen to wildcards once you know the JSON shape each device sends.

Zabbix lists no official MQTT template, so item design is your team's job. The Mosquitto and EMQ templates on the integration page are community integrations that Zabbix does not verify, so treat them as starting points to review rather than as supported content. Decide early which topics map to which hosts, how device identifiers in topic names become host or item keys, and how you will handle a topic that stops publishing. Those decisions shape the item count and the polling load on the agent 2 host far more than the plugin setup itself.

What Zabbix MQTT monitoring needs before the first mqtt.get item

Most MQTT monitoring delays come from missing facts at the start, not from the Zabbix item itself. The cards below cover the agent, the broker, the network path, the TLS material and the licensing check that together decide whether the first mqtt.get item returns data.

Agent 2 with the MQTT plugin

The MQTT plugin ships with Zabbix agent 2, not with the classic agent, so the host that polls the broker must run agent 2. Confirm the agent 2 version against Zabbix's own MQTT integration documentation before building, and check that the plugin is present on the exact host or proxy that will run the checks. Record the version in the build notes so later upgrades can be tested against it.

Zabbix MQTT integration

Active checks only

The MQTT plugin supports active checks only, so the agent 2 host initiates each connection and the Zabbix server never polls the broker directly. Plan the item intervals and the agent refresh behavior with this in mind, and confirm that the host's active check configuration is already working for other items before adding MQTT keys.

Broker address and scheme

Decide which scheme the broker exposes: tcp://, ws:// or tls://. The mqtt.get key accepts all three and defaults to port 1883 when no port is given. Ask the broker owner for the exact host, port and scheme, and confirm whether the broker is reached directly or through a WebSocket front end, since the path affects both firewall rules and certificate handling.

Topics and credentials

Get a written list of the topics the team needs, including whether wildcard subscriptions with + or # are allowed by the broker's access rules. Obtain a dedicated read-only username and password for Zabbix, and confirm that the account can subscribe to those topics only. Shared operator credentials make later rotation and audit harder.

Firewall paths to the broker

Map the network path from the agent 2 host, or from the proxy that runs it, to the broker port, and confirm that the firewall allows it in the direction the broker expects. Include any WebSocket port and any load balancer in front of the broker. Testing the path from the agent host itself, before the item is created, separates network faults from configuration faults.

CA, certificate and key files

For tls:// sessions, collect the CA certificate, the client certificate and the client key for each named session, and store them where the agent 2 service account can read them but other users cannot. Confirm expiry dates and the certificate chain with the broker team. The plugin takes these files per named session, so plan a naming scheme for brokers that need different material.

Broker licensing check

Before choosing a broker, confirm its license terms for your use. EMQX moved to the Business Source License 1.1 from 5.9.0 and requires a license file for clusters of more than one node from that version. Eclipse Mosquitto is dual licensed under EPL-2.0 or BSD-3-Clause, and its high availability and integrations sit in a separate commercial edition. Have legal or procurement review the terms that apply to your deployment before the monitoring design depends on them.

EMQX license text

Which MQTT broker to run for Zabbix MQTT monitoring

Eclipse Mosquitto is an open-source MQTT broker that the Eclipse Foundation hosts, with development driven by Cedalo. It is dual licensed under the Eclipse Public License 2.0 or the Eclipse Distribution License 1.0, so your legal team can choose the license that fits its review process. It implements MQTT 5.0, 3.1.1 and 3.1, and it is described as lightweight enough for devices from low-power single board computers to full servers, which suits sensor sites with modest hardware.

  • Licensing: The EPL-2.0 or BSD-3-Clause dual license is documented in the project's LICENSE file. Confirm the choice with your legal team before you build on it.
  • Protocol support: MQTT 5.0, 3.1.1 and 3.1 are implemented, so check which version your IoT devices publish with.
  • Bridges: The mosquitto.conf manual documents bridges for linking multiple Mosquitto brokers, with certificate and pre-shared-key TLS options for bridge connections.
  • Pro Edition: Cedalo's commercially licensed Pro Edition adds high availability, integrations, REST APIs, persistent queuing and professional support. If you need failover or durable queues, price that edition as a separate decision.
  • Community support: The open-source edition comes with a community forum rather than a vendor support contract.

Before choosing Mosquitto, confirm with your own tests that the TLS, WebSocket and client certificate settings you need work with the agent 2 MQTT plugin, as described on the Zabbix integration page.

How agent 2, the broker and the Zabbix server fit together

The diagram starts with sensors and devices publishing to an MQTT broker on the device side of the network. Agent 2 with the MQTT plugin sits on a host that can reach one or more brokers, and it polls them through the mqtt.get key, so the poll direction is active from the agent. Values then travel to the Zabbix server, either directly or through an optional proxy, and land in items configured for active checks. Check each link that crosses a trust boundary, especially the TLS or WebSocket connection to the broker and the firewall path from the agent host.

Data path from MQTT publishers through agent 2 to the Zabbix server, with trust boundaries marked.

Configuring Zabbix MQTT monitoring step by step

This sequence takes a Zabbix server with agent 2 from a bare plugin install to a sensor value flowing through an MQTT subscription into latest data. Each step ends with a check you can run before moving on, so faults are isolated to one layer at a time.

  1. Confirm the MQTT plugin and its configuration

    On the host running Zabbix agent 2, confirm the MQTT plugin is present in the installed agent 2 build and that its configuration file names the broker, port and TLS files you intend to use. Your Zabbix or infrastructure team owns this host and the file paths. Done means agent 2 starts cleanly with the plugin loaded and the log shows no configuration errors. If the plugin is missing, confirm with your package source whether your agent 2 build includes it before changing anything else.

  2. Create a test topic and publish to it

    Before involving Zabbix, create a dedicated test topic on the broker, such as a namespaced topic used only for this integration, and publish a known JSON payload to it from a separate client. Your broker administrator usually makes this change, and you should confirm the topic naming and write permissions with them. Done means a subscriber on the same topic receives the exact payload you sent. This gives you a known-good message to compare against later.

  3. Add an active-check item with mqtt.get

    In the Zabbix frontend, create an item on the target host with the type that runs through agent 2 and the key mqtt.get, supplying broker, topic, username and password in the key parameters. Remember that the MQTT plugin supports active checks only, so the item must be set up for active collection on a host whose agent is configured for active checks. Done means the item shows a value or a clear error in the item test dialog. If it returns an authentication or connection error, check the broker address, port and credentials first.

  4. Add TLS files for encrypted brokers

    For a tls:// broker, add the CA, client certificate and private key file paths to the named session in the agent 2 configuration, so each session presents its own certificate set. Your security team should supply and approve these files, and file permissions must let the agent user read the private key. Done means the item returns a value over the encrypted session and the broker log records a connection from the expected client identity. A failure at this step usually points to a certificate chain or name mismatch.

  5. Add a wildcard subscription and confirm JSON output

    Create a second item that uses the + or # wildcard in the topic parameter so it covers several sensor topics at once. The plugin returns the matched messages as JSON, so the output will include the topic and payload for each message. Done means the item value is valid JSON containing the test topic you published in an earlier step. Confirm that the wildcard matches only the topics you intend, because broad patterns can pull in unrelated traffic.

  6. Extract the sensor value with preprocessing

    Create a dependent item on the wildcard master item, then add a JSONPath preprocessing step that selects the sensor reading for one topic from the JSON. Set the value type to match the reading, such as numeric for temperature. Done means the dependent item appears in latest data with the same value you published, and the value updates when you publish a new message. If the value is missing, compare the JSON structure in the master item output with the path you configured.

How mqtt.get parameters map to broker and topic data

This table maps each mqtt.get element to what it means, who in your organization should own it, and what to record before building items. Read it as a checklist: every row is a decision the team must make and document before the first item is created. The main takeaway is that the broker address, topic filter and TLS session files are set by different owners, so agree on them early.

Parameter or elementWhat it controlsWho should own itWhat to record
Broker address and schemeWhether the connection uses tcp://, ws:// or tls:// to reach the broker, and which host the agent 2 plugin dialsBroker or messaging teamScheme, hostname, and whether the broker is reached directly or through a proxy path
PortDefaults to 1883 when the broker address omits a port; TLS and WebSocket listeners usually run on other portsBroker team, with network team confirming firewall rulesListener port for each scheme, confirmed against the broker configuration
Topic path and wildcardsThe topic filter, including + for one level and # for all remaining levels, which sets how much data one item receivesSensor or device owner with the Zabbix administratorTopic tree agreed in writing, with the wildcard scope and the expected message volume
Username and passwordBroker credentials passed as key parameters, so the secret ends up in item configurationBroker administrator; Zabbix owner stores the secretAccount name, least-privilege topic permissions, and where the secret is kept in Zabbix
Named TLS session files (CA, certificate, key)Each named session loads its own CA, client certificate and private key, so several brokers can use different trust chainsPKI or security team issues files; Zabbix host administrator deploys them to agent 2Session name, file paths on the agent host, certificate expiry date and renewal owner
JSON output of wildcard topicsA wildcard subscription returns a JSON document containing matching topics and their latest values, not a single numberZabbix administrator designing itemsExpected JSON shape, topics that match, and which fields become individual items
Preprocessing to item valuesDependent items or JSONPath steps extract one value per topic from the JSON, turning it into a numeric or text itemZabbix administratorEach extracted path, value type, and the unit or mapping applied to it
Receiving host and item keyThe Zabbix host that holds the mqtt.get item and the key that stores the value, which drives triggers and dashboardsZabbix administrator and the team owning the sensorHost name, item key naming convention, and the trigger owner for each value

Securing Zabbix MQTT monitoring credentials and certificates

The agent 2 MQTT plugin holds broker credentials and certificate files on the monitoring host, so its access needs the same care as any other service account. The controls below work together: narrow accounts, verified TLS, tight file handling, and limits on which hosts can connect. Confirm each one against your chosen broker's documentation before you rely on it.

Dedicated read-only broker account

Create a separate broker account for each monitoring use, with no publish rights and subscribe rights limited to the topics the items need. Where the broker supports topic-level access control lists, grant exact topic filters rather than broad wildcards, so a leaked monitoring credential cannot read unrelated sensor or control traffic. Confirm how your broker expresses these permissions, since the mqtt.get key itself only subscribes and does not show what the account is allowed to see.

Zabbix MQTT docs

TLS with CA validation

Use tls:// brokers so the session is encrypted, and point the CA file at the authority that issued the broker certificate. Without CA validation, the agent 2 host may accept a broker certificate from anyone, which defeats the purpose of the encrypted connection. Check the broker hostname against the certificate subject as well, and test the connection with the same key names the item uses so failures surface before the item goes live.

Per-session client certificates and keys

The plugin takes CA, certificate and key files per named session, so give each broker session its own certificate and key pair when the broker requires client certificates. Store key files readable only by the agent 2 service user, typically with restrictive file modes and ownership, and keep them out of shared configuration templates. Rotate a session's certificate without touching the others, and record which host holds which key.

WebSocket connections behind HTTP paths

When the broker sits behind a reverse proxy on an HTTP path, use the ws:// or tls:// broker form that matches how the proxy terminates TLS. Confirm that the proxy forwards the WebSocket upgrade and enforces its own authentication and TLS settings, because the broker's protections do not extend to an unprotected proxy path. Verify the full path end to end from the agent 2 host, since a successful connection to the proxy alone does not prove the broker is reached securely.

Keeping passwords out of items and logs

Item keys carry the username and password as parameters, so a password written into a shared item definition is visible to anyone who can read the host or template configuration. Keep the value in a macro that users with the right permissions can see, and avoid pasting it into item names, descriptions or ticket text. Review agent 2 log settings and debug output, since connection errors can echo broker details. Confirm the exact macro and secret handling options in your Zabbix version.

Restricting hosts and reviewing broker auth options

Limit network access to the broker so that only the agent 2 hosts or their proxy paths can open sessions, using firewall rules or broker listener bindings. Then review the broker's authentication methods, such as X.509 client certificates or JWT tokens where it offers them, and choose the strongest option your broker supports for these sessions. Record the decision for each control with the broker version in use, so the review can be repeated after upgrades.

Testing wildcard topics and JSON output before go-live

Test the mqtt.get item against a broker you control before any sensor fleet depends on it. Start by publishing known test messages with a broker client tool such as mosquitto_pub from the Mosquitto client set, to a topic path that mirrors your real naming, for example a lab topic like lab/site1/sensor7/temperature (illustrative). Then run the same key with + and # wildcards in the topic argument and confirm the returned JSON has the structure your preprocessing expects: the field names, nesting and value types for each message. Wildcard results can differ from a single topic subscription, so check every pattern your items will use, including topics that sit at different depths under the same # filter.

Next, measure how often messages arrive against how often the active item polls. The MQTT plugin runs as an active check in agent 2, so a broker that publishes faster than the item interval will deliver more messages than Zabbix reads, and the item returns only what the broker holds at the moment of the poll. Publish at the rate your sensors really send, record the gap between publish timestamps and what Zabbix receives, and decide whether the interval, the topic design or a different collection path fits the data. Confirm the delivery behavior with your own broker configuration, because retained messages and session settings affect what a new subscription sees.

Finally, check that TLS sessions fail closed. Configure a tls:// session with the correct CA, certificate and key files, then deliberately point it at a wrong CA or an expired or mismatched certificate and confirm the item returns an error rather than data. The public test server at test.mosquitto.org supports plain MQTT, MQTT over TLS, client certificates and WebSockets, which makes it useful for lab checks of these steps. It is suitable for lab checks only, not for production sensor data, because it is a shared public service you do not control. Repeat the failure tests on your production-equivalent broker before go-live.

Why Zabbix MQTT monitoring items stop returning values

This table lists the failures that most often leave mqtt.get items empty or unsupported, with the likely cause and the fix for each. Work through the rows in order when an item stops updating, since the first few causes are the cheapest to rule out.

Symptom or failureLikely causeFix
Item stays unsupported after creationItem configured as passive, but the agent 2 MQTT plugin supports active checks onlySet the item type to Zabbix agent (active) and confirm the host's active checks are enabled and reachable
Connection fails on a broker with a non-standard portBroker listens on a port other than the default 1883, and the broker string omits itInclude the port explicitly in the tcp://, ws:// or tls:// broker string and test the same address from the agent 2 host
Item returns data but triggers never fireWildcard topic (+ or #) returns a JSON structure that the item's preprocessing does not parse as expectedInspect the raw JSON from a test run, then add JSONPath preprocessing that targets the specific field you need
TLS session fails with a certificate errorCA, certificate or key file is named incorrectly in the per-session configuration, or the CA chain does not match the broker certificateCheck the session name and file paths against the agent 2 configuration, then confirm the full chain from the broker's CA is in the CA file
WebSocket broker unreachable through the proxyThe ws:// or wss path is not forwarded by the reverse proxy or load balancer in front of the brokerConfirm the WebSocket path and upgrade headers are passed through, and test the broker from the agent 2 host using the same path
Authentication refused for the monitoring accountBroker ACL denies the username read access to the monitored topicsGrant the monitoring account subscribe permission on the exact topic filters, then retest with the same credentials
No connection from the agent 2 host at allFirewall or network policy blocks the agent 2 host from reaching the broker portOpen the broker port from the agent 2 host (or its proxy) and verify the path with a simple connection test before debugging the item
Values stop after a cluster or edition change on EMQXClustering above one node requires a license file from EMQX 5.9.0 onward, and single-node production use has terms in the Business Source LicenseConfirm the license terms for your node count and load a license file before expanding the cluster, then recheck the broker endpoint
Community template items are unsupported or mismatchedMosquitto or EMQ template on the Zabbix integration page is community-maintained, not verified by Zabbix, and may not match your broker versionCompare the template's keys and topics with your broker version, adjust them, and test each item before relying on its triggers

What buyers ask about Zabbix MQTT monitoring cost, effort and scope

Can our team set up Zabbix MQTT monitoring without outside help?

Yes, if you have someone who already runs Zabbix and can administer a broker, because the agent 2 MQTT plugin ships with agent 2 and needs no separate install. The work that usually takes the most care is not the first mqtt.get item but the design around it: which brokers and topics matter, how TLS certificates are handled for each session, and who owns the data once it reaches Zabbix. A team with those skills in-house can build a small pilot alone. A larger estate with many brokers, WebSocket paths and sensor fleets often benefits from a fixed-scope review, so the design is written down before items multiply across hosts.

What drives the effort of an MQTT monitoring project?

Effort rises with the number of things Zabbix has to reach and the way each one is secured. The main drivers are:

  • Broker count: each broker needs its own address, credentials and test path, and the plugin can monitor several at once.
  • Topic count and wildcard design: + and # wildcards return JSON, so broad patterns are quick to write but can return more data than your items need.
  • TLS and certificate handling: tls:// brokers take CA, certificate and key files per named session, which means managing those files on every agent.
  • WebSocket paths: ws:// connections and proxy routes add network checks that must be confirmed end to end.
  • Existing broker or new broker: reusing a broker you run avoids migration work, while a new broker adds deployment, access control and testing scope.
What do we need to provide before a monitoring project starts?

You provide access and decisions, and the project cannot move faster than those are available. Expect to supply:

  • Broker access: hostnames, ports, the accounts the agent will use and read-only permission on the topics involved.
  • A topic catalog: the topics that carry sensor or device data, their message format and which values should drive alerts.
  • Certificates: CA, client certificate and key files for each TLS session, along with renewal ownership.
  • A test window: a period when the team can confirm values arrive and that broker load stays acceptable.
  • A named owner for sensor data: one person who decides what a missing or stale value means and who responds to it.
Does a broker license change the plan for EMQX clusters?

Yes, a licence can change both the architecture and the budget, so check it before you choose EMQX. EMQX moved to the Business Source License 1.1 from version 5.9.0, and from that release a cluster of more than one node requires loading a license file. The licence also limits hosted or embedded offerings to third parties, while production use of a single node is allowed. Each release under that licence converts to Apache 2.0 four years after publication. Confirm with EMQX which edition and node count you need, and include licence handling in the written scope. Mosquitto is dual licensed under EPL-2.0 or BSD-3-Clause, so a single-node or clustered design can be evaluated against different terms.

Does Zabbix ship an official MQTT template?

No, Zabbix does not list an official MQTT template. The integration page lists Mosquitto and EMQ templates, but Zabbix states these are community integrations it does not verify. Before you rely on one, review its items, triggers and macros against your own topics, test it against a real broker, and confirm who maintains it. Plan to write or adjust items for your own topic structure, since a community template will rarely match your sensor naming. Keep the template under your change control so that upgrades to Zabbix or the broker do not change monitoring silently.

How does a fixed-scope quote follow from the written scope?

A fixed-scope quote follows from the written scope, which lists brokers, topics, TLS sessions, WebSocket paths, deliverables and the test window. DeployOpen agrees scope, deliverables and timelines in writing before work starts, and the quote is derived from that document rather than a price list. To compare quotes, ask each provider to state how many brokers and topic groups are included, whether certificate handling and template review are covered, what the client must supply, and what happens if the broker licence or topic catalog changes during the work. Ongoing support and upgrades can be handled as a separate retainer.

How DeployOpen scopes and delivers Zabbix MQTT monitoring

DeployOpen plans, builds and documents Zabbix MQTT monitoring with agent 2 inside your own infrastructure, starting from a written scope of brokers, topics and sensor data. The work covers agent 2 configuration, the mqtt.get item design, TLS handling and the handover your operations team needs to run it.

How we scope

  • We list every MQTT broker, topic pattern and payload format the written scope will cover before any item is designed.
  • We record which brokers use tcp://, ws:// or tls:// and which agent 2 hosts can reach them through your firewall rules.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts, and quoted from that scope.

How we build

  • We configure agent 2 with the MQTT plugin on the hosts you name, with named sessions for each broker and its CA, certificate and key files.
  • We design active-check mqtt.get items, wildcard subscriptions with + and # and the JSON preprocessing needed to turn payloads into Zabbix items.
  • We test each broker connection, TLS session and message pattern in a staging setup in your environment before anything reaches production.

How we hand over

  • You receive the agent 2 configuration, item and trigger definitions, and a record of the broker, certificate and credential decisions made.
  • We document the active-checks-only limitation, the community template status of Mosquitto and EMQ templates, and the items your team must maintain.
  • We walk your monitoring and security staff through the setup and the runbook for renewing certificates and rotating broker credentials.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer, covering agent 2 and Zabbix version changes after handover.
  • We can retest the MQTT configuration after broker upgrades, certificate renewals or changes to topic structures.
  • Support scope, response expectations and any Zabbix support subscription are confirmed in writing before the retainer starts.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.