Skip to main content
Question

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

  • January 23, 2026
  • 4 replies
  • 15 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,

4 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;