-
Notifications
You must be signed in to change notification settings - Fork 63
Getting Started
To install the modern Apache CloudStack cloudmonkey or cmk
, please download the binary from the latest release: https://github.com/apache/cloudstack-cloudmonkey/releases
Download the binary for Linux or Mac based on your platform and move it to a directory that is on $PATH
such as /usr/local/bin
. For example:
sudo wget <file link> -O /usr/local/bin/cmk
sudo chmod +x /usr/local/bin/cmk
Download the Windows specific .exe
executable file and copy it to a directory which on the cmd's PATH such as C:\Windows\System32\
. Launch cmd.exe or powershell and see if you can run/access cmk.exe
.
The default server profile has the name localcloud
with defaults (such as url and credentials) set to a locally running CloudStack server. Start cmk
, create a new server profile, configure your CloudStack server's API endpoint and run sync
, for example:
$ cmk
Apache CloudStack π΅ CloudMonkey 6.3.0
Report issues: https://github.com/apache/cloudstack-cloudmonkey/issues
(localcloud) π± > set profile mycloud
Loaded server profile: mycloud
Url: http://localhost:8080/client/api
Username: admin
Domain: /
API Key:
Discovered 697 APIs
(mycloud) π± > set url http://myprovider.cloud/client/api
(mycloud) π± > set username myusername
(mycloud) π± > set password mypassword
(mycloud) π± > sync
Discovered 697 APIs
You can also use the set
command to set the various server profile specific options. The cloudmonkey configuration is stored at ~/.cmk/config
file. The ~/.cmk
directory also contains the API cache at ~/.cmk/profiles
.
Help for any API command can be obtained using <cmd> -h
, for example:
> help
usage: cmk [flags] [commands|apis] [-h]
CloudMonkey (cmk) π΅ is a command line interface for Apache CloudStack.
Allowed flags:
-h Show this help message or API doc when specified after an API
-v Print version
-o API response output format: json, text, table, column, csv
-p Server profile
-d Enable debug mode
-c Different config file path
-u CloudStack's API endpoint URL
-s CloudStack user's secret Key
-k CloudStack user's API Key
Default commands:
exit Exits
help Help
set Configures options for cmk
sync Discovers and updates APIs
version Version info
> list users -h
> help listUsers
A typical help doc for an api will list all available acceptable arguments and required arguments.
Example help for listUsers
API:
> list users -h
listUsers: Lists user accounts
API Params Type Description
========== ==== ===========
account string list resources by account. Must be used w
ith the domainId parameter.
accounttype long List users by account type. Valid types i
nclude admin, domain-admin, read-only-ad
min, or user.
domainid uuid list only resources belonging to the doma
in specified
id uuid List user by ID.
isrecursive boolean defaults to false, but if true, lists all
resources from the parent specified by
the domainId till leaves.
keyword string List by keyword
listall boolean If set to false, list only resources belo
nging to the command's caller; if set to
true - list resources that the caller i
s authorized to see. Default value is fa
lse
page integer
pagesize integer
state string List users by state of the user account.
username string List user by the username
Try autocompletion using tabbing:
> <tab><tab>
> list <tab><tab>
> list users <tab><tab> # for options
> list users <press enter>
> list users
{
"count": 1,
"user": [
{
"account": "admin",
"accountid": "2b3f2497-e99b-11ed-b9b2-1e005c000265",
"accounttype": 1,
"apikey": "LIN6rqXuaJwMPfGYFh13qDwYz5VNNz1J2J6qIOWcd3oLQOq0WtD4CwRundBL6rzXToa3lQOC_vKjI3nkHtiD8Q",
"created": "2023-05-03T10:13:37+0000",
"domain": "ROOT",
"domainid": "0e605be7-e99b-11ed-b9b2-1e005c000265",
"firstname": "admin",
"id": "2b401a22-e99b-11ed-b9b2-1e005c000265",
"is2faenabled": false,
"is2famandated": false,
"iscallerchilddomain": false,
"isdefault": true,
"lastname": "cloud",
"roleid": "1e9c0c8b-e99b-11ed-b9b2-1e005c000265",
"rolename": "Root Admin",
"roletype": "Admin",
"state": "enabled",
"username": "admin",
"usersource": "native"
}
]
}
Consult the API docs at http://cloudstack.apache.org/api.html