A bunch of tools for maintenance a ejabberd server, written in python3 with rest and xmlrpc support: metrics service to fetch statistics from ejabberd to generate metrics for prometheus and influxdb
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nico b113b9ce60
pre-commit framework
1 week ago
contrib/init/linux-systemd clarify documentation 3 months ago
.gitignore yaml config 6 months ago
.gitlab-ci.yml tool configuration 3 months ago
.pre-commit-config.yaml pre-commit framework 1 week ago
README.md pre-commit framework 1 week ago
api.py flake8 fixup 3 months ago
calls.py black reformat 3 months ago
cleanup.py exception handling 2 months ago
config.py black reformat 3 months ago
ejabberd-metrics.yml.default clarify documentation 3 months ago
influx.py flake8 fixup 3 months ago
metrics.py black reformat 3 months ago
prometheus.py exception handling 2 months ago
pyproject.toml tool configuration 3 months ago
requirements.txt pre-commit framework 1 week ago
setup.cfg black flake8 compatability 3 months ago



Repository containing various ejabberd tools.



The metrics class is a tool to gather and aggregate metrics data through the ejabberd rest/ xmlrpc interface. In addition to that a Prometheus and InfluxDB client utilizing the metrics class is provided.


The easiest way to setup a clean Python project environment is to use a virtual environment inside the cloned repository directory. The following bash lines install the python-virtualenv module, create the virtual environment using Python3 and finally install all dependencies listed in the requirements file.

# Debian
apt install python-virtualenv

# Arch
pacman -S python-virtualenv

# create a venv folder inside the cloned repository
mkdir venv
virtualenv -p python3 venv/

source ./venv/bin/activate
pip install -r requirements.txt


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.


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.

    port: 5280
    ip: ""
    tls: true # optional
    module: ejabberd_http
      /api: mod_http_api

      - "api_user@magicbroccoli.de"
      - ::1/128
      - ::FFFF:

  "api access":
      - mod_http_api
          acl: api
          acl: loopback # optional but recommended to restrict the api access to the local network
      - "*"
      - "!stop"
      - "!start"


The ejabberd-metrics.yml file is the central configuration file which is used by all current and future tools inside this repository.

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 usernobody: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.

Description=ejabberd influxdb exporter


# this strongly depends on the ejabberd-metrics.yml permissions


# if the virtualenv is used PATH needs to customized


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. The potential reasons are sorted by probability of being the root cause.

code potential reason
17 login credential mismatch, potential api permission problem

pre-commit framework

This project utilizes the pre-commit framework to automate various small hick-ups that tend to happen prior to committing.

To use the framework it is necessary to follow these steps:

# install the pre-commit hook
pre-commit install

# to test your staged files manually run
pre-commit run