Skip to content

Improve handling of datetime and object properties #16

Description

@markwragg

some further suggestions from @Tonic8:

  • if a field in an object is a DateType, you can convert it in something InfluxDB will understand:
(dir | select -first1).lastWriteTime | gm
(dir | select -first1).lastWriteTime | get-date -f "yyyy-MM-dd HH:mm:ss.fff"
(dir | select -first1).lastWriteTime | convertTo-UnixTimeNanoseconds

where fff is millisecond, (talked here https://stackoverflow.com/questions/28589520/how-to-store-dates-in-influxdb) and here https://docs.influxdata.com/influxdb/v1.5/query_language/data_exploration/#time-syntax

  • if a field in an object is something not a "string" but a internal field, like this in Citrix sdk (extract of get-brokerSession | GM):
ConnectionViaIP   NoteProperty string ConnectedViaIP=1.2.3.4
ConnectionMode    NoteProperty Citrix.Broker.Admin.SDK.ConnectionMode ConnectionMode=Brokered
  • if you pass it, the conversion is going wrong(missing doublequote), user must prepare the field, to convert it as string, before passing it to convertTo-Metric
  • example with a Boolean field (it should have double-quote),
    $test = New-Object PSObject -Property @{testBoolean=$True}
  • below the result from the Write-Influx commande in Verbose
    Xendesktop,computer1 testBoolean=true 12345678898

Originally posted by @Tonic8 in #15 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions