This check monitors the size of all your Postfix queues.
Find below instructions to install and configure the check when running the Agent on a host. See the Autodiscovery Integration Templates documentation to learn how to apply those instructions to a containerized environment.
The Postfix check is included in the Datadog Agent package, so you don’t need to install anything else on your Postfix servers.
This check can be configured to use the
find command which requires granting the dd-agent user sudo access to get a count of messages in the
deferred mail queues.
Optionally, you can configure the agent to use a built in
postqueue -p command to get a count of messages in the
deferred mail queues.
postqueue is exectued with set-group ID privileges without the need for sudo.
postqueue to monitor the mail queues will not report a count of messages for the
init_config: postfix_user: postfix instances: # add one instance for each postfix service you want to track - directory: /var/spool/postfix queues: - incoming - active - deferred # tags: # - optional_tag1 # - optional_tag2
For each mail queue in
queues, the Agent forks a
find on its directory.
sudo to do this with the privileges of the Postfix user, so you must
add the following lines to
/etc/sudoers for the Agent’s user,
assuming Postfix runs as
dd-agent ALL=(postfix) NOPASSWD:/usr/bin/find /var/spool/postfix/incoming -type f dd-agent ALL=(postfix) NOPASSWD:/usr/bin/find /var/spool/postfix/active -type f dd-agent ALL=(postfix) NOPASSWD:/usr/bin/find /var/spool/postfix/deferred -type f
postfix.d/conf.yaml file, in the
conf.d/ folder at the root of your Agent’s configuration directory:
init_config: postqueue: true instances: # The config_directory option only applies when `postqueue: true`. # The config_directory is the location of the Postfix configuration directory # where main.cf lives. - config_directory: /etc/postfix # tags: # - optional_tag # - optional_tag0
instances, the Agent forks a
postqueue -c for the Postfix configuration directory.
Postfix has internal access controls that limit activities on the mail queue. By default, Postfix allows
anyone to view the queue. On production systems where the Postfix installation may be configured with stricter access controls, you may need to grant the dd-agent user access to view the mail queue.
postconf -e "authorized_mailq_users = dd-agent"
List of users who are authorized to view the queue.
Restart the Agent to start sending Postfix metrics to Datadog.
Available for Agent >6.0
Postfix sends logs to the syslog daemon, which then writes logs to the file system.
The naming convention and log file destinations are configurable:
/etc/syslog.conf: mail.err /dev/console mail.debug /var/log/maillog
postfix.d/conf.yamlfile. Change the
serviceparameter values based on your environment. See the sample postfix.d/conf.yaml for all available configuration options.
logs: - type: file path: /var/log/mail.log source: postfix service: myapp
Learn more about log collection in the log documentation
Run the Agent’s
status subcommand and look for
postfix under the Checks section.
|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
The Postfix check does not include any events.
The Postfix check does not include any service checks.
Need help? Contact Datadog support.
Mistake in the docs? Feel free to contribute!