V2 Web API

Resources

type Resource

An externally defined object for which samples have been received.

Data samples:

Json
{
    "metadata": {
        "name1": "value1",
        "name2": "value2"
    },
    "project_id": "35b17138-b364-4e6a-a131-8f3099c5be68",
    "resource_id": "bd9431c1-8d69-4ad3-803a-8d4a6b89fd36",
    "timestamp": "2014-04-12T02:40:24.001472",
    "user_id": "efd87807-12d2-4b38-9c70-5f5c2ac427ff"
}
XML
<value>
  <metadata>
    <item>
      <key>name2</key>
      <value>value2</value>
    </item>
    <item>
      <key>name1</key>
      <value>value1</value>
    </item>
  </metadata>
  <project_id>35b17138-b364-4e6a-a131-8f3099c5be68</project_id>
  <resource_id>bd9431c1-8d69-4ad3-803a-8d4a6b89fd36</resource_id>
  <timestamp>2014-04-12T02:40:24.001472</timestamp>
  <user_id>efd87807-12d2-4b38-9c70-5f5c2ac427ff</user_id>
</value>
metadata
Type:dict(unicode: unicode)

Arbitrary metadata associated with the resource

project_id
Type:unicode

The ID of the owning project or tenant

resource_id
Type:unicode

The unique identifier for the resource

timestamp
Type:datetime

UTC date and time of the last update to any meter for the resource

user_id
Type:unicode

The ID of the user who created the resource or updated it last

Meters

Samples and Statistics

type Meter

One category of measurements.

Data samples:

Json
{
    "name": "instance",
    "project_id": "35b17138-b364-4e6a-a131-8f3099c5be68",
    "resource_id": "bd9431c1-8d69-4ad3-803a-8d4a6b89fd36",
    "type": "gauge",
    "unit": "instance",
    "user_id": "efd87807-12d2-4b38-9c70-5f5c2ac427ff"
}
XML
<value>
  <name>instance</name>
  <project_id>35b17138-b364-4e6a-a131-8f3099c5be68</project_id>
  <resource_id>bd9431c1-8d69-4ad3-803a-8d4a6b89fd36</resource_id>
  <type>gauge</type>
  <unit>instance</unit>
  <user_id>efd87807-12d2-4b38-9c70-5f5c2ac427ff</user_id>
</value>
name
Type:unicode

The unique name for the meter

project_id
Type:unicode

The ID of the project or tenant that owns the resource

resource_id
Type:unicode

The ID of the Resource for which the measurements are taken

type
Type:unicode

The meter type (see Measurements)

unit
Type:unicode

The unit of measure

user_id
Type:unicode

The ID of the user who last triggered an update to the resource

type Sample

A single measurement for a given meter and resource.

Data samples:

Json
{
    "counter_name": "instance",
    "counter_type": "gauge",
    "counter_unit": "instance",
    "counter_volume": 1.0,
    "message_id": "5460acce-4fd6-480d-ab18-9735ec7b1996",
    "project_id": "35b17138-b364-4e6a-a131-8f3099c5be68",
    "resource_id": "bd9431c1-8d69-4ad3-803a-8d4a6b89fd36",
    "resource_metadata": {},
    "source": "openstack",
    "timestamp": "2014-04-12T02:40:24.207551",
    "user_id": "efd87807-12d2-4b38-9c70-5f5c2ac427ff"
}
XML
<value>
  <counter_name>instance</counter_name>
  <counter_type>gauge</counter_type>
  <counter_unit>instance</counter_unit>
  <counter_volume>1.0</counter_volume>
  <message_id>5460acce-4fd6-480d-ab18-9735ec7b1996</message_id>
  <project_id>35b17138-b364-4e6a-a131-8f3099c5be68</project_id>
  <resource_id>bd9431c1-8d69-4ad3-803a-8d4a6b89fd36</resource_id>
  <resource_metadata />
  <source>openstack</source>
  <timestamp>2014-04-12T02:40:24.207551</timestamp>
  <user_id>efd87807-12d2-4b38-9c70-5f5c2ac427ff</user_id>
</value>
counter_name
Type:unicode

The name of the meter

counter_type
Type:unicode

The type of the meter (see Measurements)

counter_unit
Type:unicode

The unit of measure for the value in counter_volume

counter_volume
Type:float

The actual measured value

message_id
Type:unicode

A unique identifier for the sample

project_id
Type:unicode

The ID of the project or tenant that owns the resource

resource_id
Type:unicode

The ID of the Resource for which the measurements are taken

resource_metadata
Type:dict(unicode: unicode)

Arbitrary metadata associated with the resource

source
Type:unicode

An identity source ID

timestamp
Type:datetime

UTC date and time when the measurement was made

user_id
Type:unicode

The ID of the user who last triggered an update to the resource

type Statistics

Computed statistics for a query.

Data samples:

Json
{
    "avg": 4.5,
    "count": 10,
    "duration": 300.0,
    "duration_end": "2013-01-04T16:47:00",
    "duration_start": "2013-01-04T16:42:00",
    "max": 9.0,
    "min": 1.0,
    "period": 7200,
    "period_end": "2013-01-04T18:00:00",
    "period_start": "2013-01-04T16:00:00",
    "sum": 45.0
}
XML
<value>
  <avg>4.5</avg>
  <count>10</count>
  <duration>300.0</duration>
  <duration_end>2013-01-04T16:47:00</duration_end>
  <duration_start>2013-01-04T16:42:00</duration_start>
  <max>9.0</max>
  <min>1.0</min>
  <period>7200</period>
  <period_end>2013-01-04T18:00:00</period_end>
  <period_start>2013-01-04T16:00:00</period_start>
  <sum>45.0</sum>
</value>
avg
Type:float

The average of all of the volume values seen in the data

count
Type:int

The number of samples seen

duration
Type:float

The difference, in minutes, between the oldest and newest timestamp

duration_end
Type:datetime

UTC date and time of the oldest timestamp, or the query end time

duration_start
Type:datetime

UTC date and time of the earliest timestamp, or the query start time

max
Type:float

The maximum volume seen in the data

min
Type:float

The minimum volume seen in the data

period
Type:int

The difference, in seconds, between the period start and end

period_end
Type:datetime

UTC date and time of the period end

period_start
Type:datetime

UTC date and time of the period start

sum
Type:float

The total of all of the volume values seen in the data

Filtering Queries

Many of the endpoints above accecpt a query filter argument, which should be a list of Query data structures:

type Query

Query filter.

Data samples:

Json
{
    "field": "resource_id",
    "op": "eq",
    "value": "bd9431c1-8d69-4ad3-803a-8d4a6b89fd36"
}
XML
<value>
  <field>resource_id</field>
  <op>eq</op>
  <value>bd9431c1-8d69-4ad3-803a-8d4a6b89fd36</value>
</value>
field
Type:unicode

The name of the field to test

op
Type:Enum(lt, le, eq, ne, ge, gt)

The comparison operator. Defaults to ‘eq’.

value
Type:unicode

The value to compare against the stored data

API and CLI query examples

CLI Queries

Ceilometer CLI Commands:

$ ceilometer --debug --os-username <username_here> --os-password <password_here> --os-auth-url http://localhost:5000/v2.0/ --os-tenant-name admin  meter-list

or:

$ ceilometer --os-username admin --os-password password --os-tenant-name admin project-list

Note

The username, password, and tenant-name options are required to be present in these commands or specified via environment variables. Note that the in-line commands will override the environment variables.

API Queries

Ceilometer API calls:

Note

To successfully query the Ceilometer you must first get a project-specific token from the Keystone service and add it to any API calls that you execute against that project. See the Openstack credentials documentation for additional details.

A simple query to return a list of available meters:

$ curl -X GET -H 'X-Auth-Token:<inserttokenhere>' "http://localhost:8777/v2/meters"

A query to return the list of resources:

$ curl -X GET -H 'X-Auth-Token:<inserttokenhere>' "http://localhost:8777/v2/resources"

A query to return the list of meters, limited to a specific meter type:

$ curl -X GET -H 'X-Auth-Token:<inserttokenhere>' "http://localhost:8777/v2/meters/disk.root.size"

A query using filters (see: query filter section):

$ curl -X GET -H 'X-Auth-Token:<inserttokenhere>' "http://localhost:8777/v2/meters/instance?q.field=metadata.event_type&q.value=compute.instance.delete.start"

Additional examples:

$ curl -X GET -H 'X-Auth-Token:<inserttokenhere>' "http://localhost:8777/v2/meters/disk.root.size?q.field=resource_id&q.op=eq&q.value=<resource_id_here>"

or:

$ curl -X GET -H 'X-Auth-Token:<inserttokenhere>' "http://localhost:8777/v2/meters/instance?q.field=metadata.event_type&q.value=compute.instance.exists"

and finally, a JSON-based example:

$ curl -X GET -H 'X-Auth-Token:<inserttokenhere>' -H 'Content-Type:application/json' -d '{"q":[{"field": "timestamp","op": "ge","value":"2013-04-01T13:34:17"}]}' http://localhost:8777/v2/meters

Table Of Contents

Previous topic

V1 Web API

Next topic

Contributing to Ceilometer

This Page