Metric API Reference

The hosting.metric API methods are used to retrieve usage statistics for simplehost instances and virtual machines.

Methods

hosting.metric.available(apikey[, opts=nil])

List availables metrics for hosting resources.

Parameters:
Returns:

struct – list of metrics per resource type

hosting.metric.query(apikey[, opts=nil])

Query metrics for hosting resources. All dates are in UTC.

Parameters:
Returns:

struct – list of metric query results

Parameters

HostingMetricOptions

parameter of hosting.metric.available()

Name Default Type Mandatory
resource   string no
filter on specific resources, all resources by default
MetricQueryFilter

parameter of hosting.metric.query()

Name Default Type Mandatory
end   string yes
query   string yes
resource_id   int or array of int yes
resource_type   string yes
sampler   struct yes
start   string yes
ResourceType

used by HostingMetricOptions, MetricAvailableReturn, MetricQueryFilter and MetricValueReturn

Name Description
vm Virtual Machine
iface Network Interface
disk Disk
paas Paas Virtual Machine
rproxy A Rproxy
Sampler

used by MetricQueryFilter

Changed in version 3.3.25: key percentile has been added.
percentile parameter.

Name Default Type Mandatory
function   string yes
sampling function to apply
unit   string yes
sampling duration
value   int yes
sampling step
percentile   double no
percentile precision, works only with percentile function, default is 0.75
SamplerFunction

used by Sampler

Changed in version 3.3.25: key percentile has been added.
percentile parameter.

Name Description
sum -
avg -
min -
max -
percentile -
SamplerUnit

used by Sampler

Name Description
seconds -
minutes -
hours -
days -
weeks -
months -

Returns

MetricAvailableReturn

returned by hosting.metric.available()

Name Type
metrics string
resource string
MetricValueReturn

returned by hosting.metric.query()

Name Type
metric string
points array
resource_id int
resource_type string