CLOUDSTACK-825: Fix CloudMonkey docs

This commit is contained in:
Sebastien Goasguen 2013-03-15 05:51:29 -04:00
parent edaa72d0fc
commit e74dd13f7f

View File

@ -24,7 +24,7 @@
<section id="cloudmonkey">
<title>CloudMonkey</title>
<para>CloudMonkey is the &PRODUCT; Command Line Interface (CLI). It is written in Python and leverages Marvin. CloudMonkey can be used both as an interactive shell and as a command line tool which simplifies &PRODUCT; configuration and management.</para>
<para>CloudMonkey is the &PRODUCT; Command Line Interface (CLI). It is written in Python. CloudMonkey can be used both as an interactive shell and as a command line tool which simplifies &PRODUCT; configuration and management. It can be used with &PRODUCT; CloudStack 4.0-incubating and above</para>
<warning>
<para>CloudMonkey is still under development and should be considered a Work In Progress (WIP), the wiki is the most up to date documentation:</para>
<para><ulink url="https://cwiki.apache.org/CLOUDSTACK/cloudstack-cloudmonkey-cli.html">https://cwiki.apache.org/CLOUDSTACK/cloudstack-cloudmonkey-cli.html</ulink></para>
@ -32,13 +32,15 @@
<section id="gettingcloudmonkey">
<title>Installing CloudMonkey</title>
<para>There are two ways to get CloudMonkey:</para>
<para><itemizedlist>
<para>CloudMonkey is dependent on <emphasis>readline, pygments, prettytable</emphasis>, when installing from source you will need to resolve those dependencies. Using the cheese shop, the dependencies will be automatically installed.</para>
<para>There are three ways to get CloudMonkey. Via the official &PRODUCT; source releases or via a community maintained distribution at <ulink url="http://pypi.python.org/pypi/cloudmonkey/">the cheese shop</ulink>. Developers can also get it directly from the git repository in <emphasis>tools/cli/</emphasis>.</para>
<para>
<itemizedlist>
<listitem>
<para>Via the official Apache &PRODUCT; releases (starting with 4.1).</para>
<para>Via the official Apache &PRODUCT; releases as well as the git repository.</para>
<programlisting>
<![CDATA[
$ git clone https://git-wip-us.apache.org/repos/asf/incubator-cloudstack.git
$ git clone https://git-wip-us.apache.org/repos/asf/incubator-cloudstack.git # (optional if using a release download)
$ mvn clean install -P developer
$ cd tools/cli # cloudmonkey-x.x.x.tar.gz will be built in dist
$ python setup.py build
@ -56,42 +58,80 @@ $ python setup.py install
<section id="configuringcloudmonkey">
<title>Configuration</title>
<para>To configure CloudMonkey you can edit the .cloudmonkey_config file in the user's home directory as shown below. The values can also be set interactively at the cloudmonkey prompt</para>
<para>To configure CloudMonkey you can edit the ~/.cloudmonkey/config file in the user's home directory as shown below. The values can also be set interactively at the cloudmonkey prompt. Logs are kept in ~/.cloudmonkey/log, and history is stored in ~/.cloudmonkey/history. Discovered apis are listed in ~/.cloudmonkey/cache. Only the log and history files can be custom paths and can be configured by setting appropriate file paths in ~/.cloudmonkey/config</para>
<programlisting>
$ cat .cloudmonkey_config
[CLI]
protocol = http
$ cat ~/.cloudmonkey/config
[core]
log_file = /Users/sebastiengoasguen/.cloudmonkey/log
asyncblock = true
paramcompletion = false
history_file = /Users/sebastiengoasguen/.cloudmonkey/history
[ui]
color = true
prompt = cloudmonkey>
history_file = /Users/sebastiengoasguen/.cloudmonkey_history
host = localhost
prompt = >
tabularize = false
[user]
secretkey =VDaACYb0LV9eNjTetIOElcVQkvJck_J_QljX_FcHRj87ZKiy0z0ty0ZsYBkoXkY9b7eq1EhwJaw7FF3akA3KBQ
apikey = plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdMkAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg
[server]
path = /client/api
host = localhost
protocol = http
port = 8080
apikey = plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg
secretkey = VDaACYb0LV9eNjTetIOElcVQkvJck_J_QljX_FcHRj87ZKiy0z0ty0ZsYBkoXkY9b7eq1EhwJaw7FF3akA3KBQ
timeout = 600
log_file = /Users/sebastiengoasguen/.cloudmonkey_log
timeout = 3600
</programlisting>
<para>The values can also be set at the cloudmonkey prompt. The API and secret keys are obtained via the &PRODUCT; UI or via a raw api call.</para>
<para>The values can also be set at the CloudMonkey prompt. The API and secret keys are obtained via the &PRODUCT; UI or via a raw api call.</para>
<programlisting>
<![CDATA[
$ cloudmonkey
☁ Apache CloudStack cloudmonkey 4.0.0. Type help or ? to list commands.
cloudmonkey> set prompt myprompt>
☁ Apache CloudStack cloudmonkey 4.1.0-snapshot. Type help or ? to list commands.
> set prompt myprompt>
myprompt> set host localhost
myprompt> set port 8080
myprompt> set apikey <your api key>
myprompt> set secretkey <your secret key>
]]>
</programlisting>
<para>You can use cloudmonkey to interact with a local cloud, and even with a remote public cloud. You just need to set the host value properly and obtain the keys from the cloud administrator.</para>
<para>You can use CloudMonkey to interact with a local cloud, and even with a remote public cloud. You just need to set the host value properly and obtain the keys from the cloud administrator.</para>
</section>
<section id="cliapidiscovery">
<title>API Discovery</title>
<note>
<para>In &PRODUCT; 4.0.* releases, the list of api calls available will be pre-cached, while starting with &PRODUCT; 4.1 releases and above an API discovery service is enabled. CloudMonkey will discover automatically the api calls available on the management server. The sync command in CloudMonkey pulls a list of apis which are accessible to your user role, along with help docs etc. and stores them 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.</para>
</note>
<para>To discover the APIs available do:</para>
<programlisting>
> sync
324 APIs discovered and cached
</programlisting>
</section>
<section id="clitabularoutput">
<title>Tabular Output</title>
<para>The number of key/value pairs returned by the api calls can be large resulting in a very long output. To enable easier viewing of the output, a tabular formatting can be setup. 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</para>
<para>To enable it, use the <emphasis>set</emphasis> function and create filters like so:</para>
<programlisting>
> set tabularize true
> list users filter=id,domain,account
count = 1
user:
+--------------------------------------+--------+---------+
| id | domain | account |
+--------------------------------------+--------+---------+
| 7ed6d5da-93b2-4545-a502-23d20b48ef2a | ROOT | admin |
+--------------------------------------+--------+---------+
</programlisting>
</section>
<section id="interactivecli">
<title>Interactive Shell Usage</title>
<para>To start learning cloudmonkey, the best is to use the interactive shell. Simply type cloudmonkey at the prompt and you should get the interactive shell.</para>
<para>At the cloudmonkey prompt press the tab key twice, you will see all potential verbs available. Pick on, enter a space and then press tab twice. You will see all actions available for that verb</para>
<para>To start learning CloudMonkey, the best is to use the interactive shell. Simply type CloudMonkey at the prompt and you should get the interactive shell.</para>
<para>At the CloudMonkey prompt press the tab key twice, you will see all potential verbs available. Pick on, enter a space and then press tab twice. You will see all actions available for that verb</para>
<programlisting>
<![CDATA[
cloudmonkey>