Hitachi

JP1 Version 13 JP1/Integrated Management 3 - Manager Command, Definition File and API Reference


5.11.3 Write Trend Data

Description

Write trend data to the trend data management DB.

Specify the data to be written in JSON format.

Execution permissions

None

API version

v1

Format
Request line
POST /im/api/v1/trendData/write HTTP/1.1
Request header

Header name

Setting value

Authorization

Do not set it.

If message body of the request is in JSON format, the other request headers are the same as Common spec of API. For the request header of Common spec of API, see the explanation of the request header in 5.2.3 Request format.

Request message body

You can send it in the JSON format shown below.

{
    "labels":{"__name__": "metric name", "label name": "label value", ...},
    "samples":[
        [time, value],
        ...
    ]
}
{
    "labels":{"__name__": "metric name", "label name": "label value", ...},
    "samples":[
        [time, value],
        ...
    ]
}
...
Response message body

None

Parameters

Here are the parameters that you specify for message body of the request:

No.

Parameters

Data type

Description

1

labels

Array

Specify the labels for the time series data in an array.

2

__name__

string

Specify a metric name for the time series data. Specification is mandatory.

3

Label Name

string

Specify a label name for the time series data.

4

Label Value

string

Specify label values for temporal data

5

samples

Array

Specify the time series data as an array.

6

Time

Number

Specifies the time of the performance data (the number of milliseconds elapsed since January 1, 1970 00:00:00 (UNIX epoch) in UTC time). You cannot specify a time (negative value) before 0:00:00 a.m. on January 1, 1970.

7

Value

Number

Specify values for the performance data.

Status codes

The following table describes the status codes that are returned as a response to the request:

Status code

Message

Description

200

--

API processing succeeded.

500

KAJY62001-E

The Trend Data Management Service returned an error.

KAJY62000-E

Communication with the Trend Data Management Service failed.

KAJY62004-E

Failed to get port number for Trend Data Management Service.

Examples

The following is an example of using this API using the OSS curl command.

>curl -i --header "Content-Type: application/json" --request POST --data @c:\\work\\trenddata.json "http://localhost:20703/im/api/v1/trendData/write"
trenddata.json
{
    "labels":{"__name__":"foo","job":"hoge"},
    "samples":[
        [1617436800000,100]
    ]
}
Example of response:
HTTP/1.1 200
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 0
Date: Fri, 25 Feb 2022 05:59:58 GMT