PowerShell-Influx icon indicating copy to clipboard operation
PowerShell-Influx copied to clipboard

Tag with single \ ends up with \\\\ and invalid tag format?

Open MrDibbley opened this issue 3 years ago • 1 comments

reading vmware guest disk space and returing free / used space along with tagging vm name and drive path

example drive path is C:\ being returned from vmware, but when calling Write-Influx verbose shows Path=C:\\ now and when invoke-restmethod is called its is now c:\\ and flags invalid tag format\nunamble to parse

i can kind of fudge it by adding a white space after the path, but then they all end up in influx as C:\\ and not C:\

Thanks

MrDibbley avatar Jun 27 '22 12:06 MrDibbley

I am seeing this too with a backslash in the tag value.

$datasourceName = "J:\"

ConvertTo-InfluxLineString returns:

datasources,dataSourceId=50e028f8-39e7-4c9d-a1f2-da779c8f1726,datasourceName=J:\\,fullName=Userdata-zeus-J:,protectionGroupName=Userdata replicaUsedSpace=255850815488,oldestDiskRecoveryPointTime="2023-08-22T10:09:14.000Z",alertCount=0,latestDiskRecoveryPointTime="2023-09-04T18:13:53.000Z",latestRecoveryPointTime="2023-09-04T18:13:53.000Z",state="Valid",activity="Idle",age=8321.272957,replicaSize=373062369280

Sending the same objects results in:

Invoke-RestMethod : {"code":"invalid","message":"unable to parse 'datasources,datasourceName=J:\\\\,protectionGroupName
=Userdata,fullName=Userdata-zeus-J:,dataSourceId=50e028f8-39e7-4c9d-a1f2-da779c8f1726 ...

andrasg avatar Sep 04 '23 18:09 andrasg