Interacting with BOSH clusters

BOSH Cluster Basics

In this lab, you will explore the Cloud Foundry cluster you deployed with BOSH. The BOSH command line interface offers many useful features for exploring your clusters.

VM Details

You can view details of the VMs BOSH has deployed with the commands bosh instances and bosh vms. Play with both of these, exploring the various command line options to show different information. Remember that to get help you can run bosh <command> -h.

Accessing VMs

You can ‘SSH’ to any virtual machine deployed by BOSH.

  bosh ssh -d <deployment name> <instance-group/<instance-id>>

For example:

  bosh ssh -d cf diego-api/c754437a-738e-43d7-8f07-b1ddd2359d3b
  • Choose a VM to SSH to. Once you’re connected, change directory to /var/vcap.
 ├── bosh
 ├── data
 ├── instance          <-- instance identity & health
 ├── monit
 ├── packages          <-- binaries
 └── sys
        └── log        <-- logs
  • You can tail logs individually or all at once:
tail --lines=1 -f /var/vcap/sys/log/*/*

Health Monitoring

Process Monitoring with Monit and VM resurrection

While still SSHed into a VM, try the following:

sudo /var/vcap/bosh/bin/monit summary
  • This shows the processes monit is running. Let’s kill one and see what happens.
# terminal 1
sudo watch /var/vcap/bosh/bin/monit summary
# terminal 2
sudo kill -9 $(cat /var/vcap/sys/run/consul_agent/
  • The output from Monit status is also sent to the BOSH director. Try the following:
#in terminal 1, back on the bosh-lite VM
watch bosh instances --failing
#in terminal 2, while SSHed into a VM from your deployment
sudo kill -9 $(cat /var/vcap/sys/run/consul_agent/

Cloud Check

After you exit from the VM, try using BOSH’s cloudcheck to trigger a manual health check:

  bosh -d <deployment-name> cloudcheck


We can look through a deployment’s logs manually on its VMs, but the BOSH command line interface also offers some tools for accessing logging information more easily.

For example, the following command downloads a tarball of logs from all of the VMs that make up your deployment:

  bosh logs -d <deployment-name>

Adding the --follow flag will produce a continous stream of all logs generated by the deployment, which you can use in your own log management service.

Beyond the class

© 2019 Copyright Cloud Foundry Foundation. All Rights Reserved.