Stackstate-Postfix Integration

Overview

Get metrics from Postfix in real time to monitor the messages pending in your Postfix mail queues.

Setup

Configuration

  1. Make sure that the user that sts-agent runs has sudo access for the ‘find’ command.
  2. Configure the Agent to connect to Postfix. Edit conf.d/postfix.yaml:

            # The user running sts-agent must have passwordless sudo access for the find
            # command to run the postfix check.  Here's an example:
            #
            # example /etc/sudoers entry:
            #  sts-agent ALL=(postfix) NOPASSWD:/usr/bin/find /var/spool/postfix/incoming -type f
            #  sts-agent ALL=(postfix) NOPASSWD:/usr/bin/find /var/spool/postfix/active -type f
            #  sts-agent ALL=(postfix) NOPASSWD:/usr/bin/find /var/spool/postfix/deferred -type f
            #
            # Redhat/CentOS/Amazon Linux flavours will need to add:
            #          Defaults:sts-agent !requiretty
    
            init_config:
    
            instances:
              - directory: /var/spool/postfix
                queues:
                  - incoming
                  - active
                  - deferred
                tags:
                  - optional_tag1
                  - optional_tag2
              - directory: /var/spool/postfix-2
                queues:
                  - incoming
                  - active
                  - deferred
                tags:
                  - optional_tag3
                  - optional_tag4
    

  3. Restart the Agent

Validation

Execute the info command and verify that the integration check has passed. The output of the command should contain a section similar to the following:

Checks
======

  [...]

  postfix
  -------
      - instance #0 [OK]
      - Collected 8 metrics & 0 events

Data Collected

Metrics

postfix.queue.size
(gauge)
The number of messages in a given mail queue, tagged by queue name (e.g. 'queue:incoming') and directory (e.g. 'instance:/var/spool/postfix/incoming').
shown as email