Suggested template:
Problem/Question
I am trying to access my local netdata agent health API to disable it’s notifications at scheduled intervals.
Whenever I do this command,
curl -H “X-Auth-Token: apikey” “http://localhost:19999/api/v1/manage/health?cmd=RESET”
I get “auth error” in response.
I have clearly supplied the auth token. It is the same token as mentioned in the registry section of my netdata.conf file.
Relevant docs you followed/actions you took to solve the issue
Referring to this documentation
Health API Calls | Learn Netdata
Environment/Browser/Agent’s version etc
Latest Netdata agent running on Ubuntu 20.04, connected to netdata cloud.
What I expected to happen
I should be able to connect to management api.
More info:
cat /var/lib/netdata/netdata.api.key
abcdxyz
curl -H "X-Auth-Token: abcdxyz" "http://localhost:19999/api/v1/manage/health?cmd=LIST" -v
* Trying 127.0.0.1:19999...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 19999 (#0)
> GET /api/v1/manage/health?cmd=LIST HTTP/1.1
> Host: localhost:19999
> User-Agent: curl/7.68.0
> Accept: */*
> X-Auth-Token: abcdxyz
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 403 Forbidden
< Connection: close
< Server: Netdata Embedded HTTP Server v1.36.0-226-nightly
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Credentials: true
< Content-Type: text/plain; charset=utf-8
< Date: Sun, 16 Oct 2022 10:18:59 GMT
< Cache-Control: no-cache, no-store, must-revalidate
< Pragma: no-cache
< Expires: Sun, 16 Oct 2022 10:19:04 GMT
< Content-Length: 11
<
Auth Error
* Closing connection 0
NVM,
Issue for permissions for auth key file
2022-10-16 15:36:48: netdata ERROR : MAIN : Cannot create unique management API key file '/var/lib/netdata/netdata.api.key'. Please adjust config parameter 'netdata management api key file' to a proper path and file. (errno 13, Permission denied)
I just deleted the file, and netdata created one automatically on restart with correct permissions.