问题描述
我在 VM 中运行 centreon 21.04 进行一些测试。
我按照 here 所述将 Centreon REST API v2 集合导入 Postman。 一些端点的工作方式如下:
POST /login
GET /logout
GET /configuration/icons
GET /monitoring/ackNowledgements
GET /platform/topology
但大多数其他端点返回错误 500 并显示“未找到路由”。
使用 /centreon/api/latest/monitoring/hosts
端点的响应示例:
$ curl --location --request GET 'http://<VM_IP>:80/centreon/api/latest/monitoring/hosts' --header 'X-AUTH-TOKEN: mytoken'
{"code":500,"message":"No route found for 'GET /monitoring/hosts'"}
X-AUTH-TOKEN 标头设置为通过 /login
端点检索到的令牌。
我使用的是默认管理员用户,我通过 Configuration > Users > Contacts/Users > admin > Centreon Authentication
在 Web UI 中启用了 Reach API 配置 和 Reach API 实时。
知道为什么这不起作用吗?
解决方法
因此显然某些端点目前仅适用于 API 的 Beta 版,因此请确保在 URL 中使用 /centreon/api/beta/
路径