These are the API calls for listing, creating, updating and deleting Metric Groups.
Definitions of Metric and Metric Group
A Metric for the purposes of this document is simply a quantity that we want to measure, record, chart and alert on. Each metric, whether ‘built-in’ or user-defined, is an object, characterized by a hash:
A Metric Group is a built-in or user-defined collection of Metrics, along with some metadata describing the group. Every Metric Group includes an array of metric hashes. The array of metric hashes must have at least one element.
In fact, a Metric Group is an object characterized by a hash:
Metric Group Hash (Ruby-formatted)
Metric Group Hash (JSON-formatted)
Summing up:
No metric stands alone. Every metric is defined in the context of a metric group.
A metric group exists to group metrics. A metric group must have at least one metric.
There is great power and flexibility in groups of metrics!
You can group metrics that you define, as well as in combination with system metrics from RevealCloud and website performance and availability metrics from RevealUptime.
Index
List all defined Custom Metrics Metric Groups.
Required parameters:
None.
Optional parameters:
None.
CURL Command, and variations:
CURL Response:
Response is a JSON array of Metric Group hashes. In this example, there is one metric group defined, which contains 6 metrics.
Show
Show all details of a single Metric Group.
Required parameters:
METRIC_GROUP_ID as part of the path
Optional parameters:
None.
CURL Command, and variations:
CURL Response:
Response is single Metric Group Hash. In this example, the metric group is the same as that returned in the Index example.
Create Metric Group
Create a new Metric Group.
Required parameters:
You must include a metric group “name” string and an array of metrics. The metric group name can not contain spaces or periods.
Each Metric hash must contain 3 key-value pairs: type, name, and unit. You can optionally specify a label.
Optional parameters:
frequency
if not included, the polling frequency will be once per minute. (polling period 60 seconds)
label
if not included, a default label will be created. Be descriptive!!!
Create Example 1: Create a small group of metrics using two of the metrics from the example above. We’ll call this new metric group ‘myredis’.
We’ll also use the bare minimum required parameters, to demonstrate the defaults.
CURL Command, and variations:
CURL Response:
Response is Status 200, and the metric group hash created:
Create Example 2: Create a small group of metrics using two of the metrics from the example above. We’ll call this new metric group ‘newredis’.
This time we’ll specify frequency and labels.
CURL Command, and variations:
CURL Response:
Response is Status 200, and the metric group hash created:
Create Example 2: Attempt to create a metric group with name containing spaces.
CURL Command, and variations:
CURL Response:
Response is Status 403 and an error message is returned:
Update
Update an existing Metric Group.
Required parameters
METRIC_GROUP_ID as part of the path
Optional parameters
frequency, if you want to alter it
any labels that you want to alter
add new metrics
CURL REQUEST
Update Example 1: Change frequency of the metric group created above to every 15 seconds. (where id=”myredis”)
CURL Command, and variations:
CURL Response:
Response is Status 200, updated metric group hash:
Update Example 2: Add a metric to a metric group. (where id=”myredis”)
NOTE: You don’t need to repeat the already-existing metrics.
CURL Response:
Response is Status 200, updated metric group hash: