Outils pour utilisateurs

Outils du site


centreon:api

- GET TOKEN

 curl -s -k -X POST -d '{"security": {"credentials": {"login": "userapi","password": "PASS"}}}' -H "Content-Type: application/json" -X POST https://p-a389-vipp-001.mycorp.corp/centreon/api/beta/login

- CHECK_Token

 curl -s -k -H 'X-AUTH-TOKEN:'16cb698cb30791757f72c2fe39260e23'' -H "Content-Type: application/json" -X GET "https://p-a389-vipp-001.mycorp.corp/centreon/api/beta/monitoring/hostgroups" | jq '.' | grep "total" | wc –l

- Recherché hosts et services id

 curl -s -k -H 'X-AUTH-TOKEN:'856adad694c2f1e57c31b83445b291ca'' -H "Content-Type: application/json" -X GET "https://p-a389-vipp-001.mycorp.corp/centreon/api/beta/monitoring/hosts/{712}?&show_services=true" | jq '.'
 curl -s -k -H 'X-AUTH-TOKEN:'856adad694c2f1e57c31b83445b291ca'' -H "Content-Type: application/json" -X GET "https://p-a389-vipp-001.mycorp.corp/centreon/api/beta/monitoring/hosts/{712}/services/{11505}" | egrep -o "'sessions_total'=.*" | cut -d'=' -f2 | cut -d';' -f1
 curl -s -k -H 'X-AUTH-TOKEN:'856adad694c2f1e57c31b83445b291ca'' -H "Content-Type: application/json" -X GET "https://p-a389-vipp-001.mycorp.corp/centreon/api/beta/monitoring/hosts/{724}/services/{11647}" | egrep -o "'total_cpu_5m_avg'=.*" | cut -d'=' -f2 | cut -d'%' -f1
centreon/api.txt · Dernière modification : 2023/07/05 10:00 de michel