Telegraf log showing "Error in plugin: metric parse error: expected field at"

The python script will print the following line protocol output

NPM_Port,Network=n1,Name=port1,Device_Category=Firewall,Tstatus=Up status=“Up”,inUtil=0.0000,outUtil=0.0000,number=3i,type=“Ethernet”,speed=10000000000.0000,mtu=1500i,InBandwidth=10000000000.0000,OutBandwidth=10000000000.0000,outBps=263.9062,inBps=505.8402,bps=769.7463,outPps=0.7633,inPps=0.8366,inPktSize=76.0000,outPktSize=43.0000,outUcastPps=0.0100,outMcastPps=0.7533,inUcastPps=0.0067,inMcastPps=0.8300 1671528569000000000

Using influx -import -path=datarrr.txt -precision=ns to import manually has no issues.

However using telegraf exe plugin to run the script will result in the following error
Error in plugin: metric parse error: expected field at

Checked the telegraf log,
the auto generated output by telegraf seem to be the following
NPM_Port,Network=n1,Name=port1,Device_Category=Firewall,Tstatus=Up status=\ “Up”,mtu=1500i,InBandwidth=2000000000.0000,OutBandwidth=2000000000.0000,outBps=2050.1516,inBps=2107.7522,bps=4157.9040,outPps=2.0667,inPps=2.1867,inPktSize=120.0000,outPktSize=124.0000,outUcastPps=2.0667,outMcastPps=0.0000,inUcastPps=2.1200,inMcastPps=0.0667 1671527674000000000

Seem like \ is causing the issues.
status= \ “Up”

How do I resolve this? Do I need to change the telegraf settings?
I have tried changing the data_format from “influx” to “value” but to no avail.

Hello @khaleef,
Yes my guess is that your python script is inserting a space. Can you check your python script to see if that’s the case? Maybe using print (string.isspace())?
Thank you.

Hi thanks for replying,

The telegraf complained output is status=backslash"Up"
i cant seem to post \ without the space in forum as such i added the space in between the status=\space"Up". the actually telegraf complained output is without the space.

I will try checking using the function isspace()

Background info: no metric error using telegraf 1.5 however 1.6…1.24 onwards complained of this metric issue

Found that the double quote and the telegraf parser having issues

Seem like string field value “” will get converted to

backslash" in telegraf and influxdb will complain of metric issues.

anyone have a solution for this?