3.2 KiB
The gnocchi
shell utility
gnocchi
The gnocchi
shell utility interacts with Gnocchi from the command line. It supports
the entirety of the Gnocchi API.
You'll need to provide the authentication method and your credentials
to gnocchi
.
You can do this with the --os-username
, --os-password
, --os-tenant-id
and --os-auth-url
options, but it's easier to just set
them as environment variables:
OS_USERNAME
Your username.
OS_PASSWORD
Your password.
OS_TENANT_NAME
Project to work on.
OS_AUTH_URL
The OpenStack auth server URL (Keystone).
No authentication
If you're using Gnocchi with no authentication, export the following variables in your environment:
export OS_AUTH_TYPE=gnocchi-noauth
export GNOCCHI_USER_ID=<youruserid>
export GNOCCHI_PROJECT_ID=<yourprojectid>
export GNOCCHI_ENDPOINT=http://urlofgnocchi
Basic authentication
If you're using Gnocchi with basic authentication, export the following variables in your environment:
export OS_AUTH_TYPE=gnocchi-basic
export GNOCCHI_USER=<youruserid>
export GNOCCHI_ENDPOINT=http://urlofgnocchi
OpenStack Keystone authentication
If you're using Gnocchi with Keystone authentication, export the following variables in your environment with the appropriate values:
export OS_USERNAME=user
export OS_PASSWORD=pass
export OS_TENANT_NAME=myproject
export OS_AUTH_URL=http://auth.example.com:5000/v2.0
The command line tool will attempt to reauthenticate using your
provided credentials for every request. You can override this behavior
by manually supplying an auth token using --endpoint
and --os-auth-token
. You can alternatively set these
environment variables:
export GNOCCHI_ENDPOINT=http://gnocchi.example.org:8041
export OS_AUTH_PLUGIN=token
export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155
Also, if the server doesn't support authentication, you can provide
--os-auth-plugin
gnocchi-noauth, --endpoint
, --user-id
and --project-id
. You can alternatively set these
environment variables:
export OS_AUTH_PLUGIN=gnocchi-noauth
export GNOCCHI_ENDPOINT=http://gnocchi.example.org:8041
export GNOCCHI_USER_ID=99aae-4dc2-4fbc-b5b8-9688c470d9cc
export GNOCCHI_PROJECT_ID=c8d27445-48af-457c-8e0d-1de7103eae1f
Usage
Once authentication is set up, all shell commands take the form:
gnocchi <command> [arguments...]
Run gnocchi help
to get a full list of all possible commands, and run gnocchi help <command>
to get detailed help
for that command.
Examples
Create a resource:
gnocchi resource create --attribute id:5a301761-f78b-46e2-8900-8b4f6fe6675a --attribute project_id:eba5c38f-c3dd-4d9c-9235-32d430471f94 -n temperature:high instance
List resources:
gnocchi resource list --type instance
Search of resources:
gnocchi resource search "project_id='5a301761-f78b-46e2-8900-8b4f6fe6675a' and type=instance"