Skip to content

Filestat plugin reports file exists on permission denied #3037

Closed
@lastsky

Description

@lastsky

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 :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions