cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Push a custom metric to a custom device to Dynatrace

phile
Newcomer

Dear,

I'm a new user, I want to post a custom metric to Dynatrace via API but I got some problems so need your help:

- Firstly, I post a custom timeseries as the following: https://xxxxx.live.dynatrace.com/api-doc/index.jsp#/Timeseries/createCustomTimeseries 

*timeseriesIdentifier: custom:phitestmachine

Body:

{
"displayName": "PhiTestMachine",
"types": ["F5-Firewall"]
}

Response:

{
"timeseriesId": "custom:phitestmachine",
"displayName": "PhiTestMachine",
"dimensions": [
"CUSTOM_DEVICE"
],
"unit": "Count (count)",
"detailedSource": "API",
"types": [
"F5-Firewall"
],
"aggregationTypes": [
"AVG",
"SUM",
"MIN",
"MAX"
],
"filter": "CUSTOM"
}

- Next I create a custom device as the following: https://www.dynatrace.com/support/help/dynatrace-a...

entityAlias: PhiTestMachine

Body:

{
"displayName" : "F5 Firewall 24",
"ipAddresses" : ["172.16.115.211"],
"listenPorts" : ["9999"],
"type" : "F5-Firewall",
"favicon" : "http://assets.dynatrace.com/global/icons/f5.png",
"configUrl" : "http://192.128.0.1:8080",
"tags": [
"REST example"
],
"properties" : {
"Sample Property 1": "Sample value 1"
}
}

Response:

CUSTOM_DEVICE-75AB78865A2AF396

- Now I post a custom metric device as the following: https://www.dynatrace.com/support/help/dynatrace-a...

entityAlias: PhiTestMachine

Body:

{
"tags": [
"tag2"
],
"type": "F5-Firewall",
"properties" : {
"Sample Property 2": "Sample value 2"
},
"series" : [
{
"timeseriesId" : "custom:phitestmachine",
"dimensions" : {
"CUSTOM_DEVICE" : "macbook pro"
},
"dataPoints" : [
[ 1539860400000, 460 ],
[ 1539860460000, 456 ]
]
},
{
"timeseriesId" : "custom:phitestmachine",
"dimensions" : {
"CUSTOM_DEVICE" : "macbook pro"
},
"dataPoints" : [
[ 1539860430000, 439 ],
[ 1539860490000, 460 ]
]
}
]
}

Response:

{
"error": {
"code": 400,
"message": "Constraints violated.",
"constraintViolations": [
{
"path": "series[0].dimensions",
"message": "Dimensions don't match dimensions specified in configuration. No extra dimensions specified in configuration.",
"parameterLocation": "PAYLOAD_BODY",
"location": null
}
]
}
}

So I'm not sure what is the dimensions specified in configuration? The custom metric I post at the beginning returned object has dimensions key is " CUSTOM_DEVICE". Could you help me to have a look at this.

Thanks

 

2 REPLIES 2

wolfgang_beer
Dynatrace Leader
Dynatrace Leader

You don't have to specify the primary dimension, which is the custom device as you already have to put that id in the POST path. So just leave the dimensions set empty within your POST body.


Can you please advise with an example as to how I could go about omitting "primary dimension".


Featured Posts