You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A [prometheus](https://prometheus.io/) exporter which scrapes remote JSON by JSONPath.
6
+
For checking the JSONPath configuration supported by this exporter please head over [here](https://kubernetes.io/docs/reference/kubectl/jsonpath/).
7
+
Checkout the [examples](/examples) directory for sample exporter configuration, prometheus configuration and expected data format.
6
8
7
-
#Build
9
+
#### :warning: The configuration syntax has changed in version `0.3.x`. If you are migrating from `0.2.x`, then please use the above mentioned JSONPath guide for correct configuration syntax.
8
10
9
-
```sh
10
-
make build
11
-
```
11
+
## Example Usage
12
12
13
-
# Example Usage
14
-
15
-
```sh
16
-
$ cat example/data.json
13
+
```console
14
+
$ cat examples/data.json
17
15
{
18
16
"counter": 1234,
19
17
"values": [
@@ -43,23 +41,23 @@ $ cat examples/config.yml
43
41
---
44
42
metrics:
45
43
- name: example_global_value
46
-
path: $.counter
44
+
path: "{ .counter }"
47
45
help: Example of a top-level global value scrape in the json
48
46
labels:
49
47
environment: beta # static label
50
-
location: $.location # dynamic label
48
+
location: "planet-{.location}" # dynamic label
51
49
52
50
- name: example_value
53
51
type: object
54
52
help: Example of sub-level value scrapes from a json
55
-
path: $.values[*]?(@.state == "ACTIVE")
53
+
path: '{.values[?(@.state == "ACTIVE")]}'
56
54
labels:
57
55
environment: beta # static label
58
-
id: $.id # dynamic label
56
+
id: '{.id}' # dynamic label
59
57
values:
60
58
active: 1 # static value
61
-
count: $.count # dynamic value
62
-
boolean: $.some_boolean
59
+
count: '{.count}' # dynamic value
60
+
boolean: '{.some_boolean}'
63
61
64
62
headers:
65
63
X-Dummy: my-test-header
@@ -70,7 +68,7 @@ Serving HTTP on 0.0.0.0 port 8000 ...
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.
85
83
86
-
# Exposing metrics through HTTPS
84
+
##Exposing metrics through HTTPS
87
85
88
-
web-config.yml
89
-
```
90
-
# Minimal TLS configuration example. Additionally, a certificate and a key file
TLS configuration supported by this exporter can be found at [exporter-toolkit/web](https://github.com/prometheus/exporter-toolkit/blob/v0.5.1/docs/web-configuration.md)
For futher information about TLS configuration, please visit: [exporter-toolkit/https](https://github.com/prometheus/exporter-toolkit/blob/v0.1.0/https/README.md)
110
93
111
-
# Docker
94
+
##Docker
112
95
113
96
```console
114
97
docker run \
115
-
-v $PWD/examples/config.yml:/config.yml
98
+
-v $PWD/examples/config.yml:/config.yml \
116
99
quay.io/prometheuscommunity/json-exporter \
117
-
--config.file/config.yml
100
+
--config.file=/config.yml
118
101
```
119
102
120
-
# See Also
121
-
-[kawamuray/jsonpath](https://github.com/kawamuray/jsonpath#path-syntax) : For syntax reference of JSONPath.
122
-
Originally forked from nicksardo/jsonpath(now is https://github.com/NodePrime/jsonpath).
0 commit comments