Populate Custom Computing Resource

This API enables you to populate usage data by using a CSV file for a custom computing resource added to vCenter Chargeback Manager. Custom computing resources are also referred to as custom counters.

Syntax

The syntax for calling this method is:

POST <Base_Url>/customComputingResourceStats/populate

A sample API call is as follows:

POST https://123.123.123.123/vCenter-CB/api/customComputingResourceStats/populate

User Privilege Required

You must have the Super User role.

CSV Request

Each record in the CSV file must be in the following format:

<entity_id>, <resource_id>, <sample_time_milli>, <sample_interval_milli>, <value_big_decimal>

Where,

A sample CSV body content is as follows:

#version 2.0
501, 101, 1312188135000, 1800, 19.1345
502, 101, 1312188135000, 3600, 4.645
501, 102, 1312188135000, 3600, 99999.1345
502, 102, 1312188135000, 1800, 44444.645

Lines beginning with a hash (#) are treated as comments. However, the line beginning with #version is treated as the version field of the csv file. This field is of the following format:

#version <version>

where <version> is 2.0 for the vCenter Chargeback Manager 2.0 release.

If the CSV file has even a single invalid entry, then the entire file is ignored and an error response with error code is sent.

API Response

If the operation is successful, the API returns an XML stating the same.

A sample response is provided here.

Error Response

The following table explains the error codes displayed by the API.

Error Code

Description

INVALID_CUSTOM_COUNTER_PERF_STAT_RECORD_VERSION

CVS version is not in the specified format or invalid version is specified.

INVALID_CUSTOM_COUNTER_PERF_STAT_RECORD

CSV record has invalid number of fields.

INVALID_CUSTOM_COUNTER_PERF_STAT_RECORD_FIELD

CSV record has invalid value (unable to parse the value) for one of the fields.

NON_POSITIVE_CUSTOM_COUNTER_PERF_STAT_RECORD_FIELD

CSV record has non-positive value for <sample_time_milli> or <sample_interval_milli> fields.

INVALID_CUSTOM_COUNTER_PERF_STAT_RECORD_TIME_INTERVAL

CSV record has <sample_interval_milli> value higher than <sample_time_milli>.

INVALID_OVERLAPPING_CUSTOM_COUNTER_PERF_STAT_RECORDS

CSV content has at least two records with overlapping record time interval.

INVALID_OVERLAPPING_CUSTOM_COUNTER_PERF_STAT_DB_ENTRIES

CSV content has atleast one record overlapping with an existing record for that entity and resource in the database.