Thank you for your feedback.
Form temporarily unavailable. Please try again or contact to submit your comments.

Store time series data

Log in to subscribe to topics and get notified when content changes.

Store time series data

Use JavaScript, REST, or scriptable REST APIs to add time series data to a metric field.

It is recommended that you use the REST APIs to store time series data.

For information on the MetricBase REST APIs see the REST API Explorer on an instance with the MetricBase application installed, or see the Clotho Time Series API.

For information on the MetricBase JavaScript APIs, see Client, Data, DataBuilder, Transformer, TransformPart, TransformerResult.

In practice, for performance reasons, batch multiple series of multiple data points and store them at one time, do not insert each data point individually.

Example: Store time series data using REST APIs

curl -v "https://<>/api/now/v1/clotho/put" --request POST 
--header "Accept:application/json" --header "Content-Type:application/json" 
--data "[{\"seriesRef\":{\"subject\":\"6d499254c70232007a89aba35a976359\",\"table\":\"cmdb_ci_knode\",
\"metric\":\"svlt_sys_load_count\"},\"values\":[{\"timestamp\":\"2017-04-06T20:22:20Z\", \"value\":0},
{\"timestamp\":\"2017-04-06T20:22:20Z\", \"value\":1.1},
{\"timestamp\":\"2017-04-06T20:23:20Z\", \"value\":1.4},
{\"timestamp\":\"2017-04-06T20:24:20Z\", \"value\":1.1},
{\"timestamp\":\"2017-04-06T20:25:20Z\", \"value\":1}]}]" 
--user 'admin':'admin'

Example: Store time series data using JavaScript APIs

// get the subject GlideRecord with which we are going to put metric data
var gr = new GlideRecord('cmdb_ci_computer');
gr.get(<sys id of record containing metric to be stored>);

// build time series data for cpu_percentage metric. time is GlideDateTime
var dataBuilder = new sn_clotho.DataBuilder(gr, 'cpu_percentage').add(time, 0.75);

// use clotho client to insert data
new sn_clotho.Client().put(dataBuilder);