6.8. Integration with Zabbix #

Zabbix is a popular monitoring platform for tracking IT infrastructure and visualizing its status. When Postgres Pro is deployed on a machine, there may be a need to send metrics collected from this DBMS instance to Zabbix. One common tool for this task is mamonsu — an active agent for collecting and sending metrics to Zabbix, written in Python. pgpro-otel-collector can also be used for this purpose.

6.8.1. Setting up Zabbix #

Both mamonsu and pgpro-otel-collector follow the same metrics export scheme to Zabbix. The scheme is displayed in Figure 6.1.

Figure 6.1. Zabbix Metrics Export Scheme

Zabbix Metrics Export Scheme

Where:

  • Template is a template that needs to be uploaded by the user before starting the active agent.

  • Active agent is a service that sends metric values via the sender protocol.

In mamonsu, the template is generated with the following command:

mamonsu zabbix template export template.xml

With pgpro-otel-collector, a ready-made template is distributed with the installation package. For pgpro-otel-collector installation instructions, refer to Chapter 5.

To import the template, perform the steps below.

  1. Navigate to the Templates tab in the Data collection section.

  2. Click the Import button in the upper right corner. Refer to Figure 6.2.

    Figure 6.2. Zabbix Template

    Zabbix Template

  3. After successfully importing the template, go to the Hosts tab and click Create host in the upper right corner, as shown in Figure 6.3.

    Figure 6.3. Zabbix Host

    Zabbix Host

  4. Fill in the fields as follows:

    • Host name: Prometheus

    • Templates: OTel Template

    • Host groups: Prometheus

  5. Click the Add button. The host with the required template is successfully created.

6.8.2. Configuring the zabbix Exporter #

Now let's configure the zabbix exporter in pgpro-otel-collector:

  1. In the zabbixexporter configuration section, specify the address where Zabbix is located and the port. The default hostname is set to the machine name where pgpro-otel-collector is deployed. In this example, the hostname is Prometheus:

    receivers:
      postgrespro:
        endpoint: postgres_host:5432
        database: postgres
        username: postgres
        password: postgres
        collection_interval: 60s
        initial_delay: 1s
        max_threads: 3
        plugins:
          version:
            enabled: true
          databases:
            enabled: true
            databases:
              - name: postgres
    exporters:
      zabbixexporter:
        endpoint: zabbix_host:10051 # Fill in the address
        host: Prometheus            # Fill in the hostname if needed
        batch_max_size: 100         # Set how many metrics are sent per request to Zabbix
    service:
      pipelines:
        metrics:
          receivers:
            - postgrespro
          exporters:
            - zabbixexporter
    

    For more details on configuring the postgrespro receiver, refer to Working with Metrics.

  2. Edit the unit file:

    sudo systemctl edit --full pgpro-otel-collector.service
    
  3. Change the path to the configuration file:

    ...
    [Service]
    ...
    ExecStart=/usr/bin/pgpro-otel-collector --config /etc/pgpro-otel-collector/zabbix.yml
    ...
    
  4. Restart the service and check its status:

    sudo systemctl restart pgpro-otel-collector.service
    sudo systemctl status pgpro-otel-collector.service
    

    The logs should show the following entries indicating successful metrics delivery to Zabbix:

    2025-09-23T14:28:21.855+0300  info  zabbixexporter/exporter.go:64       send discovery to zabbix succeeded   {"resource": {"service.instance.id": "0440f9d8-00de-427a-a8af-19e81d6d080a", "service.name": "pgpro-otel-collector", "service.version": "v0.4.0"}, "otelcol.component.id": "zabbixexporter", "otelcol.component.kind": "exporter", "otelcol.signal": "metrics", "processed": 2, "failed": 0, "total": 2, "spent_seconds": 0.000083}
    2025-09-23T14:28:33.199+0300  info  zabbixexporter/metrics_queue.go:88  send metrics to zabbix succeeded     {"resource": {"service.instance.id": "0440f9d8-00de-427a-a8af-19e81d6d080a", "service.name": "pgpro-otel-collector", "service.version": "v0.4.0"}, "otelcol.component.id": "zabbixexporter", "otelcol.component.kind": "exporter", "otelcol.signal": "metrics", "processed": 33, "failed": 0, "total": 33, "spent_seconds": 0.000229}
    
  5. Check for data in the Latest data tab under the Monitoring section. Data should be successfully sent to Zabbix (Figure 6.4).

    Figure 6.4. Zabbix Monitoring

    Zabbix Monitoring

6.8.3. Tips on Migration from mamonsu #

Note that the item keys sent by pgpro-otel-collector differ from those sent by mamonsu:

  • pgpro-otel-collector: postgresql.databases.size_bytes[postgres]

  • mamonsu: pgsql.db.size["{$PG.CONNSTRING}","{$PG.USER}","{$PG.PASSWORD}","postgres"]

The set of metrics also differs. Check the correctness of the keys in existing automations, if there are any. The template supplied with pgpro-otel-collector does not contain graphs or graph prototypes. Thus, it is recommended to use a combination of the prometheus exporter, Prometheus, and Grafana.