Skip to content

Commit 05ec91e

Browse files
Nigel Deakinskinowski
Nigel Deakin
authored andcommitted
Update README.md (#766)
This PR changes the instructions for running Prometheus and Grafana in Docker to use the `--add-host` parameter instead of the `--link` parameter which is deprecated and which has been reported by @shaunsmith to sometimes not work. The supplied command has been verified by @shaunsmith on Mac and Linux and by me on Linux.
1 parent f287ad2 commit 05ec91e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

examples/grafana/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ Note the last line. This specifies the host and port of the Fn server from which
5959
If you are running a cluster of Fn servers then you can specify them all here.
6060
6161
Now start Prometheus, specifying this config file.
62-
63-
In the following command, `${GOPATH}/src/github.com/fnproject/fn/examples/grafana/prometheus.yml` is the path of the above Prometheus configuration file. You may need to modify this to use the actual path on your local machine.
6462
```
65-
docker run --name=prometheus -d -p 9090:9090 \
66-
-v ${GOPATH}/src/github.com/fnproject/fn/examples/grafana/prometheus.yml:/etc/prometheus/prometheus.yml \
67-
--link fnserver prom/prometheus
63+
docker run --rm --name=prometheus -d -p 9090:9090 \
64+
-v `pwd`/prometheus.yml:/etc/prometheus/prometheus.yml \
65+
--add-host="fnserver:`docker network inspect bridge -f '{{range .IPAM.Config}}{{.Gateway}}{{end}}'`" \
66+
prom/prometheus
6867
```
69-
Note: The parameter `--link fnserver` means that Prometheus can use `fnserver` to refer to the running Fn server. This requires the Fn server to be running in docker.
68+
Note: This command uses the parameter `--add-host` to define a hostname `fnserver` in the docker container
69+
and configure it to use the IP address on which the Fn server is listening.
7070

7171
Open a browser on Prometheus's graph tool at [http://localhost:9090/graph](http://localhost:9090/graph). If you wish you can use this to view metrics and display metrics from the Fn server: see the [Prometheus](https://prometheus.io/) documentation for instructions. Alternatively continue with the next step to view a ready-made set of graphs in Grafana.
7272

@@ -79,7 +79,8 @@ Open a terminal window and navigate to the directory containing this example.
7979
Start Grafana on port 3000:
8080
```
8181
docker run --name=grafana -d -p 3000:3000 \
82-
--link prometheus grafana/grafana
82+
--add-host="prometheus:`docker network inspect bridge -f '{{range .IPAM.Config}}{{.Gateway}}{{end}}'`" \
83+
grafana/grafana
8384
```
8485

8586
Open a browser on Grafana at [http://localhost:3000](http://localhost:3000).

0 commit comments

Comments
 (0)