Skip to content

Commit 9f180e4

Browse files
committed
Docs: CLOUDSTACk-825 cloudmonkey docs
1 parent f9e9487 commit 9f180e4

4 files changed

Lines changed: 228 additions & 3 deletions

File tree

docs/en-US/Developers_Guide.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<bookinfo id="cloudstack_developers">
2727
<title>&PRODUCT; Developer's Guide</title>
2828
<productname>Apache CloudStack</productname>
29-
<productnumber>4.0.0-incubating</productnumber>
29+
<productnumber>4.1.0-incubating</productnumber>
3030
<edition></edition>
3131
<pubsnumber></pubsnumber>
3232
<abstract>

docs/en-US/cloudmonkey.xml

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
<?xml version='1.0' encoding='utf-8' ?>
2+
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
3+
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
4+
%BOOK_ENTITIES;
5+
]>
6+
7+
<!-- Licensed to the Apache Software Foundation (ASF) under one
8+
or more contributor license agreements. See the NOTICE file
9+
distributed with this work for additional information
10+
regarding copyright ownership. The ASF licenses this file
11+
to you under the Apache License, Version 2.0 (the
12+
"License"); you may not use this file except in compliance
13+
with the License. You may obtain a copy of the License at
14+
15+
http://www.apache.org/licenses/LICENSE-2.0
16+
17+
Unless required by applicable law or agreed to in writing,
18+
software distributed under the License is distributed on an
19+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20+
KIND, either express or implied. See the License for the
21+
specific language governing permissions and limitations
22+
under the License.
23+
-->
24+
25+
<section id="cloudmonkey">
26+
<title>CloudMonkey</title>
27+
<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>
28+
<warning>
29+
<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>
30+
<para><ulink url="https://cwiki.apache.org/CLOUDSTACK/cloudstack-cloudmonkey-cli.html">https://cwiki.apache.org/CLOUDSTACK/cloudstack-cloudmonkey-cli.html</ulink></para>
31+
</warning>
32+
33+
<section id="gettingcloudmonkey">
34+
<title>Installing CloudMonkey</title>
35+
<para>There are two ways to get CloudMonkey:</para>
36+
<para><itemizedlist>
37+
<listitem>
38+
<para>Via the official Apache &PRODUCT; releases (starting with 4.1).</para>
39+
<programlisting>
40+
<![CDATA[
41+
$ git clone https://git-wip-us.apache.org/repos/asf/incubator-cloudstack.git
42+
$ mvn clean install -P developer
43+
$ cd tools/cli # cloudmonkey-x.x.x.tar.gz will be built in dist
44+
$ python setup.py build
45+
$ python setup.py install
46+
]]>
47+
</programlisting>
48+
</listitem>
49+
<listitem>
50+
<para>Via a community maintained package on Cheese Shop</para>
51+
<para><programlisting>pip install cloudmonkey</programlisting></para>
52+
</listitem>
53+
</itemizedlist>
54+
</para>
55+
</section>
56+
57+
<section id="configuringcloudmonkey">
58+
<title>Configuration</title>
59+
<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>
60+
<programlisting>
61+
$ cat .cloudmonkey_config
62+
[CLI]
63+
protocol = http
64+
asyncblock = true
65+
color = true
66+
prompt = cloudmonkey>
67+
history_file = /Users/sebastiengoasguen/.cloudmonkey_history
68+
host = localhost
69+
path = /client/api
70+
port = 8080
71+
apikey = plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg
72+
secretkey = VDaACYb0LV9eNjTetIOElcVQkvJck_J_QljX_FcHRj87ZKiy0z0ty0ZsYBkoXkY9b7eq1EhwJaw7FF3akA3KBQ
73+
timeout = 600
74+
log_file = /Users/sebastiengoasguen/.cloudmonkey_log
75+
</programlisting>
76+
<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>
77+
<programlisting>
78+
<![CDATA[
79+
$ cloudmonkey
80+
☁ Apache CloudStack cloudmonkey 4.0.0. Type help or ? to list commands.
81+
cloudmonkey> set prompt myprompt>
82+
myprompt> set host localhost
83+
myprompt> set port 8080
84+
myprompt> set apikey <your api key>
85+
myprompt> set secretkey <your secret key>
86+
]]>
87+
</programlisting>
88+
<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>
89+
</section>
90+
91+
<section id="interactivecli">
92+
<title>Interactive Shell Usage</title>
93+
<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>
94+
<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>
95+
<programlisting>
96+
<![CDATA[
97+
cloudmonkey>
98+
EOF assign cancel create detach extract ldap prepare reconnect restart shell update
99+
activate associate change delete disable generate list query register restore start upload
100+
add attach configure deploy enable get mark quit remove revoke stop
101+
api authorize copy destroy exit help migrate reboot reset set suspend
102+
cloudmonkey>create
103+
account diskoffering loadbalancerrule portforwardingrule snapshot tags vpc
104+
autoscalepolicy domain network privategateway snapshotpolicy template vpcoffering
105+
autoscalevmgroup firewallrule networkacl project sshkeypair user vpnconnection
106+
autoscalevmprofile instancegroup networkoffering remoteaccessvpn staticroute virtualrouterelement vpncustomergateway
107+
condition ipforwardingrule physicalnetwork securitygroup storagenetworkiprange vlaniprange vpngateway
108+
counter lbstickinesspolicy pod serviceoffering storagepool volume zone
109+
]]>
110+
</programlisting>
111+
<para>Picking one action and entering a space plus the tab key, you will obtain the list of parameters for that specific api call.</para>
112+
<programlisting>
113+
<![CDATA[
114+
cloudmonkey>create network
115+
account= domainid= isAsync= networkdomain= projectid= vlan=
116+
acltype= endip= name= networkofferingid= startip= vpcid=
117+
displaytext= gateway= netmask= physicalnetworkid= subdomainaccess= zoneid=
118+
]]>
119+
</programlisting>
120+
<para>To get additional help on that specific api call you can use the following:</para>
121+
<programlisting>
122+
<![CDATA[
123+
cloudmonkey>create network -h
124+
Creates a network
125+
Required args: displaytext name networkofferingid zoneid
126+
Args: account acltype displaytext domainid endip gateway isAsync name netmask networkdomain networkofferingid physicalnetworkid projectid startip subdomainaccess vlan vpcid zoneid
127+
128+
cloudmonkey>create network -help
129+
Creates a network
130+
Required args: displaytext name networkofferingid zoneid
131+
Args: account acltype displaytext domainid endip gateway isAsync name netmask networkdomain networkofferingid physicalnetworkid projectid startip subdomainaccess vlan vpcid zoneid
132+
133+
cloudmonkey>create network --help
134+
Creates a network
135+
Required args: displaytext name networkofferingid zoneid
136+
Args: account acltype displaytext domainid endip gateway isAsync name netmask networkdomain networkofferingid physicalnetworkid projectid startip subdomainaccess vlan vpcid zoneid
137+
cloudmonkey>
138+
]]>
139+
</programlisting>
140+
<para>Note the required arguments necessary for the calls.</para>
141+
<note><para>To find out the required parameters value, using a debugger console on the &PRODUCT; UI might be very useful. For instance using Firebug on Firefox, you can navigate the UI and check the parameters values for each call you are making as you navigate the UI.</para></note>
142+
</section>
143+
144+
<section id="startingavmexample">
145+
<title>Starting a Virtual Machine instance with CloudMonkey</title>
146+
<para>To start a virtual machine instance we will use the <emphasis>deploy virtualmachine</emphasis> call.</para>
147+
<programlisting>
148+
<![CDATA[
149+
cloudmonkey>deploy virtualmachine -h
150+
Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.
151+
Required args: serviceofferingid templateid zoneid
152+
Args: account diskofferingid displayname domainid group hostid hypervisor ipaddress iptonetworklist isAsync keyboard keypair name networkids projectid securitygroupids securitygroupnames serviceofferingid size startvm templateid userdata zoneid
153+
]]>
154+
</programlisting>
155+
<para>The required arguments are <emphasis>serviceofferingid, templateid and zoneid</emphasis></para>
156+
<para>In order to specify the template that we want to use, we can list all available templates with the following call:</para>
157+
<programlisting>
158+
<![CDATA[
159+
cloudmonkey>list templates templatefilter=all
160+
count = 2
161+
template:
162+
========
163+
domain = ROOT
164+
domainid = 8a111e58-e155-4482-93ce-84efff3c7c77
165+
zoneid = e1bfdfaf-3d9b-43d4-9aea-2c9f173a1ae7
166+
displaytext = SystemVM Template (XenServer)
167+
ostypeid = 849d7d0a-9fbe-452a-85aa-70e0a0cbc688
168+
passwordenabled = False
169+
id = 6d360f79-4de9-468c-82f8-a348135d298e
170+
size = 2101252608
171+
isready = True
172+
templatetype = SYSTEM
173+
zonename = devcloud
174+
...<snipped>
175+
]]>
176+
</programlisting>
177+
<para>In this snippet, I used DevCloud and only showed the beginning output of the first template, the SystemVM template</para>
178+
<para>Similarly to get the <emphasis>serviceofferingid</emphasis> you would do:</para>
179+
<programlisting>
180+
<![CDATA[
181+
cloudmonkey>list serviceofferings | grep id
182+
id = ef2537ad-c70f-11e1-821b-0800277e749c
183+
id = c66c2557-12a7-4b32-94f4-48837da3fa84
184+
id = 3d8b82e5-d8e7-48d5-a554-cf853111bc50
185+
]]>
186+
</programlisting>
187+
<para>Note that we can use the linux pipe as well as standard linux commands within the interactive shell. Finally we would start an instance with the following call:</para>
188+
<programlisting>
189+
<![CDATA[
190+
cloudmonkey>deploy virtualmachine templateid=13ccff62-132b-4caf-b456-e8ef20cbff0e zoneid=e1bfdfaf-3d9b-43d4-9aea-2c9f173a1ae7 serviceofferingid=ef2537ad-c70f-11e1-821b-0800277e749c
191+
jobprocstatus = 0
192+
created = 2013-03-05T13:04:51-0800
193+
cmd = com.cloud.api.commands.DeployVMCmd
194+
userid = 7ed6d5da-93b2-4545-a502-23d20b48ef2a
195+
jobstatus = 1
196+
jobid = c441d894-e116-402d-aa36-fdb45adb16b7
197+
jobresultcode = 0
198+
jobresulttype = object
199+
jobresult:
200+
=========
201+
virtualmachine:
202+
==============
203+
domain = ROOT
204+
domainid = 8a111e58-e155-4482-93ce-84efff3c7c77
205+
haenable = False
206+
templatename = tiny Linux
207+
...<snipped>
208+
]]>
209+
</programlisting>
210+
<para>The instance would be stopped with:</para>
211+
<programlisting>
212+
cloudmonkey>stop virtualmachine id=7efe0377-4102-4193-bff8-c706909cc2d2
213+
</programlisting>
214+
<note><para>The <emphasis>ids</emphasis> that you will use will differ from this example. Make sure you use the ones that corresponds to your &PRODUCT; cloud.</para></note>
215+
</section>
216+
217+
<section id="scriptingcli">
218+
<title>Scripting with CloudMonkey</title>
219+
<para>All previous examples use CloudMonkey via the interactive shell, however it can be used as a straightfoward CLI, passing the commands to the <emphasis>cloudmonkey</emphasis> command like shown below.</para>
220+
<para><programlisting>$cloudmonkey list users</programlisting></para>
221+
<para>As such it can be used in shell scripts, it can received commands via stdin and its output can be parsed like any other unix commands as mentioned before.</para>
222+
</section>
223+
224+
</section>

docs/en-US/devcloud-usage-mode.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<para>The following diagram shows the architecture of the SandBox mode.</para>
3333
<mediaobject>
3434
<imageobject>
35-
<imagedata fileref="./images/DevCloud.png" />
35+
<imagedata fileref="./images/DevCloud.png" scale="50"/>
3636
</imageobject>
3737
<textobject>
3838
<phrase>DevCloud.png: Schematic of the DevCloud SandBox architecture</phrase>
@@ -49,7 +49,7 @@
4949
<para>The following schematic shows the architecture of the Host-Only mode.</para>
5050
<mediaobject>
5151
<imageobject>
52-
<imagedata fileref="./images/DevCloud-hostonly.png" />
52+
<imagedata fileref="./images/DevCloud-hostonly.png" scale="50"/>
5353
</imageobject>
5454
<textobject>
5555
<phrase>DevCloud-hostonly.png: Schematic of the DevCloud host-only architecture </phrase>

docs/en-US/tools.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@
2626
<title>Tools</title>
2727
<xi:include href="devcloud.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
2828
<xi:include href="marvin.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
29+
<xi:include href="cloudmonkey.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
2930
</chapter>

0 commit comments

Comments
 (0)