/v1/stats endpoints allow for exporting internal metrics in the Prometheus text format. Information about how to access the raw data can be found in the Stats and Metrics documentation.
In addition to being able to access the raw data through the API, starting with release
v2.21.3 a dashboard can be set up using Docker Compose and the provided YAML file (
host-exporter-compose.yml) to help simplify the task of monitoring an instance of the WhatsApp Business API.
This document covers:
As per security best practices, please make sure to avoid exposing Prometheus and Grafana service ports to public networks (e.g., the Internet) and to expose them only to trusted networks.
monitoring-compose.yml file is used to start up the following three containers on the monitoring host. These containers should be hosted separately from the machine(s) that are hosting the running Webapp and Coreapp containers. Hosting them separately mitigates any potential performance impact resulting from processing the metric data.
WA_WEB_PASSWORDenvironmental variables to pull Webapp and Coreapp metrics from the WebApp instance through the
WA_CORE_ENDPOINTenvironmental variable to pull machine and container metrics from the node-exporter and cadvisor containers on the CoreApp host(s). For High Availability/Multiconnect setups, Prometheus will periodically query the
/v1/healthendpoint to automatically discover Master and Coreapp hosts to pull metrics from. Please ensure the node-exporter and cadvisor ports on the CoreApp host(s) match the values of the
WA_CADVISOR_PORTenvironmental variables in the
WA_DB_HOSTNAMEenvironmental variable to pull machine metrics from the node-exporter instance on the database host. Please ensure the node-exporter port on the database host matches the
WA_DB_NODE_EXPORTER_ENDPOINTenvironmental variable in the
GF_SECURITY_ADMIN_PASSWORDenvironmental variable to set up a password for the admin account in Grafana.
/metricsendpoint for Prometheus
WA_DB_PORTenvironmental variables to connect to the MySQL instance.
host-exporter-compose.yml file is used to start up two exporter containers on the CoreApp host and the database host:
/metricsendpoint to Prometheus
/metricsendpoint to Prometheus
Before the monitoring containers can be set up, the following steps need to happen:
monitoring-compose.yml, create a file called
WA_WEB_ENDPOINTpoints to a running Webapp container and must be reachable from the machine that will host the monitoring containers.
WA_DB_HOSTNAMEpoints to the MySQL server hosting the backing datastore for the WhatsApp Business API Client and must be reachable from the machine that will host the monitoring containers.
docker-compose -f monitoring-compose.yml up -d
scp host-exporter-compose.yml your-coreapp-hostname docker-compose -f host-exporter-compose.yml up -d
scp host-exporter-compose.yml your-database-hostname docker-compose -f host-exporter-compose.yml up -d node-exporter
http://your-monitoring-hostname:9090/targetsfrom a browser should load a webpage displaying the endpoints that are up and running. In the following example you can see
http://your-monitoring-hostname:3000/d/whatsapp/biz-clientswill load the Grafana dashboard for the system.
The username is
admin and the password is
It's highly recommended you run the same version of monitoring containers for the WhatsApp Business API Webapp and Coreapp containers.
monitoring-compose.yml file has fields indicating container versions, for example:
services: ... prometheus: image: docker.whatsapp.biz/prometheus:v2.21.4 ... grafana: image: docker.whatsapp.biz/grafana:v2.21.4
To upgrade an installation, change the version numbers in the
services: ... prometheus: image: docker.whatsapp.biz/prometheus:v2.21.6 ... grafana: image: docker.whatsapp.biz/grafana:v2.21.6
Then, uninstall and restart the Docker containers:
docker-compose -f monitoring-compose.yml down docker-compose -f monitoring-compose.yml up -d
To obtain logs for troubleshooting, run the following command:
docker-compose -f monitoring-compose.yml logs > debug_monitoring_output.txt # On Coreapp host or database host docker-compose -f host-exporter-compose.yml logs > debug_host_exporter_output.txt
You can then send those files to WhatsApp for analysis and debugging.
When you no longer wish to gather metrics, you can stop monitoring and remove the containers with the following code:
docker-compose -f monitoring-compose.yml down # On Coreapp host or database host docker-compose -f host-exporter-compose.yml down
Uninstall containers and remove volumes with the following code:
docker-compose -f monitoring-compose.yml down -v # On Coreapp host or database host docker-compose -f host-exporter-compose.yml down -v