forked from prometheus-community/json_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
100 lines (89 loc) · 3.46 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
modules:
default:
headers:
X-Dummy: my-test-header
metrics:
- name: example_global_value
path: '{ .counter }'
help: Example of a top-level global value scrape in the json
labels:
environment: beta # static label
location: 'planet-{.location}' # dynamic label
- name: example_timestamped_value
type: object
path: '{ .values[?(@.state == "INACTIVE")] }'
epochTimestamp: '{ .timestamp }'
help: Example of a timestamped value scrape in the json
labels:
environment: beta # static label
values:
count: '{.count}' # dynamic value
- name: example_value
type: object
help: Example of sub-level value scrapes from a json
path: '{.values[?(@.state == "ACTIVE")]}'
labels:
environment: beta # static label
id: '{.id}' # dynamic label
values:
active: 1 # static value
count: '{.count}' # dynamic value
boolean: '{.some_boolean}'
animals:
metrics:
- name: animal
type: object
help: Example of top-level lists in a separate module
path: '{ [*] }'
labels:
name: '{ .noun }'
predator: '{ .predator }'
values:
population: '{ .population }'
transform:
metrics:
- name: origin
transformations:
- type: jq
query: |-
.result[] | .name as $poolName | .id as $poolId | .origins[] | ( .name as $name | .healthy as $endpointHealth | {endpointName: $name, endpointHealthy: .healthy, poolName: $poolName, address:.address, poolId:$poolId, address:.address} )
help: Health of each origin in the pool
path: '{ [*] }'
type: object
labels:
pool_id: '{.poolId}'
pool_name: '{.poolName}'
address: '{.address}'
endpoint_name: '{.endpointName}'
values:
health: '{.endpointHealthy}' # Extract only the `healthy` field
- name: pool
type: object
help: Health of the pools
path: '{.result[*]}'
labels:
pool_name: '{.name}'
pool_id: '{.id}'
values:
health: '{.healthy}'
## HTTP connection configurations can be set in 'modules.<module_name>.http_client_config' field. For full http client config parameters, ref: https://pkg.go.dev/github.com/prometheus/common/config?tab=doc#HTTPClientConfig
#
# http_client_config:
# tls_config:
# insecure_skip_verify: true
# basic_auth:
# username: myuser
# #password: veryverysecret
# password_file: /tmp/mysecret.txt
## List of accepted status codes for this probe can be set in 'modules.<module_name>.valid_status_codes' field. Defaults to 2xx.
# valid_status_codes: [ <int>, ... | default = 2xx ]
## If 'modueles.<module_name>.body' field is set, it will be sent by the exporter as the body content in the scrape request. The HTTP method will also be set as 'POST' in this case.
# body:
# content: |
# {"time_diff": "1m25s", "anotherVar": "some value"}
## The body content can also be a Go Template (https://golang.org/pkg/text/template), with all the functions from the Sprig library (https://masterminds.github.io/sprig/) available. All the query parameters sent by prometheus in the scrape query to the exporter, are available in the template.
# body:
# content: |
# {"time_diff": "{{ duration `95` }}","anotherVar": "{{ .myVal | first }}"}
# templatize: true