Counts lines in growing file and return metrics on STDOUT.
Use with execd
plugin.
Mainly because apache ReqPerSec from mod_status is totally useless.
Usage: telegraf-tailcount [options] file
Options:
-i int Interval in seconds (default 10)
-p int Peak interval in seconds (default 1)
-m string Measurement name (default 'tailcount')
-t string Comma-separated k=p pairs for tags (default 'file=<file>')
e.g.:
$ telegraf-tailcount -t foo=bar -i 10 -p 1 /tmp/log
tailcount,file=/tmp/log,foo=bar sum=31,max=5,min=1
tailcount,file=/tmp/log,foo=bar sum=35,max=6,min=1
...
- Interval is the metric output interval on STDOUT.
- Peak interval is the interval for which telegraf-tailcount will compute min, mean, median and max
So if you're looking at computing requests per second from an http log file, you'll want Peak interval to be 1.
Note that Interval must be a multiple of Peak interval, and both must be integers.
This tool is intended to be used with the
execd
telegraf plugin.
[[inputs.execd]]
command = ["telegraf-tailcount", "-t", "foo=bar", "-i", "10", "-p", "1", "/tmp/log"]
# the values below are the defaults and can be omitted
signal = "none"
restart_delay = "10s"
data_format = "influx"
telegraf-tailcount
outputs the following metrics:
sum
: number of lines read duringinterval
max
: maximum of lines read during apeakInterval
min
: minimum of lines read during apeakInterval
median
: median of lines read during apeakInterval
mean
: mean of lines read during apeakInterval