MattHodge / Graphite-PowerShell-Functions

A group of PowerShell functions that allow you to send Windows Performance counters to a Graphite Server, all configurable from a simple XML file.
https://hodgkins.io/using-powershell-to-send-metrics-graphite
GNU General Public License v3.0
218 stars 71 forks source link

Send-GraphiteMetric does not work with -DateTime #59

Open SteveLowe opened 8 years ago

SteveLowe commented 8 years ago

The conversion from DateTime to Unix time is broken

>Send-GraphiteMetric -CarbonServer 127.0.0.1 -MetricPath 'test' -MetricValue 123 -DateTime (Get-Date)
Send-GraphiteMetric : Cannot convert value "24/05/2016 09:38:46" to type "System.UInt64". Error: "Invalid cast from
'DateTime' to 'UInt64'."
At line:1 char:1
+ Send-GraphiteMetric -CarbonServer 127.0.0.1 -MetricPath 'test' -Metri ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Send-GraphiteMetric], RuntimeException
    + FullyQualifiedErrorId : InvalidCastIConvertible,Send-GraphiteMetric