From ede665016b28db7848c2c9b5f2c0780a915470fc Mon Sep 17 00:00:00 2001 From: nico Date: Wed, 10 Jun 2020 21:35:57 +0200 Subject: [PATCH] clarify documentation * align url parameter to the ejabberd example * update virtualenv command * remove influxdb service requirement from service template --- README.md | 77 ++++++++++--------- .../linux-systemd/ejabberd-influxdb.service | 3 +- ejabberd-metrics.yml.default | 2 +- 3 files changed, 43 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 43ffb81..7cbd2cf 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/contrib/init/linux-systemd/ejabberd-influxdb.service b/contrib/init/linux-systemd/ejabberd-influxdb.service index 6b711b6..68490cb 100644 --- a/contrib/init/linux-systemd/ejabberd-influxdb.service +++ b/contrib/init/linux-systemd/ejabberd-influxdb.service @@ -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 diff --git a/ejabberd-metrics.yml.default b/ejabberd-metrics.yml.default index 3fa9f33..fc5dbf3 100644 --- a/ejabberd-metrics.yml.default +++ b/ejabberd-metrics.yml.default @@ -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: