You can use the configure-metrics command of the cell management tool to configure the set of metrics to collect.

VMware Cloud Director can collect metrics that provide current and historic information about the virtual machine performance and resource consumption. Use this subcommand to configure the metrics that VMware Cloud Director collects. Use the cell-management-tool cassandra subcommand to configure an Apache Cassandra database for use as a VMware Cloud Director metrics repository. See Configuring a Cassandra Metrics Database.

Procedure

  1. Log in directly or by using an SSH client to the OS of the VMware Cloud Director cell as root.
  2. Configure the metrics that VMware Cloud Director collects.
    /opt/vmware/vcloud-director/bin/cell-management-tool configure-metrics --metrics-config pathname
    Table 1. Cell Management Tool Options and Arguments, configure-metrics Subcommand
    Command Argument Description
    --help (-h) None Provides a summary of available commands in this category.
    --repository-host (Deprecated) Host name or IP address of KairosDB host Deprecated. Use the --cluster-nodes option of the cell-management-tool cassandra subcommand to configure an Apache Cassandra database for use as a VMware Cloud Director metrics repository.
    --repository-port (Deprecated) KairosDB port to use. Deprecated. Use the --port option of the cell-management-tool cassandra subcommand to configure an Apache Cassandra database for use as a VMware Cloud Director metrics repository.
    --metrics-confg path name Path to the metrics configuration file
  3. If your VMware Cloud Director version is 10.2.2 or later, you can also enable the metrics publishing by running the following command.
    /opt/vmware/vcloud-director/bin/cell-management-tool manage-config -n statsFeeder.metrics.publishing.enabled -v true
    Starting with VMware Cloud Director 10.2.2, the metrics publishing is disabled by default.

Example: Configuring a Metrics Database Connection

This example configures the metrics collection as specified in the file /tmp/metrics.groovy.
[root@cell1 /opt/vmware/vcloud-director/bin]# ./cell-management-tool configure-metrics --metrics-config /tmp/metrics.groovy

The VMware Cloud Director metrics collection service implements a subset of the metrics collected by the vSphere Performance Manager. See the vSphere Performance Manager documentation for more information about metric names and collection parameters. The metrics-config file cites one or more metric names and provides collection parameters for each cited metric. For example:

configuration {
    metric("cpu.usage.average")
    metric("cpu.usagemhz.average")
    metric("cpu.usage.maximum")
    metric("disk.used.latest") {
        currentInterval=300
        historicInterval=300
        entity="VM"
        instance=""
        minReportingInterval=1800
        aggregator="AVERAGE"
    }
}
The following metric names are supported.
Table 2. Metric Names
Metric Name Description
cpu.usage.average Host view of this virtual machine's average actively used CPU as a percentage of total available. Includes all cores in all sockets.
cpu.usagemhz.average Host view of this virtual machine's average actively used CPU as a raw measurement . Includes all cores in all sockets.
cpu.usage.maximum Host view of this virtual machine's maximum actively used CPU as a percentage of total available. Includes all cores in all sockets.
mem.usage.average Memory used by this virtual machine as a percentage of total configured memory.
disk.provisioned.latest Storage space allocated to this virtual hard disk in the containing organization virtual data center.
disk.used.latest Storage used by all virtual hard disks.
disk.read.average Average read rate for all virtual hard disks.
disk.write.average Average write rate for all virtual hard disks.
Note: When a virtual machine has multiple disks, VMware Cloud Director reports metrics as an aggregate for all disks. CPU metrics are an aggregate of all cores and sockets.

For each named metric, you can specify the following collection parameters.

Table 3. Metrics Collection Parameters
Parameter Name Value Description
currentInterval Integer number of seconds The interval in seconds to use when querying for the latest available metric values for current metrics queries. The default value is 20. VMware Cloud Directorsupports values greater than 20 only for Level 1 metrics, as defined by the vSphere Performance Manager.
historicInterval Integer number of seconds The interval in seconds to use when querying for historic metric values. The default value is 20. VMware Cloud Director supports values greater than 20 only for Level 1 metrics, as defined by the vSphere Performance Manager.
entity One of: HOST, VM The type of VC object that the metric is available for. The default is VM. Not all metrics are available for all entities.
instance A vSphere Performance Manager PerfMetricId instance identifier Indicates whether to retrieve data for individual instances of a metric, for example, individual CPU cores, an aggregate of all instances, or both. A value of "*" collects all metrics, instance and aggregate. An empty string, "" collects only the aggregate data. A specific string like "DISKFILE" collects data only for that instance. The default is "*".
minReportingInterval Integer number of seconds Specifies a default aggregation interval in seconds to use when reporting time series data. Provides further control over reporting granularity when the granularity of the collection interval is not sufficient. The default is 0, that is, no dedicated reporting interval.
aggregator One of: AVERAGE, MINIMUM, MAXIMUM, SUMMATION The type of aggregation to perform during the minReportingInterval. The default is AVERAGE.