Adding prometheus to rspamd
Out of the box, rspamd cannot export in prometheus format.
To achieve this goal, we will use graphite-exporter
.
Side graphite-exporter
:
mappings:
- match: rspamd.actions.*
name: rspamd_actions
labels:
action: $1
The rspamd
side of the metric_exporter.conf
file:
backend = "graphite";
host = "graphite-exporter";
port = 9109;
timeout = 10;
interval = 60;
metrics = [
"actions.add header",
"actions.greylist",
"actions.no action",
"actions.reject",
"actions.rewrite subject",
"actions.soft reject",
"bytes_allocated",
"chunks_allocated",
"chunks_freed",
"chunks_oversized",
"connections",
"control_connections",
"ham_count",
"learned",
"pools_allocated",
"pools_freed",
"scanned",
"shared_chunks_allocated",
"spam_count"
];
Prometheus side:
- job_name: 'graphite-exporter'
scrape_interval: 30s
static_configs:
- targets: ["graphite-exporter:9108"]
Then you can display the collected data in visualization tools.