KumoMTA

As a supporter of Open Source software we support one product in particular which is KumoMTA. Currently they don’t support prefab Debian 12 packages. So for now I will create Debian 12 packages of the kumota-dev version so now and then.

Zabbix KumoMTA metrics template

KumoMTA has a nice metrics API on the URL /metrics.json to fetch data from KumoMTA. I created some items which are in general handy to monitor KumoMTA and a dashboard.

In KumoMTA you do need to configure HTTP API access. I configured it on port 8000 using the following config in the init.lua in the kumo.on(ínit’, function() section:

-- Configure HTTP Listeners for injection and management APIs.
-- See https://docs.kumomta.com/userguide/configuration/httplisteners/
kumo.start_http_listener {
listen = '0.0.0.0:8000',
-- allowed to access any http endpoint without additional auth
trusted_hosts = { '127.0.0.1', '::1' , '<internal IP of KumoServer' },
}

For the template to work you only need a working zabbix agent which can do the web.page.get function on the KumoMTA server:

web.page.get[{$KUMOMTA_HOST},/metrics.json,{$KUMOMTA_PORT}]

To get started import the following zabbix_kumomta_temnplate.zip into your Zabbix and assign it to a KumoMTA host.

An examample of the Zabbix Dashboard graphs is here:

Local zabbix script on KumoMTA server

Little update on 2025-05-06
Apparently this only works if you don’t have that many queues in KumoMTA, otherwise the API request will send too much info and Zabbix will choke on it.

So for most uses you will need to use a script on the local KumoMTA server to filter info from the API call:
vi /usr/local/bin/get_kumomta_stats.sh

#!/bin/bash
PARAMETER=$1
curl -s http://localhost:8000/metrics.json | jq .${PARAMETER}

Make the file executable using:
chmod 755 /usr/local/bin/get_kumomta_stats.sh

zabbix_agentd.d/kumomta-script.conf:

UserParameter=kumomta[*], bash /usr/local/bin/get_kumomta_stats.sh $1

The zabbix template looks like:

zabbix_export:
  version: '6.4'
  template_groups:
    - uuid: dc579cd7a1a34222933f24f52a68bcd8
      name: 'Linux servers'
  templates:
    - uuid: b06e8e57c49445729ca8cdd4ea3a2e4a
      template: 'Template KumoMTA Stats'
      name: 'Template KumoMTA Stats'
      description: 'Template to filter out generic Metric information of KumoMTA using a script in /usr/local/bin/get_kumomta_stats.sh'
      groups:
        - name: 'Linux servers'
      items:
        - uuid: e54038aae17f4ef8825946a8aae1a13b
          name: 'Kumo: connection count smtp_client'
          key: 'kumomta[connection_count.value.service.smtp_client]'
          description: 'connection count of the smtp_client'
        - uuid: 0d9d104c9f214cd1ad9e213fbf4168de
          name: 'Kumo: Memory Usage'
          key: 'kumomta[memory_usage.value]'
          description: 'Messages Delivered in Kumomta'
          preprocessing:
            - type: MULTIPLIER
              parameters:
                - '0.000001'
        - uuid: 4b82210a0b1f4f79810107edf12ea12c
          name: 'Kumo: Message count'
          key: 'kumomta[message_count.value]'
          description: 'Number of messages in Kumomta'
        - uuid: 2df3e4ab1a2449c5af45fddc69f2e327
          name: 'Kumo: Messages Delivered'
          key: 'kumomta[total_messages_delivered.value.service.smtp_client]'
          description: 'Messages Delivered in Kumomta'
          preprocessing:
            - type: SIMPLE_CHANGE
              parameters:
                - ''
        - uuid: 54c7fe4ad90642be90388d256efc339f
          name: 'Kumo: Messages failed'
          key: 'kumomta[total_messages_fail.value.service.smtp_client]'
          description: 'Failed messages in Kumomta'
          preprocessing:
            - type: SIMPLE_CHANGE
              parameters:
                - ''
        - uuid: 614fd94521bb4350beb1479d41d9ca2e
          name: 'Kumo: Messages Transfail'
          key: 'kumomta[total_messages_transfail.value.service.smtp_client]'
          description: 'Transient failed messages in Kumomta'
          preprocessing:
            - type: SIMPLE_CHANGE
              parameters:
                - ''
      tags:
        - tag: kumomta
          value: 'true'
      macros:
        - macro: '{$KUMOMTA_HOST}'
          value: 127.0.0.1
          description: 'The IP address of the KumoMTA server for fetching metrics.json'
        - macro: '{$KUMOMTA_LOG_HOOK}'
          value: log_hook
        - macro: '{$KUMOMTA_PORT}'
          value: '8000'
          description: 'The Port of the above KumoMTA server for fetching metrics.json'
  graphs:
    - uuid: 6d1af032ed8746b885596fab8c9887f2
      name: 'Kumo: Message count'
      graph_items:
        - sortorder: '1'
          color: 1A7C11
          item:
            host: 'Template KumoMTA Stats'
            key: 'kumomta[message_count.value]'