Command line utilities

Some Cloud Management Platform (CMP) tasks run from the appliance command line rather than from the interface

These are Django management commands, run through manage.py on the appliance. Every command accepts --help, which prints its usage and its full list of options.

Run a command

  1. Connect to the appliance over SSH and switch to the root user.

    sudo su -
    

    The - gives you a root login shell with the environment manage.py expects.

  2. Run the command by its full path.

    /opt/cloudbolt/manage.py sync_vms_from_rh --help
    

Synchronize servers from a resource handler

/opt/cloudbolt/manage.py sync_vms_from_rh

Queues a Sync VMs job and prints the job ID and the path to the job’s log file. The job creates a server record for each VM it finds that CMP does not have, updates the power status and hardware of the records it already holds, and marks a record historical when its VM is no longer in the resource handler.

With no arguments, every resource handler is queued, and the job skips the ones that cannot synchronize VMs. To synchronize one handler, name it:

/opt/cloudbolt/manage.py sync_vms_from_rh -r "vCenter Prod"

Follow the job on its detail page under Jobs. The same work runs on a schedule from the Sync all Resource Handlers recurring job. See Built-in recurring jobs.

Import networks from a resource handler

/opt/cloudbolt/manage.py sync_networks_from_rh

Scans VMware vCenter resource handlers for networks and creates a record for each network CMP does not have. Existing records are left as they are, except that a distributed port group renamed in vCenter has its name updated. Uplink port groups are skipped. Every network found is attached to each resource handler with the same address, so handlers pointing to the same vCenter remain consistent.

Three options are available: -r or --resource-handler names a single handler, --no-create reports what the scan finds without creating or attaching anything, and --logfile writes the output to a file instead of the console.

The same import runs from Import Networks on a resource handler’s Networks tab. Once a network has a record, add it to an environment so it is available when servers are provisioned.

Export server information to CSV

/opt/cloudbolt/manage.py export_server_info

Writes a CSV report of server records. Choose the columns with --fields, naming server fields, parameters, or custom fields; a custom field’s column header is its label. With no options, the report holds the hostname of every server. Historical servers are left out, unless hours_on is one of the requested fields.

Option What it does
-f, --fields The field names to export, comma-separated. Defaults to hostname.
-g, --groups Export only the servers belonging to these groups, comma-separated.
-s, --separate Produce one report per group instead of a single combined report. A group that owns no servers is skipped.
-p, --prefix Start output filenames with this prefix. Defaults to exported-server-info.
-o, --usestdout Print the CSV to the console instead of writing files.
-e, --email-to Email every report to these addresses, comma-separated.
-a, --email-group-admins Email each group its own report, addressed to that group’s admins. Implies --separate.
-t, --startdate and -n, --enddate Bound the period the hours_on field covers, as YYYY-MM-DD. Defaults to the previous full month.

Example: a consolidated IT report

Write one file covering every server, with hardware, ownership, and rate columns:

/opt/cloudbolt/manage.py export_server_info --fields=hostname,ip,sc_nic_0,cpu_cnt,mem_size,disk_size,os_build,group,owner,rate

Example: a billing report for each group

Email each group’s admins a report for their own group, and send one email carrying all of the reports to a billing address:

/opt/cloudbolt/manage.py export_server_info --fields=hostname,ip,cpu_cnt,mem_size,disk_size,os_build,owner,rate --email-group-admins --email-to=billing@example.com

Both emails are rendered from built-in email templates, and SMTP has to be configured for either to be sent.

Reset a user’s password

/opt/cloudbolt/manage.py changepassword <username>

Prompts for a new password for that CMP user. Name the user: with no argument, the command looks for a CMP account matching the operating system user running it, which is root, and reports that the user does not exist. Any CMP account can be reset this way, administrators included. See Password policies and admin password reset for the password policy settings, for what to do when an administrator is locked out, and for resetting a password from Shell Plus instead.

Commands documented elsewhere

Command What it does Topic
cb_export, cb_import Move CMP files and configuration between appliances, and restore them from a backup. Import and export utilities
shell_plus Open an interactive Python shell with every CMP model imported. Shell Plus
features List feature flags and enable or disable one. Resource handlers
makemessages, compilemessages Create and compile the translation files for another language. Internationalization
collector_config Create, list, update, and delete the data collector’s connections. VMware data collector configuration
check_for_stale_jobs, quota_monitor, rates_monitor Monitoring commands that email when they find a problem. Send email automatically