Push linux sar data to influxdb


I am trying to push data from sar to the db. One of the commands i am using to push the data is as follows, can someone help me see what is wrong?

sar 1 1 -u | tail -n 1 | awk -v MYHOST=$(hostname) ‘{ print “cpu,host=“MYHOST” %usr=”$2",%nice="$3",%sys="$4",%idle="$5}’ | curl -i -XPOST “http://${INFLUX_SERVER}:8086/write?db=OSStat” -s --data-binary @-
HTTP/1.1 400 Bad Request
Content-Type: application/json
Request-Id: cff8513f-5d7e-11e8-803b-000000000000
X-Influxdb-Build: OSS
X-Influxdb-Error: unable to parse ‘cpu,host=hostname %usr=all,%nice=6.86,%sys=0.00,%idle=4.55’: invalid boolean
X-Influxdb-Version: 1.5.2
X-Request-Id: cff8513f-5d7e-11e8-803b-000000000000
Date: Tue, 22 May 2018 05:13:07 GMT
Content-Length: 119

{“error”:“unable to parse ‘cpu,host=hostname %usr=all,%nice=6.86,%sys=0.00,%idle=4.55’: invalid boolean”}


I think you just need some quotes on the %usr string field:

- cpu,host=hostname %usr=all,%nice=6.86,%sys=0.00,%idle=4.55
+ cpu,host=hostname %usr="all",%nice=6.86,%sys=0.00,%idle=4.55


Thanks , you got me on the right track. I had misaligned some items.