VMware Cloud Community
HariR
Contributor
Contributor
Jump to solution

Pushing non vSphere data to VROPs using Rest API

Hi Guys,

We had a script to push non-vSphere data to VROPS. It was using HTTP post method before.

Here is how the graph used to look like when we check metrics

pastedImage_0.png

But then we changed our scripts to use REST API calls instead of HTTP post.

Below is a sample JSON to post data.

{

"stat-content" : [ {

"statKey" : "DB01|Pefdata",

"timestamps" : [ 1512616054866 ] ,

"values" : [ 12.2 ],

"others" : [ ],

"otherAttributes" :{

}

} ]

}

It its posting data with no issues. But the graphs looks different now.

pastedImage_1.png

Let me know if I am missing something in my JSON format.

Reply
0 Kudos
1 Solution

Accepted Solutions
jasnyder
Hot Shot
Hot Shot
Jump to solution

I was able to replicate your issue and figured out it's because you are providing the stats using the "values" member instead of the "data" member.  When provided using "values" it is plotting the points as individual points instead of a line.  If you provide it as "data" instead, it will connect the dots and form a line:

pastedImage_6.png

Difference in payloads (underlined and bolded) - the first one forms some points on the top:

{

  "stat-content" : [ {

    "statKey" : "test|testKey",

    "timestamps" : [ 1513203622801,

1513203322801,

1513203022801,

1513202722801,

1513202422801,

1513202122801,

1513201822801,

1513201522801,

1513201222801,

1513200922801],

    "data" : [ 2,3,0,15,3,5,8,4,1,6 ],

    "others" : [ ],

    "otherAttributes" : {

    }

  }

]

}

The same thing but using the "values" member, to create some points on the bottom image:

{

  "stat-content" : [ {

    "statKey" : "test|testKeyValues",

    "timestamps" : [ 1513203622801,

1513203322801,

1513203022801,

1513202722801,

1513202422801,

1513202122801,

1513201822801,

1513201522801,

1513201222801,

1513200922801],

    "values" : [ 2,3,0,15,3,5,8,4,1,6 ],

    "others" : [ ],

    "otherAttributes" : {

    }

  }

]

}

So I think if you just change it from "values" to "data" it will display as you intended.

View solution in original post

Reply
0 Kudos
2 Replies
jasnyder
Hot Shot
Hot Shot
Jump to solution

I was able to replicate your issue and figured out it's because you are providing the stats using the "values" member instead of the "data" member.  When provided using "values" it is plotting the points as individual points instead of a line.  If you provide it as "data" instead, it will connect the dots and form a line:

pastedImage_6.png

Difference in payloads (underlined and bolded) - the first one forms some points on the top:

{

  "stat-content" : [ {

    "statKey" : "test|testKey",

    "timestamps" : [ 1513203622801,

1513203322801,

1513203022801,

1513202722801,

1513202422801,

1513202122801,

1513201822801,

1513201522801,

1513201222801,

1513200922801],

    "data" : [ 2,3,0,15,3,5,8,4,1,6 ],

    "others" : [ ],

    "otherAttributes" : {

    }

  }

]

}

The same thing but using the "values" member, to create some points on the bottom image:

{

  "stat-content" : [ {

    "statKey" : "test|testKeyValues",

    "timestamps" : [ 1513203622801,

1513203322801,

1513203022801,

1513202722801,

1513202422801,

1513202122801,

1513201822801,

1513201522801,

1513201222801,

1513200922801],

    "values" : [ 2,3,0,15,3,5,8,4,1,6 ],

    "others" : [ ],

    "otherAttributes" : {

    }

  }

]

}

So I think if you just change it from "values" to "data" it will display as you intended.

Reply
0 Kudos
HariR
Contributor
Contributor
Jump to solution

Thanks!

Reply
0 Kudos