clarify documentation

* align url parameter to the ejabberd example
* update virtualenv command
* remove influxdb service requirement from service template
This commit is contained in:
nico 2020-06-10 21:35:57 +02:00
parent 4f53572c7e
commit ede665016b
Signed by: mightyBroccoli
GPG Key ID: EA7C31AAB1BDC1A2
3 changed files with 43 additions and 39 deletions

View File

@ -19,46 +19,19 @@ apt install python-virtualenv
# Arch
pacman -S python-virtualenv
# mkdir venv
virtualenv -p python3 venv/ -r requirements.txt
# create a venv folder inside the cloned repository
mkdir venv
virtualenv -p python3 venv/
source ./venv/bin/activate
pip install -r requirements.txt
```
#### ejabberd
It is required to control a user account eligible to operate the tools with. We strongly recommend to use a dedicated
user to operate the api and to secure this account with a specifically strong password.
To operate the api it is required to provide a user account eligible to issue api commands. We strongly recommend to use
a dedicated user to operate the api and to secure this account with a specifically strong password.
### configuration
#### systemd service
To properly operate the metrics exporter tools, we created some systemd templates, to simplify the whole process.
If the `ejabberd-metrics.yml` file is not accessible for the user`nobody:nogroup`, it is required to update the `User`
and `Group` definitions inside the service file.
If a virtualenv is used, it is required to update the `Environment=PATH` to include the `venv/bin` directory created
earlier.
```systemd
[Unit]
Description=ejabberd influxdb exporter
[Service]
Type=simple
# this strongly depends on the ejabberd-metrics.yml permissions
User=nobody
Group=nogroup
ExecStart=/opt/ejabberd-metrics/influx.py
Restart=always
RestartSec=5s
# if the virtualenv is used PATH needs to customized
Environment=PATH=/opt/ejabberd-metrics/venv/bin:/usr/bin:/usr/local/bin
[Install]
WantedBy=multi-user.target
```
Another possible solution would be to edit the `ExecStart` paramter to include the virtualenv Python intepreter.
#### ejabberd: api permissions
These configurations options first add the `mod_http_api` listener. Additionally the user `api_user@magicbroccoli.de` is
added to the `acl` group, thus enabling him to access the `mod_http_api` configured in the `api_permissions` block.
@ -102,7 +75,39 @@ api_permissions:
The `ejabberd-metrics.yml` file is the central configuration file which is used by all current and future tools inside
this repository.
We provide a `ejabberd-metrics.yml.default` file which lists and explains which parameters should be set.
We provide an `ejabberd-metrics.yml.default` file, listing all possible and potentially necessary parameters. The final
configuration file should be located at `/etc/ejabberd-metrics.yml`.
#### systemd service
To properly operate the metrics exporter tools, we created some systemd service templates, to simplify the whole
process. If the `ejabberd-metrics.yml` file is not accessible for the user`nobody:nogroup`, it is required to update the
`User` and `Group` definitions inside the service file.
If a virtualenv is used, it is required to update the `Environment=PATH` to include the `venv/bin` directory created
earlier.
```systemd
[Unit]
Description=ejabberd influxdb exporter
[Service]
Type=simple
# this strongly depends on the ejabberd-metrics.yml permissions
User=nobody
Group=nogroup
ExecStart=/opt/ejabberd-metrics/influx.py
Restart=always
RestartSec=5s
# if the virtualenv is used PATH needs to customized
Environment=PATH=/opt/ejabberd-metrics/venv/bin:/usr/bin:/usr/local/bin
[Install]
WantedBy=multi-user.target
```
Another possible solution would be to edit the `ExecStart` parameter to include the virtualenv Python intepreter.
### error codes
Lookup table for all custom error codes.

View File

@ -1,8 +1,7 @@
[Unit]
Description=ejabberd influxdb exporter
Documentation=https://dev.sum7.eu/sum7/ejabberd-tools/-/blob/master/README.md
After=influxdb.service
Requires=ejabberd.service influxdb.service
Requires=ejabberd.service
[Service]
Type=simple

View File

@ -1,6 +1,6 @@
---
# endpoint url
url: "http://[::1]:5280/api"
url: "http://127.0.0.1:5280/api"
# user credentials to the endpoint url
login: