Skip to content
Prometheus exporter for WordPress
Go Dockerfile Shell
Branch: master
Clone or download
Pull request Compare This branch is 3 commits ahead of kotsis:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Prometheus exporter for WordPress

Install wordpress_exporter

$ go get

Usage of wordpress_exporter

$ wordpress_exporter -wpconfig=/path/to/wp-config


$ wordpress_exporter -host= -port=3306 -user=uuuu -db=dddd -tableprefix=wp_ -pass=xxxx

It starts serving metrics at http://localhost:8888/metrics

Prometheus configuration for wordpress_exporter

For Prometheus to start scraping the metrics you have to edit /etc/prometheus/prometheus.yml and add:

  - job_name: 'wordpress'
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
    - targets: ['localhost:8888']

the above is valid if the exporter runs at the same host as prometheus service. If prometheus runs in a docker container perhaps you will need to change localhost with the IP of the host system, something like

WordPress service with docker-compose

Here is provided a quick WordPress service setup with docker-compose for testing the wordpress_exporter. You can go in $GOPATH/src/ and run:

$ sudo docker-compose up -d

Now a wordpress is being served at : http://localhost:8000 where you must visit and create a user with a password. Then you can login in WordPress and create posts, users etc.

Next you must start the wordpress_exporter

$ wordpress_exporter -port=33306 -db=wordpress -user=wordpress -pass=wordpress1234

You will see the metrics from those actions.


You can find a WordPress dashboard in $GOPATH/src/

For it to work you must define in Grafana a new Prometheus data source as prom1 This must be the Prometheus instance that is scrapin metrics from wordpress_exporter. Then you can import the above json file and start viewing the metrics.

You can’t perform that action at this time.