Hi,
Here is below the command line I tried:
/usr/lib/centreon/plugins/centreon_notification_centreon_opentickets_api.pl --plugin notification::centreon::opentickets::api::plugin --mode open-service --rule-name 'OpenTickets-Vaudoise' --host-id 1959 --service-id 6756 --service-state WARNING --service-output TEST_GLE --api-hostname centreon.vaudoise.ch --api-proto https --api-port 443 --url-path '/centreon/api/' --api-username apirest_user --api-password "XXXXXXX" --debug
I tried with different --api-hostname (Fqdn, hostname, Ip address9 …. but the result is the same.
THE RESULT IS:
UNKNOWN: Authentication error ecode: '404'] 4message: 'Object not found']
======> request send
POST https://centreon.vaudoise.ch:443/centreon/api/index.php?action=authenticate
Accept: application/json
User-Agent: centreon::plugins::backend::http::useragent
Content-Type: application/x-www-form-urlencoded
password=XXXXXX&username=apirest_user
======> response done
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Wed, 16 Nov 2022 06:41:02 GMT
Server: Apache
.….………….…………………………….………….
Keep-Alive: timeout=5, max=100
X-Frame-Options: sameorigin
X-Powered-By: PHP/8.0.18
{"authToken":"HJVsLdWFipre3yATvo2gG0g2OOblvxinqx8OFrQuQga908mv4Te0fucOb5wttVSu"}
======> request send
POST https://centreon.vaudoise.ch:443/centreon/api/index.php?object=centreon_openticket&action=openService
Accept: application/json
User-Agent: centreon::plugins::backend::http::useragent
Content-Type: application/json
Centreon-Auth-Token: HJVsLdWFipre3yATvo2gG0g2OOblvxinqx8OFrQuQga908mv4Te0fucOb5wttVSu
{"rule_name":"OpenTickets-Vaudoise","service_output":"TEST_GLE","host_id":"1959","service_state":"WARNING","service_id":"6756","select":{},"extra_properties":{}}
======> response done
HTTP/1.1 404 Object not found
Date: Wed, 16 Nov 2022 06:41:02 GMT
Server: Apache
……….……….….…………...
X-Frame-Options: sameorigin
X-Powered-By: PHP/8.0.18
"Method not found"
======> request send
POST https://centreon.vaudoise.ch:443/centreon/api/index.php?action=authenticate
Accept: application/json
User-Agent: centreon::plugins::backend::http::useragent
Content-Type: application/x-www-form-urlencoded
password=XXXXX&username=apirest_user
======> response done
HTTP/1.1 200 OK
Date: Wed, 16 Nov 2022 06:41:02 GMT
Server: Apache
Content-Type: application/json;charset=utf-8
Client-Date: Wed, 16 Nov 2022 06:41:03 GMT
Client-Peer: 172.21.3.55:443
Client-Response-Num: 3
Client-SSL-Cert-Issuer: /DC=ch/DC=vaudoise/CN=Vaudoise Assurances Issuing CA 01
Client-SSL-Cert-Subject: /C=CH/ST=VD/L=Lausanne/O=Vaudoise Assurances/OU=Vaudoise Assurances IT/CN=centreon.vaudoise.ch
Client-SSL-Cipher: ECDHE-RSA-AES256-GCM-SHA384
Client-SSL-Socket-Class: IO::Socket::SSL
Client-SSL-Warning: Peer certificate not verified
Client-Transfer-Encoding: chunked
X-Frame-Options: sameorigin
X-Powered-By: PHP/8.0.18
{"authToken":"ku1aAXKv9tsSePnBBn2BQ3AEE5QKaHDSDjxAjyS2RNbDtOA8hAGTPl+UKu3XbYc4"}
======> request send
POST https://centreon.vaudoise.ch:443/centreon/api/index.php?object=centreon_openticket&action=openService
Accept: application/json
User-Agent: centreon::plugins::backend::http::useragent
Content-Type: application/json
Centreon-Auth-Token: ku1aAXKv9tsSePnBBn2BQ3AEE5QKaHDSDjxAjyS2RNbDtOA8hAGTPl+UKu3XbYc4
{"rule_name":"OpenTickets-Vaudoise","service_output":"TEST_GLE","host_id":"1959","service_state":"WARNING","service_id":"6756","select":{},"extra_properties":{}}
======> response done
HTTP/1.1 404 Object not found
Date: Wed, 16 Nov 2022 06:41:03 GMT
Server: Apache
Content-Type: application/json;charset=utf-8
Client-Date: Wed, 16 Nov 2022 06:41:03 GMT
Client-Peer: 172.21.3.55:443
Client-Response-Num: 4
Client-SSL-Cert-Issuer: /DC=ch/DC=vaudoise/CN=Vaudoise Assurances Issuing CA 01
Client-SSL-Cert-Subject: /C=CH/ST=VD/L=Lausanne/O=Vaudoise Assurances/OU=Vaudoise Assurances IT/CN=centreon.vaudoise.ch
Client-SSL-Cipher: ECDHE-RSA-AES256-GCM-SHA384
Client-SSL-Socket-Class: IO::Socket::SSL
Client-SSL-Warning: Peer certificate not verified
Client-Transfer-Encoding: chunked
X-Frame-Options: sameorigin
X-Powered-By: PHP/8.0.18
"Method not found"
If I triy the same command but with this URL : --url-path '/centreon/api/latest/'
I get a different error :
UNKNOWN: Authentication error ncode: '500'] message: 'Internal Server Error']
======> response done
HTTP/1.1 500 Internal Server Error
{"code":500,"message":"No route found for \"POST \/\""}
Thanks