Skip to main content
Solved

JSON extraction

  • January 31, 2025
  • 3 replies
  • 196 views

pierre1
Forum|alt.badge.img+9

Hello,

 

the result of a curl command is the following (data have been modified).

curl -X GET -H "Accept: application/json" -H "Authorization: Bearer 1234" "https://toto.com"

[{"id":"abcd","name":"theName"}]

 

The plugin is executed.

/usr/lib/centreon/plugins//centreon_protocol_http.pl --plugin=apps::protocols::http::plugin --mode=json-content --hostname=toto.com --urlpath='/' --header='Authorization: Bearer 1234' --data='' --lookup='' --threshold-value='' --format-ok='' --format-warning='' --format-critical=''  --warning-numeric='' --critical-numeric='' --warning-string='' --critical-string='' --port='443' --proto='https' --filter-perfdata=''

OK:

My concern is how to use --lookup and --format-ok options to display ‘theName’.

Does some experience this kind of challenge ?

Best answer by dagabard

I have some points with a json response, i parse it with jq.

Tutorial

 

 

 

3 replies

rchauvel
Centreonian
Forum|alt.badge.img+18
  • Centreonian
  • February 5, 2025

Have you looked into this?

 


pierre1
Forum|alt.badge.img+9
  • Author
  • February 5, 2025

Not for the moment, I’ll check if it can answer ; thanks for the proposal


dagabard
Forum|alt.badge.img+5
  • Steward *
  • Answer
  • February 6, 2025

I have some points with a json response, i parse it with jq.

Tutorial