Geen omschrijving

Jannick Knudsen 67416d5b51 Bumped version to 0.0.2 4 jaren geleden
.dbuild 2022313d74 Bumped version to 0.0.1 4 jaren geleden
.gitignore f53bee042a aiai 4 jaren geleden
Dockerfile f53bee042a aiai 4 jaren geleden
Gopkg.lock f53bee042a aiai 4 jaren geleden
Gopkg.toml f53bee042a aiai 4 jaren geleden
LICENSE f53bee042a aiai 4 jaren geleden
README.md f53bee042a aiai 4 jaren geleden
VERSION 67416d5b51 Bumped version to 0.0.2 4 jaren geleden
VERSIONLOG 67416d5b51 Bumped version to 0.0.2 4 jaren geleden
docker-compose.yml f53bee042a aiai 4 jaren geleden
docker-entrypoint.sh f53bee042a aiai 4 jaren geleden
package.json 67416d5b51 Bumped version to 0.0.2 4 jaren geleden
wordpress_exporter.go f53bee042a aiai 4 jaren geleden
wordpress_grafana.json f53bee042a aiai 4 jaren geleden

README.md

wordpress_exporter

Prometheus exporter for WordPress

Install wordpress_exporter

$ go get github.com/kotsis/wordpress_exporter

Usage of wordpress_exporter

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

or

$ wordpress_exporter -host=127.0.0.1 -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'.
    static_configs:
    - 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 172.17.0.1

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/github.com/kotsis/wordress_exporter 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.

Grafana

You can find a WordPress dashboard in $GOPATH/src/github.com/kotsis/wordress_exporter/wordpress_grafana.json

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.