Export the amount of mails in a mailbox for use in prometheus.
http://127.0.0.1:9101/probe?target=INBOX&hostname=imap.example.com&username=me@example.com
# HELP probe_mailbox_count Displays the count of mails found in the mailbox
# TYPE probe_mailbox_count gauge
probe_mailbox_count 5
# HELP probe_mailbox_unread_count Displays the count of unread mails found in the mailbox
# TYPE probe_mailbox_unread_count gauge
probe_mailbox_unread_count 2
The imap-mailbox-exporter
can be configures with a config.yaml
file and environment variables.
server:
- hostname: 'imap.example.com'
port: '993'
accounts:
- username: 'me@example.com'
password: 'env:E_AT_MAIL_COM_PASSWORD'
You can use environment variables with the env:VARIABLE_NAME
directive in YAML.
The configuration file is expected in ./config.yaml
relative to the imap-mailbox-exporter
binary.
You can find a example docker compose configuration.
Make sure to update examples/imap-exporter.env
with your imap credentials.
Start the example container
pushd examples
docker compose pull
docker compose up -d
You can compile the source-code with the go build
command.
go build -o imap-mailbox-exporter main.go
Alternativly you can use gnu make
with the make build
command to execute the go build
command.
This project is licensed under the MIT License