Closed sunbladehub closed 2 years ago
If you are already using docker-compose, I guess this is the easiest way. I tried it with ejabberd latest and works correctly. Please note, in my example, the container is named ecs_main_1:
mkdir -p modules/sources/mod_prometheus/ebin
git clone https://github.com/skythet/ejabberd-prometheus-exporter.git modules/sources/mod_prometheus/src
echo "summary: \"Ejabberd metrics for Prometheus\"" > modules/sources/mod_prometheus/mod_prometheus.spec
sudo chown -R 9000:9000 modules
volumes:
- ./modules:/home/ejabberd/.ejabberd-modules
Start the ejabberd docker container
Check the module source code is available:
sudo docker exec -it ecs_main_1 bin/ejabberdctl modules_available
mod_prometheus Ejabberd metrics for Prometheus
Then compile and install it:
sudo docker exec -it ecs_main_1 bin/ejabberdctl module_install mod_prometheus
Module mod_prometheus has been installed.
Now you can configure it in your ejabberd.yml
As it says, configure it in ejabberd.yml. In my case I added it to request_handlers in port 5280:
-
port: 5280
ip: "::"
module: ejabberd_http
request_handlers:
/admin: ejabberd_web_admin
/metrics: mod_prometheus
Restart ejabberd. It doesn't show any specific log message.
Visit the URL http://localhost:5280/metrics
It shows raw text:
ejabberd_memory_total_bytes{node="ejabberd@main"} 37200928
ejabberd_memory_processes_bytes{node="ejabberd@main"} 4976968
ejabberd_memory_processes_used_bytes{node="ejabberd@main"} 4976816
...
This is working 100%. Thank you for the fast answer.
I'm using version 24.2.0
and I have to mount the volume at /opt/ejabberd/.ejabberd-modules/
Right @dodziraynard , you both are right. As mentioned in Alternative Image in GitHub:
ecs
container image stores the information in /home/ejabberd/
ejabberd
container image stores the information in /opt/ejabberd/
. That image is based in the ejabberd binary installers.
I want to load this custom module into an ejabberd docker container running in docker compose.
https://github.com/skythet/ejabberd-prometheus-exporter
What is the recommended way to do that?