Skip to main content
Question

Plugin http : passer de expected-content en json+collection

  • January 23, 2026
  • 6 replies
  • 36 views

Forum|alt.badge.img+6

Bonjour,

Nous avons actuellement une sonde du genre

 /usr/lib/centreon/plugins/centreon_protocol_http.pl --plugin=apps::protocols::http::plugin --mode=expected-content --hostname=hostname --proto='https' --port='443' --urlpath='/api/' --expected-string='"status":"pass"' --ssl-opt="SSL_verify_mode => SSL_VERIFY_NONE"
OK: HTTP test(s) | 'size'=29B;;;0; 'time'=0.538s;;;0;

 /usr/lib/centreon/plugins/centreon_protocol_http.pl \
  --plugin=apps::protocols::http::plugin \
  --mode=json-content \
  --hostname=url \
  --proto='https' --port='443' \
  --urlpath='/api' \
  --header='Accept: application/json' \
  --lookup='$.status' \
  --threshold-value='values' \
  --warning-string='' \
  --critical-string='^(?!pass$)' \
  --ssl-opt='SSL_verify_mode => SSL_VERIFY_NONE'
OK: 1 element(s) found | 'count'=1;;;0; 'time'=0.599s;;;0;

curl -s  https://url
<?xml version="1.0" encoding="UTF-8"?>
<root><status>pass</status><version>0.10</version></root>

 

 

Nous aimerions utiliser le mode collection mais je me perd un peu dans HTTP Collections tutorial - How to monitor an API | Community

Merci,

6 replies

rchauvel
Centreonian
Forum|alt.badge.img+18
  • Centreonian
  • January 30, 2026

Hello, it would help if you can explain what you are trying to achieve by moving to HTTP Collection so the community can help you best.


Forum|alt.badge.img+6
  • Author
  • Steward **
  • January 30, 2026

Hello,
The target is to do a collection on 5 differents https api, on the same service.

All of them use the value “status”

 


rchauvel
Centreonian
Forum|alt.badge.img+18
  • Centreonian
  • January 30, 2026

Do your endpoints return JSON? (seems like you get XML?)


Forum|alt.badge.img+6
  • Author
  • Steward **
  • January 30, 2026

We get xml but with the “single” json mode, it’s work : 

 /usr/lib/centreon/plugins/centreon_protocol_http.pl \  --plugin=apps::protocols::http::plugin \  --mode=json-content \  --hostname=url \  --proto='https' --port='443' \  --urlpath='/api' \  --header='Accept: application/json' \  --lookup='$.status' \  --threshold-value='values' \  --warning-string='' \  --critical-string='^(?!pass$)' \  --ssl-opt='SSL_verify_mode => SSL_VERIFY_NONE'OK: 1 element(s) found | 'count'=1;;;0; 'time'=0.599s;;;0;


omercier
Centreonian
Forum|alt.badge.img+13
  • Centreonian
  • February 3, 2026

Hi ​@btrocme,

As I said in this postCollections are complex and may be a bit tricky to use. It may not be the only solution to your need. If your need is simple

In your case, json-content is the mode you need. Collections have more features (eg: handle arrays) but they are also more complicated and (I bet) slower.

 


Forum|alt.badge.img+6
  • Author
  • Steward **
  • February 3, 2026

Hello.

Ok but json-content can’t be used for check multiple api at the same time.

And because it’s not a service with real metrics, we can’t use metaservices on centreon i suppose.