Search code examples
apiauthorizationopenstackkeystoneceilometer

How to get Authorization Token for Ceilometer API Openstack


I am new to openstack, trying to use Ceilometer python API to pull some data from a testbed server, I am accessing the server from a remote site

the problem is that I cannot figure out how get the an authorization token

I used the following command

curl -i 'http://HOST:8774/' -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d/tokens auth": {"tenantName": "project", "passwordCredentials": {"username": "user", "password": "password"}}}'

But it does not give me anything,

curl -X GET -H "X-Auth-Token:$MY_TOKEN" http://HOST:8774/tokens

also does not give me any token


Solution

  • From your use of port 8774 I suspect you might be using DevStack. Try this

    curl -s -X POST http://$OPENSTACK_KEYSTONE_HOST:5000/v2.0/tokens -d '{"auth": {"passwordCredentials": {"username":"my-username", "password":"my-password"}, "tenantName":"my-tenantName"}}
    

    In DevStack Keystone (the auth service you get tokens from) is running on port 5000 by default. This may or may not be true in your case. Ask your friendly OpenStack operator what host (and port) Keystone is running on and put that in place of $OPENSTACK_KEYSTONE_HOST:5000