Skip to content

Commit 35abd4a

Browse files
Update README.md with configs/commands to be able to run the example on macOS (prometheus-community#180)
* Update README.md Updating a few configs/commands to be able to run the example on macOS Signed-off-by: Vickie <vicky.liu.61@gmail.com> * Minimize documentation changes Signed-off-by: rustyclock <rustyclock@protonmail.com> Signed-off-by: Vickie <vicky.liu.61@gmail.com> Signed-off-by: rustyclock <rustyclock@protonmail.com> Co-authored-by: rustyclock <rustyclock@protonmail.com>
1 parent 1c1ae57 commit 35abd4a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ modules:
6464
headers:
6565
X-Dummy: my-test-header
6666

67-
$ python -m SimpleHTTPServer 8000 &
68-
Serving HTTP on 0.0.0.0 port 8000 ...
67+
$ python3 -m http.server 8000 &
68+
Serving HTTP on :: port 8000 (http://[::]:8000/) ...
6969

7070
$ ./json_exporter --config.file examples/config.yml &
7171

@@ -79,7 +79,7 @@ example_value_count{environment="beta",id="id-A"} 1
7979
example_value_count{environment="beta",id="id-C"} 3
8080

8181
# To test through prometheus:
82-
$ docker run --rm -it -p 9090:9090 -v $PWD/examples/prometheus.yml:/etc/prometheus/prometheus.yml --network host prom/prometheus
82+
$ docker run --rm -it -p 9090:9090 -v $PWD/examples/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
8383
```
8484
Then head over to http://localhost:9090/graph?g0.range_input=1h&g0.expr=example_value_active&g0.tab=1 or http://localhost:9090/targets to check the scraped metrics or the targets.
8585

examples/prometheus.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ scrape_configs:
44
- job_name: prometheus
55
static_configs:
66
- targets:
7-
- localhost:9090
7+
- host.docker.internal:9090 # equivalent to "localhost:9090"
88

99
## gather the metrics of json_exporter application itself
1010
- job_name: json_exporter
1111
static_configs:
1212
- targets:
13-
- localhost:7979 ## Location of the json exporter's real <hostname>:<port>
13+
## Location of the json exporter's real <hostname>:<port>
14+
- host.docker.internal:7979 # equivalent to "localhost:7979"
1415

1516
## gather the metrics from third party json sources, via the json exporter
1617
- job_name: json
@@ -28,5 +29,6 @@ scrape_configs:
2829
- source_labels: [__param_target]
2930
target_label: instance
3031
- target_label: __address__
31-
replacement: localhost:7979 ## Location of the json exporter's real <hostname>:<port>
32+
## Location of the json exporter's real <hostname>:<port>
33+
replacement: host.docker.internal:7979 # equivalent to "localhost:7979"
3234

0 commit comments

Comments
 (0)