2017-11-29 02:08:41 +08:00
|
|
|
# Postfix Input Plugin
|
|
|
|
|
|
|
|
|
|
The postfix plugin reports metrics on the postfix queues.
|
|
|
|
|
|
2020-04-04 01:09:24 +08:00
|
|
|
For each of the active, hold, incoming, maildrop, and deferred queues
|
2021-11-25 02:50:01 +08:00
|
|
|
(<http://www.postfix.org/QSHAPE_README.html#queues>), it will report the queue
|
2020-04-04 01:09:24 +08:00
|
|
|
length (number of items), size (bytes used by items), and age (age of oldest
|
|
|
|
|
item in seconds).
|
2017-11-29 02:08:41 +08:00
|
|
|
|
2021-11-25 02:50:01 +08:00
|
|
|
## Configuration
|
2017-11-29 02:08:41 +08:00
|
|
|
|
2022-05-24 21:49:47 +08:00
|
|
|
```toml @sample.conf
|
2022-04-12 05:32:25 +08:00
|
|
|
# Measure postfix queue statistics
|
2017-11-29 02:08:41 +08:00
|
|
|
[[inputs.postfix]]
|
|
|
|
|
## Postfix queue directory. If not provided, telegraf will try to use
|
|
|
|
|
## 'postconf -h queue_directory' to determine it.
|
|
|
|
|
# queue_directory = "/var/spool/postfix"
|
|
|
|
|
```
|
|
|
|
|
|
2021-11-25 02:50:01 +08:00
|
|
|
### Permissions
|
2018-01-03 06:09:14 +08:00
|
|
|
|
|
|
|
|
Telegraf will need read access to the files in the queue directory. You may
|
|
|
|
|
need to alter the permissions of these directories to provide access to the
|
|
|
|
|
telegraf user.
|
|
|
|
|
|
2020-04-04 01:09:24 +08:00
|
|
|
This can be setup either using standard unix permissions or with Posix ACLs,
|
|
|
|
|
you will only need to use one method:
|
|
|
|
|
|
2018-01-03 06:09:14 +08:00
|
|
|
Unix permissions:
|
2021-11-25 02:50:01 +08:00
|
|
|
|
2018-01-03 06:09:14 +08:00
|
|
|
```sh
|
2021-11-25 02:50:01 +08:00
|
|
|
sudo chgrp -R telegraf /var/spool/postfix/{active,hold,incoming,deferred}
|
|
|
|
|
sudo chmod -R g+rXs /var/spool/postfix/{active,hold,incoming,deferred}
|
|
|
|
|
sudo usermod -a -G postdrop telegraf
|
|
|
|
|
sudo chmod g+r /var/spool/postfix/maildrop
|
2018-01-03 06:09:14 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Posix ACL:
|
2021-11-25 02:50:01 +08:00
|
|
|
|
2018-01-03 06:09:14 +08:00
|
|
|
```sh
|
2021-11-25 02:50:01 +08:00
|
|
|
sudo setfacl -Rm g:telegraf:rX /var/spool/postfix/
|
|
|
|
|
sudo setfacl -dm g:telegraf:rX /var/spool/postfix/
|
2018-01-03 06:09:14 +08:00
|
|
|
```
|
|
|
|
|
|
2021-11-25 02:50:01 +08:00
|
|
|
## Metrics
|
2017-11-29 02:08:41 +08:00
|
|
|
|
|
|
|
|
- postfix_queue
|
2020-04-04 01:09:24 +08:00
|
|
|
- tags:
|
|
|
|
|
- queue
|
|
|
|
|
- fields:
|
2017-11-29 02:08:41 +08:00
|
|
|
- length (integer)
|
|
|
|
|
- size (integer, bytes)
|
|
|
|
|
- age (integer, seconds)
|
|
|
|
|
|
2021-11-25 02:50:01 +08:00
|
|
|
## Example Output
|
2017-11-29 02:08:41 +08:00
|
|
|
|
2021-11-25 02:50:01 +08:00
|
|
|
```shell
|
2017-11-29 02:08:41 +08:00
|
|
|
postfix_queue,queue=active length=3,size=12345,age=9
|
|
|
|
|
postfix_queue,queue=hold length=0,size=0,age=0
|
|
|
|
|
postfix_queue,queue=maildrop length=1,size=2000,age=2
|
|
|
|
|
postfix_queue,queue=incoming length=1,size=1020,age=0
|
|
|
|
|
postfix_queue,queue=deferred length=400,size=76543210,age=3600
|
|
|
|
|
```
|