rspamd-influxdb/README.md

40 lines
1.2 KiB
Markdown
Raw Normal View History

2018-01-29 22:29:12 +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:
```json
{
"url": "https://example.com",
"password": "superSecretPassword"
}
```
2018-01-29 22:29:12 +01:00
## Utilization
Use this script call within InfluxData's Telegraf
2018-01-30 00:28:00 +01:00
2018-11-08 15:57:54 +01:00
e.g.:
2018-11-09 12:18:06 +01:00
```toml
2018-11-08 15:57:54 +01:00
[[inputs.exec]]
2018-11-09 12:18:06 +01:00
commands = ["python3 /opt/rspamd-influxdb/rspamd-influxdb.py --config /etc/telegraf/tools-conf/rspamd-fetch.json"]
2018-11-08 15:57:54 +01:00
timeout = "5s"
data_format = "influx"
```
2018-11-09 12:18:06 +01:00
**Security Tip**
```sh
chown root:telegraf /etc/telegraf/tools-conf/rspamd-fetch.json
chmod 640 /etc/telegraf/tools-conf/rspamd-fetch.json
```
2018-01-30 00:28:00 +01:00
## Grafana example
2018-11-09 12:56:37 +01:00
![Grafana Example](grafana-example.png)