...
Code Block | ||||
---|---|---|---|---|
| ||||
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "collectd Base Schema", "description": "A schema that defines the collectd meters and events", "definitions": { "collectd_field": { "description": "collectd_fields", "type": "object", "properties": { "anyOf" : { "Interval" : { "Interval" : { "description": "interval at which to expect a new value", "type": "number" }, }, "host" : { "description": "used to identify the host", "type": "string" }, "message" : { "description": "The notification message", "type": "string" }, "metadata" : { "description": "an opaque data structure that enables the passing of additional information about a value list", "type": "string" }, "plugin }, "message" : { "description": "used to identify the plugin", "type": "string" }, "plugin instance" : { "description": "used to group a set of values together", "type"description": "stringThe notification message" }, "severity" : { "description": "can be one of OKAY, WARNING, and FAILURE", , "type": "string" }, "time" : { "description": "Time stamp at which the value was collected", "type": "number" }, "type" : { "description": "unit used to measure a value", "type": "string" }, "type instance " : { "description": "used to distinguish between values that have an identical type", "type": "string" }, "values" : { "type": "object", "anyOf" : { "absolute" : { "type" : "number" } , "counter" : { "type" : "number" }, "derive" : { "type" : "number" }, "gauge" : { "type" : "number" } } }, "value length" : { "description": "The number of values in the data set", "type": "number" } } } }, "mapping": { "description": "mapping pair", "type": "object", "properties": { "oneOf": { "$ref": "#/definitions/collectd_field", "collectd_string": { "type": "string" } }, "new_string": { "type": "string" } } }, "events": { "description": "Mappings from collectd events to other framework events", }, "metadata" : { "description": "an opaque data structure that enables the passing of additional information about a value list", "type": "string" }, "plugin" : { "description": "used to identify the plugin", "type": "object",string" }, "properties": { "mappings": { "description": "array of mappings from collectd to other frameworks", "type": "array", "items""plugin instance" : { "$ref": "#/definitions/mapping" } } }, "required": [ "mappings" ] }, "metersdescription": {"used to group a set of values together", "description": "Mappings from collectd meters to other framework meters", "type": "objectstring", "properties": { "mappings": { "description": "array of mappings from collectd to other frameworks", "type": "array", "items": { "$ref": "#/definitions/mapping" } } }, "required": [ "mappings" ] }, "severity" : { }, "resourcedescription": {"can be one of OKAY, WARNING, and FAILURE", "description": "Mappings from collectd resources to other framework resources", "type": "objectstring", "properties": { "mappings": { "description": "array of mappings from collectd to other frameworks", "type": "array", "items": { "$ref": "#/definitions/mapping" } } }, "required": [ "mappings" ] }, "time" : { }, "typesdescription": {"Time stamp at which the value was collected", "description": "Mappings from collectd meter types to other framework meter types", "type": "object",number" "properties": { "mappings": { "description": "array of mappings from collectd to other frameworks", "type": "array", "items": { "$ref": "#/definitions/mapping" } } }, "required": [ "mappings" ] }, "type" : { }, "timestamps": { "description": "Mappings from collectd timestampsunit used to othermeasure frameworka timestampsvalue", "type": "objectstring", "properties": { "mappings": { "description": "array of}, mappings from collectd to other frameworks", "type": "array", "items": { "$ref": "#/definitions/mapping", "conversion": "string" } } }, "required": [ "mappings" ] "type instance " : { }, "units": { "description": "Mappings from collectd units to other framework units",used to distinguish between values that have an identical type", "type": "objectstring", "properties": { "mappings": { "description": "array of}, mappings from collectd to other frameworks", "type": "array", "items": { "$ref": "#/definitions/mapping", "unit_conversion": "string" } } }, "required": [ "mappings" ] "values" : { } }, "field_mappings": { "type": "object", "oneOf": [ { "$ref": "#/definitions/mapping" } ] } } |
Taking the following ceilometer meter as an example:
Code Block |
---|
- name: 'vcpus' event_type: 'compute.instance.*' "anyOf" : { type: 'gauge' unit: 'vcpu' volume: $.payload.vcpus "absolute" : { "type" user_id: $.payload.user_id "string" } , project_id: $.payload.tenant_id resource_id: $.payload.instance_id |
...
"counter" : { "type" : "string" },
"derive" : { "type" : "string" },
"gauge" : { "type" : "string" },
"actual_values" : { "type" : "string" }
}
},
"value length" : {
"description": "The number of values in the data set",
"type": "number"
}
}
}
},
"mappings": {
"description": "mapping pair",
"type": "object",
"properties": {
"oneOf": {
"$ref": "#/definitions/collectd_field",
"collectd_string": { "type": "string" }
},
"new_string": { "type": "string" },
"new_value": { "type": "string" }
}
},
"mappings_with_conversion": {
"description": "Mappings from collectd timestamps to other framework timestamps",
"type": "object",
"properties": {
"transform": {
"description": "array of mappings from collectd to other frameworks",
"type": "array",
"items": {
"$ref": "#/definitions/mapping",
"conversion": "string"
}
}
},
"required": [ "mappings" ]
}
},
"field_mappings": {
"description": "array of field_mappings",
"type": "array",
"items": {
"set": {
"description": "set of associated of field_mappings",
"type": "array",
"anyOf":{
"$ref": "#/definitions/mappings",
"$ref1": "#/definitions/mappings_with_conversion"
}
}
}
}
} |
Taking the following ceilometer meter as an example:
Code Block |
---|
- name: 'compute.node.cpu.percent'
event_type: 'compute.metrics.update'
type: 'gauge'
unit: 'percent'
volume: $.payload.metrics[?(@.name='cpu.percent')].value * 100
resource_id: $.payload.host + "_" + $.payload.nodename
timestamp: $.payload.metrics[?(@.name='cpu.percent')].timestamp
metadata:
event_type: $.event_type
host: $.publisher_id
source: $.payload.metrics[?(@.name='cpu.percent')].source
|
Using the schema above:
Code Block | ||
---|---|---|
| ||
{
"field_mappings": [
"set": [
{
"new_string": "counter_name",
"collectd_field": {
"plugin": "cpu"
},
"conversion": "cpu"
},
{
"new_string": "counter_type",
"collectd_field": {
"values": {
"gauge": "cumulative"
}
}
},
{
"new_string": "counter_volume",
"collectd_field": {
"values": {
"actual_values": "values_array"
}
}
"conversion": "None"
},
{
"new_string": "timestamp",
"collectd_string": "timestamp"
},
{
"new_string": "source",
"new_value": "collectd"
},
{
"new_string": "resource_id",
"collectd_field": {
"values": {
"host": "uuid",
"plugin instance": "plugin_instance"
}
}
}
]
]
} |
Key_words: values_array.
References
http://docs.openstack.org/admin-guide/telemetry-data-collection.html
...