EdMon (Email Delivery Monitor) is a lightweight email monitoring system that tracks email delivery, bounces, and performance. It helps ensure email systems are functioning correctly and provides alerts for delivery issues.
| File/Directory | Path | Purpose |
|---|---|---|
| Main config | /etc/edmon/config.yaml |
Main EdMon configuration |
| Database | /var/lib/edmon/edmon.db |
SQLite database |
| Logs | /var/log/edmon/ |
EdMon log files |
| Templates | /etc/edmon/templates/ |
Email templates |
| Rules | /etc/edmon/rules/ |
Monitoring rules |
| Systemd service | /etc/systemd/system/edmon.service |
Service definition |
| Environment | /etc/edmon/.env |
Environment variables |
# /etc/edmon/config.yaml
# ========================
# Server Settings
# ========================
server:
# Host and port for web interface
host: 0.0.0.0
port: 8080
# Base URL (for reverse proxy)
base_url: ""
# Enable HTTPS
https:
enabled: false
cert_file: /etc/edmon/ssl/cert.pem
key_file: /etc/edmon/ssl/key.pem
# ========================
# Database Settings
# ========================
database:
# Database type (sqlite, postgres, mysql)
type: sqlite
# SQLite configuration
sqlite:
path: /var/lib/edmon/edmon.db
# PostgreSQL configuration
postgres:
host: localhost
port: 5432
database: edmon
username: edmon
password: EdMonPassword123!
# Connection pool
pool:
max_open_conns: 10
max_idle_conns: 5
conn_max_lifetime: 300
# ========================
# Email Source Configuration
# ========================
sources:
# Mail log monitoring
mail_log:
enabled: true
paths:
- /var/log/mail.log
- /var/log/maillog
- /var/log/exim_mainlog
format: syslog # syslog, exim, postfix, sendmail
tail: true
buffer_size: 1000
# IMAP mailbox monitoring
imap:
enabled: false
servers:
- host: imap.example.com
port: 993
username: monitoring@example.com
password: ImapPassword123!
use_ssl: true
folder: INBOX
poll_interval: 60
# SMTP monitoring
smtp:
enabled: false
servers:
- host: smtp.example.com
port: 587
username: monitoring@example.com
password: SmtpPassword123!
use_tls: true
test_interval: 300
test_recipients:
- test@example.com
# ========================
# Monitoring Rules
# ========================
rules:
# Bounce detection
- name: High Bounce Rate
type: bounce_rate
condition: ">"
threshold: 5 # percentage
window: 3600 # 1 hour
severity: warning
enabled: true
- name: Critical Bounce Rate
type: bounce_rate
condition: ">"
threshold: 10
window: 3600
severity: critical
enabled: true
# Delivery delay detection
- name: High Delivery Delay
type: delivery_delay
condition: ">"
threshold: 300 # seconds
severity: warning
enabled: true
# Queue size monitoring
- name: Large Mail Queue
type: queue_size
condition: ">"
threshold: 1000
severity: warning
enabled: true
- name: Critical Queue Size
type: queue_size
condition: ">"
threshold: 5000
severity: critical
enabled: true
# Connection failures
- name: SMTP Connection Failures
type: connection_failures
condition: ">"
threshold: 10
window: 300 # 5 minutes
severity: warning
enabled: true
# ========================
# Alert Configuration
# ========================
alerts:
# Enable alerts
enabled: true
# Alert check interval (seconds)
check_interval: 60
# Notification methods
notifications:
# Email notifications
email:
enabled: true
smtp_host: smtp.example.com
smtp_port: 587
smtp_user: edmon@example.com
smtp_password: EmailPassword123!
use_tls: true
from_address: edmon@example.com
recipients:
- admin@example.com
- postmaster@example.com
# Slack notifications
slack:
enabled: false
webhook_url: https://hooks.slack.com/services/XXX/YYY/ZZZ
channel: "#email-alerts"
username: EdMon
# Webhook notifications
webhook:
enabled: false
url: https://api.example.com/alerts
method: POST
headers:
Content-Type: application/json
# ========================
# Metrics Collection
# ========================
metrics:
# Collection interval (seconds)
collection_interval: 60
# Metrics to collect
collect:
total_sent: true
total_delivered: true
total_bounced: true
total_deferred: true
bounce_rate: true
delivery_time: true
queue_size: true
connection_count: true
rejection_count: true
# Data retention
retention:
raw_data_days: 7
hourly_data_days: 30
daily_data_days: 365
# ========================
# Authentication
# ========================
auth:
# Enable authentication
enabled: false
# Authentication method (basic, token)
method: basic
# Basic auth credentials
users:
- username: admin
password: AdminPassword123!
role: admin
- username: viewer
password: ViewerPassword123!
role: viewer
# Roles
roles:
admin:
- read:all
- write:all
- delete:all
viewer:
- read:all
# ========================
# Logging
# ========================
logging:
# Log level (debug, info, warn, error)
level: info
# Log format (json, text)
format: text
# Log output
output:
- file
- stdout
# File logging
file:
path: /var/log/edmon/edmon.log
max_size: 50 # MB
max_backups: 5
max_age: 30 # days
compress: true
# ========================
# Performance Settings
# ========================
performance:
# Worker threads
workers: 2
# Log processing batch size
batch_size: 1000
# Cache settings
cache:
enabled: true
type: memory
ttl: 60
# ========================
# Dashboard Settings
# ========================
dashboard:
# Title
title: Email Delivery Monitor
# Refresh interval (seconds)
refresh_interval: 30
# Default time range
default_time_range: 24h # 1h, 6h, 24h, 7d, 30d
# Display settings
display:
show_realtime: true
show_trends: true
show_breakdown: true
show_maps: true
# /etc/edmon/.env
# Server settings
EDMON_HOST=0.0.0.0
EDMON_PORT=8080
# Database
EDMON_DATABASE_TYPE=sqlite
EDMON_DATABASE_PATH=/var/lib/edmon/edmon.db
# Mail log
EDMON_MAIL_LOG_ENABLED=true
EDMON_MAIL_LOG_PATH=/var/log/mail.log
# IMAP settings
EDMON_IMAP_ENABLED=false
EDMON_IMAP_HOST=imap.example.com
EDMON_IMAP_PORT=993
EDMON_IMAP_USERNAME=monitoring@example.com
EDMON_IMAP_PASSWORD=ImapPassword123!
# SMTP settings
EDMON_SMTP_ENABLED=false
EDMON_SMTP_HOST=smtp.example.com
EDMON_SMTP_PORT=587
EDMON_SMTP_USERNAME=monitoring@example.com
EDMON_SMTP_PASSWORD=SmtpPassword123!
# Alert settings
EDMON_ALERTS_ENABLED=true
EDMON_ALERT_EMAIL_ENABLED=true
EDMON_ALERT_EMAIL_RECIPIENTS=admin@example.com,postmaster@example.com
# Authentication
EDMON_AUTH_ENABLED=false
EDMON_AUTH_ADMIN_PASSWORD=AdminPassword123!
# Logging
EDMON_LOG_LEVEL=info
EDMON_LOG_FILE=/var/log/edmon/edmon.log
# /etc/edmon/rules/parsing.yaml
# Postfix log parsing
postfix:
patterns:
sent:
- pattern: "status=sent"
fields: [queue_id, to, relay, delay, delays, dsn, status]
bounced:
- pattern: "status=bounced"
fields: [queue_id, to, reason, dsn]
deferred:
- pattern: "status=deferred"
fields: [queue_id, to, reason, delay]
rejected:
- pattern: "reject:"
fields: [from, to, reason, code]
# Regex patterns
regex:
queue_id: "[A-F0-9]+"
email: "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}"
ip: "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"
# Exim log parsing
exim:
patterns:
sent:
- pattern: "=> .* T=.* S=.*"
fields: [to, transport, size]
bounced:
- pattern: "** .* T=.*"
fields: [to, transport]
deferred:
- pattern: "=> .* defer"
fields: [to, reason]
rejected:
- pattern: "rejected"
fields: [from, reason]
# Sendmail log parsing
sendmail:
patterns:
sent:
- pattern: "stat=Sent"
fields: [to, status]
bounced:
- pattern: "stat=Deferred|stat=Unavailable"
fields: [to, reason]
rejected:
- pattern: "reject="
fields: [from, reason]
# /etc/edmon/rules/custom.yaml
# Custom alert rules
custom_rules:
- name: Specific Domain Bounces
type: custom
condition: |
bounce_count(domain="problematic-domain.com", window=3600) > 10
severity: warning
enabled: true
- name: Large Attachment Rejections
type: custom
condition: |
rejection_count(reason="message too large", window=3600) > 5
severity: warning
enabled: true
- name: Authentication Failures
type: custom
condition: |
auth_failure_count(window=300) > 20
severity: critical
enabled: true
- name: Spam Score High
type: custom
condition: |
avg_spam_score(window=3600) > 8.0
severity: warning
enabled: true
# /etc/edmon/templates/alert-email.yaml
email_template:
subject: "[{{severity}}] EdMon Alert: {{rule_name}}"
body: |
EdMon Email Monitoring Alert
Rule: {{rule_name}}
Severity: {{severity}}
Details:
- Metric: {{metric_name}}
- Current Value: {{metric_value}}
- Threshold: {{threshold}}
- Window: {{window}}
Time Period: {{start_time}} to {{end_time}}
Affected Domains:
{{#each affected_domains}}
- {{this}}
{{/each}}
Please investigate.
--
EdMon Email Delivery Monitor
{{dashboard_url}}
# /etc/edmon/templates/alert-slack.yaml
slack_template:
attachments:
- color: "{{severity_color}}"
title: "EdMon Alert: {{severity}}"
fields:
- title: Rule
value: "{{rule_name}}"
short: true
- title: Metric
value: "{{metric_name}}"
short: true
- title: Current Value
value: "{{metric_value}}"
short: true
- title: Threshold
value: "{{threshold}}"
short: true
- title: Time Period
value: "{{start_time}} - {{end_time}}"
short: false
footer: EdMon Monitoring
ts: "{{timestamp_unix}}"
# Validate configuration syntax
edmon config validate
# Check configuration
edmon config show
# Test mail log parsing
edmon parse test /var/log/mail.log
# Test alert rules
edmon rules test
# Restart EdMon service
sudo systemctl restart edmon
# Check service status
sudo systemctl status edmon
# View logs
sudo journalctl -u edmon -f
sudo tail -f /var/log/edmon/edmon.log
# Reload configuration
sudo systemctl reload edmon
# Initialize database
edmon db init
# Backup database
edmon db backup /var/backups/edmon/
# Restore database
edmon db restore /var/backups/edmon/edmon-backup.db
# Clean old data
edmon db cleanup --older-than 30d
# Check service status
sudo systemctl status edmon
# Check if listening
sudo netstat -tlnp | grep 8080
# Check running processes
ps aux | grep edmon
# Access web interface
curl http://localhost:8080
# Check API health
curl http://localhost:8080/api/health
# Get metrics
curl http://localhost:8080/api/metrics
# Get alerts
curl http://localhost:8080/api/alerts
# Test log parsing
edmon parse test /var/log/mail.log --lines 100
# Check parsed events
edmon events list --limit 50
# View parsing statistics
edmon stats parsing
# List alert rules
edmon rules list
# Test alert notification
edmon alerts test --rule "High Bounce Rate"
# View alert history
edmon alerts history
Squeezing every bit of performance from your Edmon installation? Our experts help with:
Optimize your setup: office@linux-server-admin.com | Contact Us