Usage

If you haven't installed the client, check the quickstart doc.

List options

List clouds

List machines

List keys/scripts

List sizes/locations/images for a cloud

Create machine

Enable monitoring on machine

Run actions on machines

List options

Get an idea of the options by running mist command:

user@user:~/Desktop/PROGRAMMING/mist.client.dev$./bin/mist --help
usage: mist [-h]
            {list-providers,list-backends,rename-backend,delete-backend,describe-backend,add-backend,list-keys,add-key,delete-key,rename-key,describe-key,list-images,list-sizes,list-locations,list-scripts,list-networks,list-machines,describe-machine,probe,start,stop,reboot,destroy,tag,enable-monitoring,disable-monitoring,create-machine,list-metrics,add-metric,add-custom-metric,run,ssh,user-info}
            ...
Mist.io command line tool
positional arguments:
  {list-providers,list-backends,rename-backend,delete-backend,describe-backend,add-backend,list-keys,add-key,delete-key,
    rename-key,describe-key,list-images,list-sizes,list-locations,list-scripts,list-networks,list-machines,describe-machine,probe,start,
    stop,reboot,destroy,tag,enable-monitoring,disable-monitoring,create-machine,list-metrics,add-metric,add-custom-metric,run,ssh,user-info}
                        action to perform
    add-backend         Add a new backend
    add-key             Add a new SSH Key
    list-networks       List availablen networks for specified provider
                        (currently only OPENSTACK support)
    describe-machine    Show information about a specified machine
    create-machine      Create a new machine
    add-metric          Add a new metric to the machine
    user-info           Get info about the user

The first time you run any of the commands that need interaction with mist.io service (that is all commands, except list-providers) it will prompt for an email/password combination that will be stored in ~/.mist

user@user:~/Desktop/PROGRAMMING/mist.client$ ./bin/mist list-machines
No config file found at: /home/user/.mist
Email:  Password: 
Saved config at /home/user/.mist
Here you need to specify an account you already have on https://mist.io. If you are using the open source version of mist.io, you will need to change mist_uri to point to the URL of your standalone installation, eg  http://127.0.0.1:8000
user@user:/tmp/kati$ cat ~/.mist 
[mist.io] 
mist_uri=https://mist.io 
[mist.credentials] 
email=mgogoulos@mist.io 
password=XYZ

List clouds

List the clouds you have added to your mist.io account. Shows the cloud type, it's name, id and status

user@user:~/cli$ ./bin/mist list-backends
Azure	          2yqGUT3ZQniiRcYeVBv2L             azure	online
Indonesian Cloud  e3CxPrTJBpquksSeVbFDt             indonesian_vcloud	online
HostVirtual	  9qpy84bNy9JeYP1trkveU              hostvirtual	online
GCEnew	          3Fmwp8uY9zPBjwz7RmLGgG             gce	online
Linode	          HiYUF5YDpxSs6FQakw4Wb              linode	online
DigitalOcean	  2UmAeuwfMbTFEE9zmEm1hJ             digitalocean	online
HP US East	  3o5MkRgyRuxeJzecNtg9zm             hpcloud	online
EC2 Frankfurt	  pQ2NsArRti7V1fKz5MrCsY             ec2_eu_central	online

List machines

list-machines will return a listing of your servers, name, status, id, public ips and tags. Add the --pretty switch in order to get a better formatting

user@user:~/cli$ ./bin/mist list-machines --pretty 
+----------------+------------------------+---------+-----------------+----------+
| Name           |ID          |  State  |   Public Ips    |Backend Title         |
+----------------+------------------------+---------+-----------------+----------+
|winshelltest    |winshelltest| running |  104.40.203.194 |Azure                |
|kvm-dev         |kvm-dev     | running |  23.102.13.120  | Azure               |
|win 2008 remote |vm-224a03f0 | pending |                 |Indonesian Cloud     |
|jenkins test    |vm-ff31c1d2 | pending |  103.242.181.44 |Indonesian Cloud     |
|docker-staging  | 1186426    | running |   45.33.50.55   |Linode               |
|mon.markos.com  |4499827     | running |  107.170.218.51 |DigitalOcean         |
|kvm-staging     |6220698     | running | 104.131.217.171 |DigitalOcean         |
|uBuntu 14.04 x64|vm-8536887f | running |  43.231.128.18  |my.idcloudonline.com |
+--------------------+-----------------------------------------+---------+-------+

You can also get a listing for one of your clouds only

user@user:~/Desktop/mist.client.dev$ ./bin/mist list-machines --backend DigitalOcean
+----------------+---------+---------+-----------------+---------------+------+
|Name        |    ID   |  State  |    Public Ips   | Backend Title | Tags |
+----------------+---------+---------+-----------------+---------------+------+
| mon.markos.com | 4499827 | running |  107.170.218.51 |  DigitalOcean |      |
|        kvm     | 6220698 | running | 104.131.217.171 |  DigitalOcean |      |
+----------------+---------+---------+-----------------+---------------+------+

While if you set the --metadata switch, you will also see the listing of extra info for your machines

user@user:~/mist.client.dev$ ./bin/mist list-machines --backend DigitalOcean --metadata
mon.markos.com        4499827                                                      running    107.170.218.51       DigitalOcean                              {u'can_start': False, u'can_reboot': True, u'private_ips': [], u'can_destroy': True, u'tags': [], u'can_stop': True, u'extra': {u'size': {u'price_monthly': 5.0, u'available': True, u'transfer': 1.0, u'price_hourly': 0.00744, u'regions': [u'nyc1', u'sgp1', u'ams1', u'sfo1', u'nyc2', u'lon1', u'nyc3', u'ams3', u'ams2', u'fra1'], u'vcpus': 1, u'memory': 512, u'disk': 20, u'slug': u'512mb'}, u'kernel': {u'version': u'3.2.0-4-amd64', u'id': 3285, u'name': u'Debian 7.0 x64 vmlinuz-3.2.0-4-amd64 (3.2.65-1+deb7u1)'}, u'features': [u'virtio'], u'backup_ids': [], u'created_at': u'2015-03-17T14:49:09Z', u'memory': 512, u'disk': 20, u'image': {u'min_disk_size': 20, u'name': u'7.0 x64', u'created_at': u'2015-01-28T16:09:29Z', u'slug': u'debian-7-0-x64', u'regions': [u'nyc1', u'ams1', u'sfo1', u'nyc2', u'ams2', u'sgp1', u'lon1', u'nyc3', u'ams3', u'fra1'], u'public': True, u'distribution': u'Debian', u'type': u'snapshot', u'id': 10322059}, u'name': u'mon.markos.com'}, u'uuid': u'4cb9ffc3787dd801b022be449427920d71ebec34', u'imageId': None, u'public_ips': [u'107.170.218.51'], u'state': u'running', u'can_rename': True, u'can_tag': False, u'name': u'mon.markos.com', u'id': u'4499827', u'size': None}

List keys/scripts

./bin/mist list-keys will return a listing with the names of the ssh keys you have uploaded to mist.io, through the keys section

./bin/mist list-scripts will return a listing with the names and IDs of the scripts you have uploaded to mist.io, through the scripts section

Both commands are useful when you are creating machines through the create-machine command, in order to specify which key and script you aim to deploy

List sizes/locations/images for a cloud

These 3 commands will show the sizes/locaitons/images of a cloud. They need to be run for a specific cloud. Example:

user@user:~/cli$ ./bin/mist list-sizes --backend DigitalOcean 
512mb
1gb
2gb
...
user@user:~/cli$ ./bin/mist list-images --backend DigitalOcean
Fedora 21 x64                            9640922   
Ubuntu 14.10 x32                         9801951
Ubuntu 14.10 x64                         9801954
FreeBSD 10.1                             10144573
Ubuntu 12.04.5 x64                       10321756
Ubuntu 12.04.5 x32                       10321777
Debian 7.0 x64                           10322059
... 
user@user:~/cli$ ./bin/mist list-locations --backend DigitalOcean
San Francisco 1      sfo1                 
New York 2           nyc2                 
Amsterdam 2          ams2                 
Singapore 1          sgp1                 ...

Create machine

Create a machine needs the following args specified for all clouds supported by mist.io (except Docker): 

  • name
  • image-id
  • size-id
  • location-id
  • key-id

 and optionally script-id and monitoring. 

If --monitoring is specified, mist.io will enable monitoring as soon as the machine is deployed. 

If --script-id is specified, mist.io will deploy the script with this id (you need to have added a script, see more on the scripts section)

if --script-id is specified and there are additional params to be passed in the script, these can be specified by --script-params

user@user:~/cli$ ./bin/mist create-machine
usage: mist create-machine [-h]
...


As an example, we will create an Ubuntu extra small server on DigitalOcean, in San Fransisco 1 datacenter, by specifying an ssh key we have already added through https://mist.io. We will enable monitoring and also specify a script to deploy after server is provisioned (in our case this is an ansible playbook that installs a few utilities, as htop, vim, nmap etc)

We run the commands 

./bin/mist list-sizes --backend DigitalOcean
./bin/mist list-images --backend DigitalOcean 
./bin/mist list-locations --backend DigitalOcean

in order to get the ids of these 3, and also run list-script to get the id of our ansible script, plus list-keys to get the name of the key to deploy

user@user:~/cli$ ./bin/mist list-scripts
Script Name - Script ID - Script Description
Ubuntu mongo  f07a8bc4dbf94393b1241dc606775798    
Ubuntu 14 essential packages  8c3ad80899ce490588fe04b85ed6f43e installs essential packages as htop, vim, nmap

With all this info, we will deploy the machine as

user@user:~/cli$ ./bin/mist create-machine  
--backend DigitalOcean 
 --machine-name ubuntu-cmd  
--image-id 12790328   
--size-id 512mb  
--location-id sfo1  
--key-id digitalo  
--script-id 8c3ad80899ce490588fe04b85ed6f43e  
--monitoring 
Created machine ubuntu-cmd

The machine is created on Digital Ocean, with the settings we have specified. We can see it through the mist.io dashboard, where we see it has an ssh key associated (and we can use the web shell), plus monitoring enabled. 

We can also see the related API calls that were sent through the logs section, on mist.io dashboard

Enable monitoring on machines

Given the id of a machine (you can see that through ./bin/mist list-machines) you can easily enable monitoring using the command enable-monitoring

In order for this to work, the machine has to have an ssh key associated with mist.io.

user@user:~/cli$ ./bin/mist enable-monitoring --id 6251124
Enabled monitoring to machine client-monit

If we visit mist.io page for this machine we will see monitoring graphs for this machine.

Machine actions

Actions as reboot/shutdown/start/destroy can also be performed through the client. Eg, this will destroy client-monit server

user@user:~/cli$ ./bin/mist  destroy client-monit 
Destroyed machine client-monit

Still need help? Contact Us Contact Us