Insert data InfluxDB -PRASE ERROR

Hi Team,
Getting below error while inserting data.

curl -i -XPOST ‘http://localhost:8086/write?db=nagflux’ --data-binary ‘metrics,host=eseemon70 service=Linux CPU check command=check_Linux crit=99,warn=95,max=100,min=0,value=2.87 1505131200’
HTTP/1.1 400 Bad Request
Content-Type: application/json
Request-Id: 48dcc6d9-3d5b-11e8-8b76-000000000000
X-Influxdb-Build: OSS
X-Influxdb-Error: unable to parse ‘metrics,host=eseemon70 service=Linux CPU check command=check_Linux crit=99,warn=95,max=100,min=0,value=2.87 1505131200’: invalid boolean
X-Influxdb-Version: 1.4.2
X-Request-Id: 48dcc6d9-3d5b-11e8-8b76-000000000000
Date: Wed, 11 Apr 2018 07:38:10 GMT
Content-Length: 166

{“error”:“unable to parse ‘metrics,host=eseemon70 service=Linux CPU check command=check_Linux crit=99,warn=95,max=100,min=0,value=2.87 1505131200’: invalid boolean”}

Hello @madhanika,

Where you able to find your resolution? If so can you share it here for the community?

I think the boolean error is coming from finding spaces in your write. Below is what I did to reproduce your situation with the fix I found to get the data in the database.

Testing

Stand up docker influxdb

docker run -d --rm --name=influxdb --log-driver=json-file -p 8086:8086 influxdb:1.4.2-alpine

Create database

curl --include -XPOST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE nagflux"

Send data to database

curl -i -XPOST 'http://localhost:8086/write?db=nagflux' --data-binary "metrics,host=eseemon70,service=Linux\ CPU\ check,command=check_Linux,crit=99,warn=95,max=100,min=0 value=2.87 1505131200"

Login to check out the data

docker exec -it influxdb sh

/ # influx
Connected to http://localhost:8086 version 1.4.2
InfluxDB shell version: 1.4.2

> use nagflux
Using database nagflux

> select * from metrics
name: metrics
time       command     crit host      max min service         value warn
----       -------     ---- ----      --- --- -------         ----- ----
1505131200 check_Linux 99   eseemon70 100 0   Linux CPU check 2.87  95

> show tag keys from metrics
name: metrics
tagKey
------
command
crit
host
max
min
service
warn

> show field keys from metrics
name: metrics
fieldKey fieldType
-------- ---------
value    float

Conclusion

I think getting your data to layout correctly when passing it into the InfluxDB write query is going to be key. Make sure to watch out for spaces. And… most likely, everything is a tag, value is a key, and timestamps are not “needed” to be passed… if one isn’t given it’ll use the server time.

I hope this helps or gives some direction,

Peter

1 Like

@Peter - Excellent! Its working:smiley:

Hello Peter,
Could you please help on the below -

export DBNAME=test_db
curl -is -XPOST “$DBURL/write?db=$DBNAME” --data-binary “metrics,host=eseemon70,service=Linux\ CPU\ check,command=check_Linux,crit=99,warn=95,max=100,min=0 value=2.87 1548288000”
HTTP/1.1 400 Bad Request
Content-Type: application/json
Request-Id: 9e63c751-2052-11e9-801b-42010a800002
X-Influxdb-Build: OSS
X-Influxdb-Error: partial write: points beyond retention policy dropped=1
X-Influxdb-Version: 1.7.3
X-Request-Id: 9e63c751-2052-11e9-801b-42010a800002
Date: Fri, 25 Jan 2019 03:38:02 GMT
Content-Length: 68

{“error”:“partial write: points beyond retention policy dropped=1”}
[psadm2@ps-elm bin]$ influx
Connected to http://localhost:8086 version 1.7.3
InfluxDB shell version: 1.7.3
Enter an InfluxQL query

USE test_db
Using database test_db
show shard groups
name: shard groups
id database retention_policy start_time end_time expiry_time


3 _internal monitor 2019-01-18T00:00:00Z 2019-01-19T00:00:00Z 2019-01-26T00:00:00Z
6 _internal monitor 2019-01-19T00:00:00Z 2019-01-20T00:00:00Z 2019-01-27T00:00:00Z
26 _internal monitor 2019-01-20T00:00:00Z 2019-01-21T00:00:00Z 2019-01-28T00:00:00Z
45 _internal monitor 2019-01-21T00:00:00Z 2019-01-22T00:00:00Z 2019-01-29T00:00:00Z
48 _internal monitor 2019-01-23T00:00:00Z 2019-01-24T00:00:00Z 2019-01-31T00:00:00Z
52 _internal monitor 2019-01-24T00:00:00Z 2019-01-25T00:00:00Z 2019-02-01T00:00:00Z
58 _internal monitor 2019-01-25T00:00:00Z 2019-01-26T00:00:00Z 2019-02-02T00:00:00Z
49 LINSERVER linux_Server 2019-01-23T03:00:00Z 2019-01-23T04:00:00Z 2019-01-26T04:00:00Z
50 LINSERVER linux_Server 2019-01-23T04:00:00Z 2019-01-23T05:00:00Z 2019-01-26T05:00:00Z
51 LINSERVER linux_Server 2019-01-23T05:00:00Z 2019-01-23T06:00:00Z 2019-01-26T06:00:00Z
53 LINSERVER linux_Server 2019-01-24T03:00:00Z 2019-01-24T04:00:00Z 2019-01-27T04:00:00Z
54 LINSERVER linux_Server 2019-01-24T04:00:00Z 2019-01-24T05:00:00Z 2019-01-27T05:00:00Z
59 test_db autogen 2019-01-21T00:00:00Z 2019-01-28T00:00:00Z 2019-02-11T00:00:00Z

show measurements
name: measurements
name


measure1

show field keys
name: measure1
fieldKey fieldType


value float

show retention policies
name duration shardGroupDuration replicaN default


autogen 336h0m0s 168h0m0s 1 true