Skip to content

Commit fddc9f9

Browse files
committed
feat(exporter): add metrics & upgrade docker+golang
1 parent 817d84a commit fddc9f9

File tree

10 files changed

+271
-1457
lines changed

10 files changed

+271
-1457
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2.0.0 / 2020-08-10
2+
=================
3+
* Upgrade Golang
4+
* Upgrade dependencies
5+
* Change default port (cf. https://github.com/prometheus/prometheus/wiki/Default-port-allocations)
6+
* Use Alpine linux instead of Debian (864MB vs 427MB)
7+
* Add new metrics
8+
* Rename metrics

Dockerfile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
1-
FROM golang:1.12.7-buster
1+
FROM golang:1.14.7-alpine3.12
2+
3+
# Install bash
4+
RUN apk add --no-cache bash
25

36
# Set the Current Working Directory inside the container
4-
WORKDIR $GOPATH/src/wordpress_exporter
7+
WORKDIR /go/src/app
58

6-
# Copy sources.
9+
# Copy sources
710
COPY . .
811

9-
# Download all the dependencies.
12+
# Download all the dependencies
1013
RUN go get -d -v ./...
1114

1215
# Install the package
1316
RUN go install -v ./...
1417

18+
# Default env
1519
ENV WORDPRESS_DB_HOST="" \
1620
WORDPRESS_DB_PORT="3306" \
1721
WORDPRESS_DB_USER="" \
1822
WORDPRESS_DB_PASSWORD="" \
1923
WORDPRESS_DB_NAME="" \
2024
WORDPRESS_TABLE_PREFIX="wp_"
2125

22-
EXPOSE 9117
26+
EXPOSE 9850
2327

2428
ADD /docker-entrypoint.sh /docker-entrypoint.sh
2529

Gopkg.lock

Lines changed: 0 additions & 124 deletions
This file was deleted.

Gopkg.toml

Lines changed: 0 additions & 11 deletions
This file was deleted.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 Alexandre L.
3+
Copyright (c) 2020 Alexandre L.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Inspired by [kotsis/wordpress_exporter](https://github.com/kotsis/wordpress_expo
55

66
# Usage of wordpress_exporter
77
```sh
8-
docker run --name wordpress_exporter -p 9117:9117 -e WORDPRESS_DB_HOST="127.0.0.1" -e WORDPRESS_DB_PORT="3306" -e WORDPRESS_DB_USER="wordpress" -e WORDPRESS_DB_NAME="wordpress" -e WORDPRESS_DB_PASSWORD="wordpress" -e WORDPRESS_TABLE_PREFIX="wp_" -d alexandreio/wordpress_exporter:latest
8+
docker run --name wordpress_exporter -p 9850:9850 -e WORDPRESS_DB_HOST="127.0.0.1" -e WORDPRESS_DB_PORT="3306" -e WORDPRESS_DB_USER="wordpress" -e WORDPRESS_DB_NAME="wordpress" -e WORDPRESS_DB_PASSWORD="wordpress" -e WORDPRESS_TABLE_PREFIX="wp_" -d alexandreio/wordpress_exporter:latest
99
```
1010
# Prometheus configuration for wordpress_exporter
1111
For Prometheus to start scraping the metrics you have to edit /etc/prometheus/prometheus.yml and add:
@@ -15,8 +15,5 @@ For Prometheus to start scraping the metrics you have to edit /etc/prometheus/pr
1515
# metrics_path defaults to '/metrics'
1616
# scheme defaults to 'http'.
1717
static_configs:
18-
- targets: ['localhost:9117']
18+
- targets: ['localhost:9850']
1919
```
20-
21-
# Grafana
22-
You can find an example of WordPress dashboard in examples/grafana/dashboard.json

0 commit comments

Comments
 (0)