Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Usable as a command line tool and interactive shell
  • Management server profiles: select, customize and use different server profiles using 
  • All commands are lowercase unlike API
  • Api Discovery using sync feature, with build time api precaching for failsafe sync
  • Raw api execution support
  • Auto-completion via double <tab>
  • Reverse search using Ctrl+R
  • Emacs compatible keybindings
  • Pipeable output
  • Unix shell execution
  • Support to handle async jobs using user defined blocking or non-blocking way
  • Tabular or JSON output with filtering of table columns
  • Colored output
  • Api parameter value completion (based on predication, fuzzy results may fail sometimes)

...

Typical ~/.cloudmonkey/config for version 5.2.0 and above:

Code Block
[core]
log
profile = local
asyncblock = true
paramcompletion = false
history_file = /Users/bhaisaab/.cloudmonkey/history
log
asyncblock_file = true
paramcompletion = false
history/Users/bhaisaab/.cloudmonkey/log
cache_file = /Users/bhaisaab/.cloudmonkey/historycache

[ui]
color = true
prompt = >
display = default

[userlocal]
secretkeyurl = "enter your developer secret key" "enter your developer secret key"http://localhost:8080/client/api
username = admin
password = password
apikey = "enter API key" "enter API key"

[server]
path = /client/api
host = localhost
protocol = http
port = 8080
timeout = 3600

secretkey =
timeout = 3600
expires = 600

The following configuration parameters can be configured by using the 'set' command in cloudmonkey:

Key

Purpose

Default

host

IP or resolvable domain of management server

localhost

port

Api server port, 8080 is encouraged over 8096

8080

protocol

Specifies http or https

http

profileManagement server profile namelocal

url

Management server API url (it should contain full url with protocol, port etc and paths)

http://localhost:8080

path

Specifies the absolute path to the api on the specified host

/client/api

timeout

Timeout interval for polling async commands

3600

apikey

User api key

""

secretkey

User secret key

""

color

Enable coloured output, set to false to disable

true

prompt

cloudmonkey prompt

>

display

Line based, JSON, or tabular output, set to default or json or table

default

log_file

Log file

~/.cloudmonkey/log

history_file

History file

~/.cloudmonkey/history

asyncblock

Poll for async commands, making it false will cause cloudmonkey to return jobid

true

paramcompletion

Tries to predict api for listing a parameter value for an api, experimental may fail

false

Usage

Getting started

By default cloudmonkey will create 'local' server profile when it will start.

First set the management server API url, First set your host, port, apikey and secretkey using setetc.

Api and Secret keys can be created via CloudStack management server UI, Accounts->Users->Generate keys.

Code Block
> set host 192.168.56.1
> set port 8080
> set apikey <put-your-api-key-for-your-user>
> set secretkey <put-your-secret-key-for-your-user>
> set prompt mycloudmonkey>

Make sure your management server is running, discover and sync/pull latest apis:

Code Block
> sync
324 APIs discovered and cached

One can also use username and password though use of keys is recommended. CloudMonkey first tries to authenticate using apikey/secret key if provided, then if port specified in the URL is 8096 cloudmonkey assumes user is trying to use integration port and if both of them don't qualify i.e. keys are not provided and port is not 8096 we try to authenticate with username and password. 

Code Block
> set url https://api.exoscale.ch:443/compute
> set apikey <put-your-api-key-for-your-user>
> set secretkey <put-your-secret-key-for-your-user>
> set prompt mycloudmonkey>

Make sure your management server is running, discover and sync/pull latest apis:

Code Block
> sync
324 APIs discovered and cached

The sync command in cloudmonkey pull a list of apis which are accessible to your user role, The sync command in cloudmonkey pull a list of apis which are accessible to your user role, along with help docs etc. and stores the cache in ~/.cloudmonkey/cache. This allows cloudmonkey to be adaptable to changes in mgmt server, so in case the sysadmin enables a plugin such as Nicira NVP for that user role, the users can get those changes. New verbs and grammar (DSL) rules are created on the fly. A failsafe precache is bundled with the distribution but users are

...

Code Block
> help list users
(listUsers) Lists user accounts
Parameters
==========
id = (uuid) List user by ID.
keyword = (string) List by keyword
accounttype = (long) List users by account type. Valid types include admin, domain-admin, read-only-admin, or user.
username = (string) List user by the username
domainid = (uuid) list only resources belonging to the domain specified
page = (integer)
pagesize = (integer)
listall = (boolean) If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false
state = (string) List users by state of the user account.
isrecursive = (boolean) defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.
account = (string) list resources by account. Must be used with the domainId parameter.
 belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false
state = (string) List users by state of the user account.
isrecursive = (boolean) defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.
account = (string) list resources by account. Must be used with the domainId parameter.

Management server profiles

CloudMonkey version 5.2.0 and above will support multiple (management) server profiles, so one can use the tool on the fly toggling between different CloudStack server in the interpreter mode. If cloudmonkey starts for the first time, it will create a default server profile by the name [local] and use the following default values which one can then override using the `set` command. The profile in use is set in the [core] section's profile parameter which is read at the time cloudmonkey loads.

Code Block
[core]
profile = local
...
 
[local]
url = http://localhost:8080/client/api
username = admin
password = password
apikey =
secretkey =
timeout = 3600
expires = 600

 To create a new server profile, one can use: set profile <profile-name> and this will create a new server profile config section in ~/.cloudmonkey/config and use the above default values. Using set command on params such as url, username, password etc. will set these values for the currently selected profile only. Note: profile names cannot be whitespace/blank '', core or ui.

Tabular output

You may enable tabular listing and even choose set of column fields, this allows you to create your own field using the filter param which takes in comma separated argument. If argument has a space, put them under double quotes. The create table will have the same sequence of field filters provided. If your present cli does not have this, pl. upgrade cloudmonkey: pip install --upgrade cloudmonkey
To enable tabular output:

...

0. Unicode support
1. Bash/zsh completion (example: https://github.com/bobthecow/git-flow-completion/)
2. Python plugins 

About

cloudmonkey was named after the beloved mascot of Apache CloudStack.
Author: The Apache CloudStack Team <cloudstack-dev@incubator.apache.org>
Maintainer: Rohit Yadav <bhaisaab@apache.org>