Monitoring Zammad with Zabbix

This article describes a way to monitor the helpdesk support system Zammad with Zabbix 4.

Zammad API

Our company switched to the new and shiny Zammad ticket system and everybody was happy. Of course, you want to monitor such a new application. A quick glance into the documentation of Zammad shows the usage of the monitoring API.

Inside Zammad you have to generate a token in the System → Monitoring menu. The URL to access the API is

https://<your zammad server>/api/v1/monitoring/health_check

According to the documentation of Zammad, the token can be added as a parameter in the URL or as a header.

The server responds with a JSON blob, ideally indicating that everything is working fine:

      "token":"<your token>"

Zabbix 4.0

In Zabbix 4.0 a new type of agent appeared - the HTTP agent. This new type of agent allows you to collect monitoring information via HTTP. You find the complete documentation in the manual of Zabbix.

The new agent is able to parse the server’s reply; it can identify specific keys and values in the response. This can be done via regex parsing or by pulling apart JSON objects. This makes the new agent so powerfull.

First of all you have to add an item requesting the website from you Zammad server. Give it a name and a key and select the type HTTP agent. The URL must be the monitoring API URL of the Zammad server as given above. Add the token to the Query fields and create a new application Zammad for the item.

When Zabbix starts to gather information from the API you can see the raw JSON data in MonitoringLatest Data.

Zabbix Dependent Items

The next step in monitoring the Zammad health status is to parse the answer of the server. Create a new item of the type Dependent item and choose the item you created above as the master item. So the new item gets updated every time, when Zabbix requests new data from the Zammad server.

Creating a new dependent item

In the Preprocessing tab of the item you can setup the parsing of the original JSON blob.

As the processing step set the Name to JSON Path and $.body.healthy as parameter. This preprocessing updates the new item with the value of the healthy key. Now you can add a trigger that fires if the health status of your Zammad is not true.

Parsing the JSON object with the proprocess option

You also can add a second dependent item that reflects the value of the message key. The contents of this field can be used in the description field of the trigger. This description will the used in the message that is sent out to the administrators. The detailed message will help the admins to analyse and fix the problem.

Michael Schwartzkopff, 26 Mar 2019

   Zammad    Zabbix    API