Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filestat plugin reports file exists on permission denied #3037

Closed
lastsky opened this issue Jul 20, 2017 · 1 comment · Fixed by #3040
Closed

Filestat plugin reports file exists on permission denied #3037

lastsky opened this issue Jul 20, 2017 · 1 comment · Fixed by #3040
Milestone

Comments

@lastsky
Copy link

lastsky commented Jul 20, 2017

Bug report

filestat plugin not working

Relevant telegraf.conf (for any server - the same):

[[outputs.prometheus_client]]
  listen = "192.168.22.1:9126"

[[inputs.filestat]]
  files = ["/root/test.txt"]
  md5 = false
[[outputs.prometheus_client]]
  listen = "192.168.22.1:9126"

[[inputs.filestat]]
  files = ["/root/test.txt"]
  md5 = true

System info:

from: telegraf-1.2.1-1.x86_64
up to: telegraf-1.3.4-1.x86_64
any centos kernel.

% uname -a
Linux server1 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Steps to reproduce:

server1 % touch test.txt
server1 % ls test.txt 
test.txt
server2 % ls test.txt 
ls: cannot access test.txt: No such file or directory
monitoring % curl -s server1:9126/metrics | grep filestat_exists
# HELP filestat_exists Telegraf collected metric
# TYPE filestat_exists untyped
filestat_exists{file="/root/test.txt",host="server1"} 1

monitoring % curl -s server2:9126/metrics | grep filestat_exists
# HELP filestat_exists Telegraf collected metric
# TYPE filestat_exists untyped
filestat_exists{file="/root/test.txt",host="server2"} 1

Expected behavior:

As documented here:
https://github.com/influxdata/telegraf/tree/master/plugins/inputs/filestat

exists (int, 0 | 1)
size_bytes (int, bytes)
md5 (optional, string)

Actual behavior:

exist == 1 and it doesnt depends upon file presence
no size_bytes (expected: 0 bytes)
no md5 (expected: string)

Use case: [Why is this important (helps with prioritizing requests)]

I need:
monitor pid files presence
monitor lock files presence
monitor log files presense and size
monitor files changes
monitor unwanted special files presence

What I do: use telegraf
What colleagues think I do: developing something magic
What I actually do: writing ugly shell scripts :)

@danielnelson danielnelson changed the title filestat plugin not working Filestat plugin reports file exists on permission denied Jul 21, 2017
@danielnelson danielnelson added this to the 1.4.0 milestone Jul 21, 2017
@lastsky
Copy link
Author

lastsky commented Jul 22, 2017

@danielnelson Thank You! 👍 🤝

@danielnelson danielnelson modified the milestones: 1.3.5, 1.4.0 Jul 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants