Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Conversation

sergiosanche
Copy link

It can obtain multiple values from one request. Sometimes in the json there are more than one value to get so this change let us to it.

The target now looks this way:
http://localhost:9116/probe?target=http://validate.jsontest.com/?json=%7B%22key%22:%22value%22%7D&jsonpath.nanoseconds=$.parse_time_nanoseconds&jsonpath.size=$.size

We must provide:

  • target, as usual.
  • jsonpath.[prometheus_metric_name]=[json_path]

The last param can be more than one time and will create as many metrics as we define.

E.g:

nagraops@debian-nagraops:~/repo/monitoring/json-exporter$ curl "http://localhost:9116/probe?target=http://validate.jsontest.com/?json=%7B%22key%22:%22value%22%7D&jsonpath.parse_time_nanoseconds=$.parse_time_nanoseconds&jsonpath.size=$.size"
# HELP parse_time_nanoseconds Retrieved value
# TYPE parse_time_nanoseconds gauge
parse_time_nanoseconds 41996
# HELP probe_duration_seconds Returns how long the probe took to complete in seconds
# TYPE probe_duration_seconds gauge
probe_duration_seconds 0
# HELP probe_success Displays whether or not the probe was a success
# TYPE probe_success gauge
probe_success 1
# HELP size Retrieved value
# TYPE size gauge
size 1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant