We are having an issue with 5.16 where we use curl -X GET https://sensu-dev.test.com/api/core/v2/namespaces/default/events -H "Authorization: Key foo" and we get this in return {"code":2,"message":"not found"}
However, we are able to call the other API calls such as checks and assets. Checking the dashboard we can confirm events along with sensuctl event list
Any ideas on whats going on?
Using the API from a mac to the Ubuntu system.
Is Key a valid API key?
I am facing the same issue. sensuctl working fine but calling the api directly using curl is returning {"code":2,"message":"not found"}. Other apis are working fine. Verified the API key its valid.
CURL -X GET /api/core/v2/namespaces
[{"name":"default"}]%
Using sensu-backend open source build.
Hi!
I just built Sensu Go 5.18 and used the following curl command to successfully retrieve all events:
curl -X GET http://localhost:8080/api/core/v2/namespaces/default/events -H "Authorization: Key $SENSU_API_KEY"
Could you provide us the following information:
Also, could you try to set the backend log-level to debug, and then try to curl events? You should see the following log entries, which would help us to understand what's happening.
{"component":"rbac","level":"debug","msg":"request authorized by the binding cluster-admin","time":"2020-02-26T10:53:30-05:00","zz_request":{"apiGroup":"core","apiVersion":"v2","namespace":"default","resource":"events","resourceName":"","username":"admin","verb":"list"}}
{"component":"apid","duration":"1.353ms","level":"info","method":"GET","msg":"request completed","path":"/api/core/v2/namespaces/default/events","size":909,"status":200,"time":"2020-02-26T10:53:30-05:00"}
Thanks
Hi, I got everything working as expected on port 8080. I was trying port 3000 before, not realising the api is running on 8080. The weird part was sensu backend running on port 3000 responded properly to some api calls which made me think api is also served via 3000
curl -L -H "Authorization: Key xxxxxxXXXXX" http://localhost:3000/api/core/v2/namespaces/default/checks
{
"command": "check-cpu.rb -w 75 -c 90",
"handlers": ["slack"],
"high_flap_threshold": 0,
"interval": 60,
"low_flap_threshold": 0,
"publish": true,
"runtime_assets": ["cpu-checks-plugins", "sensu-ruby-runtime"],
"subscriptions": ["system"],
"proxy_entity_name": "",
"check_hooks": null,
"stdin": false,
"subdue": null,
"ttl": 0,
"timeout": 0,
"round_robin": false,
"output_metric_format": "",
"output_metric_handlers": null,
"env_vars": null,
"metadata": {
"name": "check-cpu",
"namespace": "default"
},
"secrets": null
}
Thank you for the help 馃槃