3

I'm having problems with vfs.file.exists on Zabbix 2.0.6 on a 64-bit Fedora 19 box. 2.0.6 is the latest version available from the Fedora yum repository, at the time of writing.

I want to check for the existence of the file /tmp/test:

[root@localhost ~]# ls -l /tmp/test
-rw-r--r-- 1 root root 14 Sep 16 10:30 /tmp/test

If I run I check directly with zabbix_agentd, it correctly determines that the file exists:

[root@localhost ~]# zabbix_agentd -t "vfs.file.exists[/tmp/test]"
vfs.file.exists[/tmp/test][/tmp/test]         [u|1]

However, if I use zabbix_get, it always returns 0, whether the file exists, or not:

[root@localhost log]# zabbix_get -s 127.0.0.1 -k "vfs.file.exists[/tmp/test]"
0

It's strange, because the same test works perfectly when connecting from the same server to a remote machine (also Fedora) running an older version of the Zabbix agent (1.8.13):

[root@localhost log]# zabbix_get -s remote.example.com -k "vfs.file.exists[/tmp/test]"
1

Some things will work:

[root@localhost ~]# zabbix_get -s 127.0.0.1 -k "system.uname"
Linux host.example.com 3.9.5-301.fc19.x86_64 #1 SMP Tue Jun 11 19:39:38 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# zabbix_get -s 127.0.0.1 -k "system.uptime"
237830
[root@localhost ~]# zabbix_get -s 127.0.0.1 -k "system.run[whoami]"
zabbix

AFAICT, though, all the vfs.file.* keys do not work:

[root@localhost ~]# zabbix_get -s 127.0.0.1 -k "vfs.file.cksum[/tmp/test]"
ZBX_NOTSUPPORTED
[root@localhost ~]# zabbix_get -s 127.0.0.1 -k "vfs.file.contents[/tmp/test]"
ZBX_NOTSUPPORTED
[root@localhost ~]# zabbix_get -s 127.0.0.1 -k "vfs.file.md5sum[/tmp/test]"
ZBX_NOTSUPPORTED
[root@localhost ~]# zabbix_get -s 127.0.0.1 -k "vfs.file.size[/tmp/test]"
ZBX_NOTSUPPORTED
[root@localhost ~]# zabbix_get -s 127.0.0.1 -k "vfs.file.time[/tmp/test]"
ZBX_NOTSUPPORTED

I have checked that the zabbix user can access that file, so its not a permissions issue:

[root@localhost ~]# sudo su -s /bin/bash zabbix
bash-4.2$ whoami
zabbix
bash-4.2$ ls -l /tmp/test
-rw-r--r-- 1 root root 14 Sep 16 10:30 /tmp/test

SELinux is also disabled.

Am I doing something wrong, or is this a bug in that particular version/distribution of Zabbix?

G Mawr
  • 173
  • 1
  • 3
  • 6

1 Answers1

2

On current versions of Fedora, the Zabbix agent, like many other system services, has a private namespaced /tmp and cannot see files in /tmp which are created by other processes. Since you're testing, try checking for the existence of a file in another directory.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940