---
title: Telegraf Documentation
description: Telegraf plugin for collecting metrics from OpenSMTPD
url: https://docs.influxdata.com/telegraf/v1/input-plugins/opensmtpd/
estimated_tokens: 1681
product: Telegraf
version: v1
---

-   Telegraf v1.5.0+

# OpenSMTPD Input Plugin

This plugin gathers statistics from [OpenSMTPD](https://www.opensmtpd.org/) using the `smtpctl` binary.

The `smtpctl` binary must be present on the system and executable by Telegraf. The plugin supports using `sudo` for execution.

**Introduced in:** Telegraf v1.5.0 **Tags:** server, network **OS support:** all

## Global configuration options

Plugins support additional global and plugin configuration settings for tasks such as modifying metrics, tags, and fields, creating aliases, and configuring plugin ordering. See [CONFIGURATION.md](/telegraf/v1/configuration/#plugins) for more details.

## Configuration

```toml
# A plugin to collect stats from Opensmtpd - a validating, recursive, and caching DNS resolver
 [[inputs.opensmtpd]]
   ## If running as a restricted user you can prepend sudo for additional access:
   #use_sudo = false

   ## The default location of the smtpctl binary can be overridden with:
   binary = "/usr/sbin/smtpctl"

   # The default timeout of 1s can be overridden with:
   #timeout = "1s"
```

### Permissions

It’s important to note that this plugin references `smtpctl`, which may require additional permissions to execute successfully. Depending on the user/group permissions of the telegraf user executing this plugin, you may need to alter the group membership, set facls, or use sudo.

#### Group membership (recommended)

```bash
$ groups telegraf
telegraf : telegraf

$ usermod -a -G opensmtpd telegraf

$ groups telegraf
telegraf : telegraf opensmtpd
```

#### Sudo privileges

If you use this method, you will need the following in your telegraf config:

```toml
[[inputs.opensmtpd]]
  use_sudo = true
```

You will also need to update your sudoers file:

```bash
$ visudo
# Add the following line:
Cmnd_Alias SMTPCTL = /usr/sbin/smtpctl
telegraf  ALL=(ALL) NOPASSWD: SMTPCTL
Defaults!SMTPCTL !logfile, !syslog, !pam_session
```

Please use the solution you see as most appropriate.

## Metrics

This is the full list of statistics provided by smtpctl and potentially collected by telegraf depending of your smtpctl configuration.

-   smtpctl bounce\_envelope bounce\_message bounce\_session control\_session mda\_envelope mda\_pending mda\_running mda\_user mta\_connector mta\_domain mta\_envelope mta\_host mta\_relay mta\_route mta\_session mta\_source mta\_task mta\_task\_running queue\_bounce queue\_evpcache\_load\_hit queue\_evpcache\_size queue\_evpcache\_update\_hit scheduler\_delivery\_ok scheduler\_delivery\_permfail scheduler\_delivery\_tempfail scheduler\_envelope scheduler\_envelope\_expired scheduler\_envelope\_incoming scheduler\_envelope\_inflight scheduler\_ramqueue\_envelope scheduler\_ramqueue\_message scheduler\_ramqueue\_update smtp\_session smtp\_session\_inet4 smtp\_session\_local uptime

## Example Output

```text
opensmtpd,host=localhost scheduler_delivery_tempfail=822,mta_host=10,mta_task_running=4,queue_bounce=13017,scheduler_delivery_permfail=51022,mta_relay=7,queue_evpcache_size=2,scheduler_envelope_expired=26,bounce_message=0,mta_domain=7,queue_evpcache_update_hit=848,smtp_session_local=12294,bounce_envelope=0,queue_evpcache_load_hit=4389703,scheduler_ramqueue_update=0,mta_route=3,scheduler_delivery_ok=2149489,smtp_session_inet4=2131997,control_session=1,scheduler_envelope_incoming=0,uptime=10346728,scheduler_ramqueue_envelope=2,smtp_session=0,bounce_session=0,mta_envelope=2,mta_session=6,mta_task=2,scheduler_ramqueue_message=2,mta_connector=7,mta_source=1,scheduler_envelope=2,scheduler_envelope_inflight=2 1510220300000000000
```

#### Related

-   [Configure plugins](/telegraf/v1/configure_plugins/)
-   [OpenSMTPD Plugin Source](https://github.com/influxdata/telegraf/tree/v1.38.4/plugins/inputs/opensmtpd/README.md)
