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

Not sending metrics - Printing config file into verbose log as error #62

Closed OliPassey closed 8 years ago

OliPassey commented 8 years ago

So i had followed instructions and setup windows metrics being pumped into Hosted Graphite, it was installed as a service and all ran fine for 3 days. Someone restarted the service and now no metrics are making it to hosted graphite.

When i look into the powershell and run with verbose output i find that my config file is being printed out - rather than read and followed.

PS C:\Users\Administrator.FOE> Start-StatsToGraphite -verbose Cannot convert value "<?xml version="1.0" encoding="utf-8"?>

_REMOVED REST OF CONFIG FILE_ Getting errors like: " to type "System.Xml.XmlDocument". Error: "'<', hexadecimal value 0x3C, is an invalid attribute character. Line 65, position 3." At C:\Program Files\WindowsPowerShell\Modules\Graphite-PowerShell\Functions\Internal.ps1:33 char:5 - $xmlfile = [xml]([System.IO.File]::ReadAllText%28$configPath%29) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - CategoryInfo : InvalidArgument: (:) [], RuntimeException - FullyQualifiedErrorId : InvalidCastToXmlDocument The property 'Configuration' cannot be found on this object. Verify that the property exists. At C:\Program Files\WindowsPowerShell\Modules\Graphite-PowerShell\Functions\Internal.ps1:36 char:5 - $Config.CarbonServer = $xmlfile.Configuration.Graphite.CarbonServer - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - CategoryInfo : NotSpecified: (:) [], PropertyNotFoundException - FullyQualifiedErrorId : PropertyNotFoundStrict The property 'Configuration' cannot be found on this object. Verify that the property exists. At C:\Program Files\WindowsPowerShell\Modules\Graphite-PowerShell\Functions\Internal.ps1:37 char:5 Any idea what has happened?
MattHodge commented 8 years ago

I'd start looking at Telegraf, which provides a much nice way to send metrics than my PowerShell function: https://hodgkins.io/windows-metric-dashboards-with-influxdb-and-grafana