I use input.exec plugin:
Input format = “json”
output format = “influx”
command = bash script to calculate free disk space and size of some directory
as below
…
#!/usr/bin/env bash
du -sm “${1}” | awk '{print "[ { “FreeSpacePerc”: “(10240 - $1)/10240”, “SizeDirMb”: “$1”, “mydir”: “”2"\" } ]";}'
...
When I run telegraf debug mode as:
...
root telegraf --debug --config /etc/telegraf/telegraf.conf --input-filter exec --test
…
It shows correct data with float and int values
…
du,mydir=/var/lib/influxdb/data FreeSpacePerc=0.996191,SizeDirMb=39 1604334765000000000
…
But in fact Influx stores the data like integers, incorrect:
…
influx >> select * from du
output:
time = 1604334765000000000, FreeSpacePerc = 1, SizeDirMb = 0, mydir = /var/lib/influxdb/data
…
What’s wrong with it? Does anybody know how to fix it? Any suggestions would be appreciate.