Tracking modify file

influxdb
telegraf
grafana

#1

Hey,

I’m trying to track down when a file is changed. It’s for this reason I start to use inputs.filestat with this configuration :

My inputs.conf :

[[inputs.filestat]]
files = ["/folder/myFile*.log"]

So I have access to the modification date. But in Grafana, I am obliged to set the trigger value of the alert while I will like compared with my value n-1. Then, I wanted to make the substract between two queries.

query A : SELECT sum(“modification_time”) FROM “filestat” WHERE (“host” = ‘my_server’) AND $timeFilter GROUP BY time($interval)

query B : SELECT sum(“modification_time”) FROM “filestat” WHERE (“host” = ‘my_server’) AND $timeFilter GROUP BY time($__interval) fill(previous)

I juste want A - B and in this case, I can create an alert if result aren’t 0. But I tried some request
and none works…

I’m running centos 7 and Telegraf v1.5.0 (git: release-1.5 a1668bbf) and use Graph panel in Grafana


#2

I don’t see but there is difference in SELECT… So it’s almost ok