1
0
mirror of https://github.com/thannaske/rspamd-influxdb.git synced 2023-10-10 13:36:59 +02:00
Go to file
Tobias 6a89e68c67
Merge pull request #4 from genofire/master
fix readme + add security tip
2018-11-09 12:34:16 +01:00
grafana-example.png Adding Grafana example 2018-01-30 00:26:25 +01:00
LICENSE Create LICENSE 2018-01-30 00:29:37 +01:00
README.md fix readme + add security tip 2018-11-09 12:19:08 +01:00
rspamd-influxdb.py Adding --config parameter to provide a path to a configuration file for security reasons (issue #2) 2018-11-09 11:57:45 +01:00

rspamd-influxdb

Quick and dirty approach to get stats of rspamd out of the webinterface's API into InfluxDB for visualizing using Grafana.

Usage

python3 rspamd-influxdb.py --url "https://example.com:1337" --password "superSecretPassword"

You may provide the URL and password by defining the path to a configuration file in order to prevent other users from reading the password in clear text from the process list. To do so you need to provide the --config $path argument, e.g.

python3 rspamd-influxdb.py --config "~/config.json"

The configuration file needs to contain the fields url and password as valid JSON. An example file could look like this:

{
    "url": "https://example.com",
    "password": "superSecretPassword"
}

Utilization

Use this script call within InfluxData's Telegraf

e.g.:

[[inputs.exec]]
	commands = ["python3 /opt/rspamd-influxdb/rspamd-influxdb.py --config /etc/telegraf/tools-conf/rspamd-fetch.json"]
	timeout = "5s"
	data_format = "influx"

Security Tip

chown root:telegraf /etc/telegraf/tools-conf/rspamd-fetch.json
chmod 640 /etc/telegraf/tools-conf/rspamd-fetch.json

Grafana example

Grafana Example