...
cloudmonkey 5.x requires Python 2.5 6 or above and has following dependencies:
Code Block |
---|
readline requests Pygments prettytable argcomplete |
...
Code Block |
---|
$ apt-get install python-setuptools $ easy_install cloudmonkey |
...
cloudmonkey is moved to a separate git repo
...
Code Block |
---|
$ git clone https://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey.git # Run mgmt server and run "cloudmonkey sync", this is only for build time cache generation using cachemaker.py $ python setup.py build $ python setup.py install |
...
Code Block |
---|
[core] profile = local asyncblock = true paramcompletion = falsetrue history_file = /Users/bhaisaab/.cloudmonkey/history log_file = /Users/bhaisaab/.cloudmonkey/log cache_file = /Users/bhaisaab/.cloudmonkey/cache [ui] color = true prompt = > display = default [local] url = http://localhost:8080/client/api username = admin password = password apikey = secretkey = timeout = 3600 expires = 600 |
The following configuration parameters can be configured by using the 'set' command in cloudmonkey:
Key | Purpose | Default |
profile | Management server profile name | local |
url | Management server API url (it should contain full url with protocol, port etc and paths) | |
timeout | Timeout interval for polling async commands | 3600 |
apikey | User api key | "" |
secretkey | User secret key | "" |
verifysslcert | Enables/Disables SSL certification verification when making HTTP calls (per server profile) | true |
username | CloudStack user name | admin |
password | CloudStack user password | password |
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
true |
Note: If both username/password and apikey/secretkey are set (i.e. have non-empty values), apikey and secretkey are used while making HTTP API calls.
By default cloudmonkey will create 'local' server profile when it will start.By default cloudmonkey will create 'local' server profile when it will start.
First set the management server API url, apikey and secretkey etc.
...
Make sure your management server is running, discover and sync/pull latest apis:
Code Block |
---|
> sync 324500 APIs discovered and cached |
...
Code Block |
---|
> list users account=admin username=admin filter=account,accountid,accounttype,created,domain { "count": 1, "user": [ { "account": "admin", "accountid": "dc8ece35-9f03-401f-95f1-2db99c467e1c", "accounttype": 1, "created": "2013-04-03T02:13:25-0500", "domain": "ROOT" } ] } |
CloudMonkey can filter output based on keys. Starting 5.3.0, filter is supported for all display outputs (json, default and table) and autocompletion works as well.
Code Block |
---|
> list users filter=<tab><tab>
account, accounttype, created, domainid, firstname, iscallerchilddomain, lastname, state, username,
accountid, apikey, domain, email, id, isdefault, secretkey, timezone,
> list users filter=id,username,firstname,lastname,
id = ef33f4a0-e7cf-11e3-a8a4-005056867a67
firstname = admin
lastname = cloud
username = admin
================================================================================
id = d052dfb3-828c-4fa3-9e72-75f4795bb554
firstname = रोहित
lastname = यादव
username = रोहित |
Ctrl+a (Ctrl+a (start of the line)
Ctrl+e (end of the line)
Ctlr+w (remove one word from back)
Ctrl+u (remove whole line) etc.
...
Code Block |
---|
> list accounts listall=true | grep '^id\ =' > list users | wc -l > list routers | more |
...
Code Block |
---|
> query asyncjobresult jobid=<job-id> |
Starting 5.3.0 version, parameter implementation works well for api arguments which are of uuid and boolean types. It can be enabled by setting paramcompletion to true. To automatically find out how to get values for a api arg it uses two heuristics (list apis and most likely related list api) so it is quite possible there are corner cases where this may fail. Whenever a list api is called or when parameter completion calls a list api in background, those results (pair of uuid and name strings) are cached by CloudMonkey to speed up rendering. The cache is kept for next 10-15 mins, after which a list api is called again in the backgroundA fuzzy implementation of parameter completion for an api is an experimental feature (a full proof feature would require annotations on each api cmd), this lets user complete a param on tabbing. It can be enabled by setting paramcompletion to true. At present it only works for only those params which accept a uuid.
Example:
Code Block |
---|
> list users id=
cd58ff50-8642-11e2-9a8b-37057334a9b2
|
...
user1
|
cloudmonkey was named after the beloved mascot of Apache CloudStack.
AuthorDev ML: The Apache CloudStack Team <cloudstack-dev@incubator<dev@cloudstack.apache.org>
Maintainer: Rohit Yadav <bhaisaab@apache.org>