Introduction

This API is intended for use by Root admin and can be used to retrieve any file from system VMs as long as the file path is known and specified as input. By default, the API gathers logs and configuration/property files and sends them as compressed zip file to a secondary storage within the same zone as the target system VM. A download URL is returned back to the operator on successful file retrieval to allow operator to download files onto their local machines. The feature is only supported for root admins and NFS based secondary storage.

Feature Specification

This feature provides admin users a new functionality to retrieve files from system VMs and gather them to a centralised location. It currently supports SSVM, CPVM and VR. The following files are supported by default for each of the supported VMs and are configurable as global settings;

  • VR – ‘diagnostics.data.router.defaults’

"iptables, ipaddr, iproute, /etc/cloudstack-release, /etc/dnsmasq.conf, /etc/dhcphosts.txt, /etc/dhcpopts.txt, /etc/dnsmasq.d/cloud.conf, /etc/dnsmasq-resolv.conf, /var/lib/misc/dnsmasq.leases, /var/log/dnsmasq.log, /etc/hosts, /etc/resolv.conf, /etc/haproxy/haproxy.cfg, /var/log/haproxy.log, /etc/ipsec.d/l2tp.conf, /var/log/cloud.log, /var/log/routerServiceMonitor.log, /var/log/daemon.log"

 

  • SSVM and CPVM – ‘diagnostics.data.systemvm.defaults’

"iptables, ipaddr, iproute, /etc/cloudstack-release, /usr/local/cloud/systemvm/conf/agent.properties, /usr/local/cloud/systemvm/conf/consoleproxy.properties, /var/log/cloud.log, /var/log/patchsystemvm.log /var/log/daemon.log"

 

This global settings are all dynamic and do not require a restart of the management server in order for changes to be picked up. The names wrapped in square brackets are for data types that need to first execute a script in the system vm and grab output for retrieval, e.g. the output from iptables-save is written to a file which will then be retrieved. This also allows admin to pack their own custom scripts in the system VMs that can be executed and their output will be redirected into a text file that will be retrieved.

 The API also has an optional parameter ‘files’ which can be used for retrieving specific files.

API and Service Layer

The table below summaries the list of global settings used by this API for the root admin.

Setting

Description

Default Value

diagnostics.data.gc.enable

Enable the garbage collector background task to delete old files from secondary storage.  Requires management server restart

True

diagnostics.data.gc.interval

The interval at which the garbage collector background tasks in seconds. Requires management server restart

86400 (Once a day)

diagnostics.data.retrieval.timeout

Overall system VM script execution time out in seconds. Does not require management server restart.

1800

diagnostics.data.max.file.age

Sets the maximum time in seconds a file can stay in secondary storage before it is deleted. 

86400 (1 day)

diagnostics.data.disable.threshold

Sets the secondary storage disk utilisation percentage for file retrieval. Used to look for suitable secondary storage  with enough space, otherwise an exception is thrown when no secondary store is found.

0.9 (95 %)


Usage

This API is only available for Root admin and takes the following input parameters;

-        targetid; the target system VM uuid

-        files; [optional) comma separated list of absolute file paths that root admin wishes to retrieved e.x. ‘/etc/hosts’, iptables

If the ‘files’ parameter is left blank, the defaults are taken from the global settings and retrieved, otherwise the list of files specified by this parameter takes preference and defaults are ignored.

Any command/script wrapped around square brackets can either be a script to be executed and its output redirected into a file with a name similar to the name in square brackets in lower case. For example, user can package their own custom script in the system VM called myscript.py/sh, user will then retrieve output of this script by specifying it as ‘[MYSCRIPT]’ as either input parameter to files or setting it as a global setting. API will then execute this script and redirect its output to a file called ‘myscript.log’. This could also be any command that can be executed from the shell and its output will be gathered and retrieved.


UI Integration

Limitations

  • For successful file retrieval, operator needs to specify the correct absolute path of file to be retrieved.
  • A working/running SSVM is required in order to create/generate the public file download URL.
  • The Zone where target VM is running should have at least 1 secondary storage that has a disk quota utilisation of less than 90 %.
  • Only supports system VMs
  • Any script that must be executed as part of this API is expected to be present in the system VM under the directory ‘/opt/cloud/bin/’
  • The response from the API is only a URL for download.



  • No labels