Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 175326

vRops timestamp via API

$
0
0

Hi

 

Got an issue, posting data to vRops via vRops API. Basically I'm adding property data to "host system" objects. Data comes in, but the time is off, so it "takes" a few hours for data to appear. I'm using powershell to add the data.

 

Time is gather like this: $Epoc = [decimal]::Round((New-TimeSpan -Start (get-date -date "01/01/1970") -End (get-date).ToUniversalTime()).TotalMilliseconds) and is what i use to post with.

 

And I'm using this command to post data with: Invoke-RestMethod -Method Post -Body $Body -Uri "https://$vROps/suite-api/api/resources/$rsID/properties" -Credential $cred -ContentType "application/json"

 

An example of the body.

 

$body = @{

        "property-content" =

            @(

                @{

                "statKey"="Datastores|$($DS.DSName)|NAA"

                "timestamps"=@($Epoc)

                "values"=@("$($DS.Device)")

                }

            )

        } | ConvertTo-Json -Depth 3

 

 

An example of dates used and local time

 

PS > $epoc

1511531289041

 

PS > $date.AddMilliseconds($epoc)

24. november 2017 13:48:09

 

PS > Get-Date

24. november 2017 14:48:15

 

Data in vRops is timestamped at 15:13:08

 

So for some reason time is off by 2 hours and 25 minutes and I cant seem to figure out why   I'm guessing to could be a timezone issue, but that is why I'm using UTC time in the conversion.


Viewing all articles
Browse latest Browse all 175326

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>