[ZBX-20026] vfs.dir.count key reach timeout while ls works fast. Created: 2021 Sep 29  Updated: 2022 Mar 30  Resolved: 2022 Mar 30

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Documentation (D)
Affects Version/s: 5.0.15
Fix Version/s: 6.2 (plan)

Type: Documentation task Priority: Trivial
Reporter: Andrei Gushchin (Inactive) Assignee: Sergey Simonenko (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
Story Points: 0.1

 Description   

Steps to reproduce:
Zabbix agent 5.0.9
check dir count for some cifs directory:

bash$ zabbix_agentd -t vfs.dir.count[/TEST,,,"file,dir",,0]
vfs.dir.count[/TEST,,,file,dir,,0] [m|ZBX_NOTSUPPORTED] [Timeout while waiting for data.]

Result:

  • always reaching timeout

Expected:
at the same time ls with wc works perfect and fast:

bash$ time ls -al /TEST | wc -l
28
real 0m0.053s
user 0m0.003s
sys 0m0.005s


 Comments   
Comment by Sergey Simonenko (Inactive) [ 2021 Dec 22 ]

Item key escaping for zabbix_agentd (or zabbix_get) in command-line is wrong here. "file" and "dir" get treated as separate parameters and as a result 5th parameter (maximum depth) is empty and assumed to be "-1 (default) - unlimited" (please see https://www.zabbix.com/documentation/current/en/manual/config/items/itemtypes/zabbix_agent) (which of course would time out because of network filesystem performance).

The proper use from command-line should be as below:

$ zabbix_agentd -t vfs.dir.count[/mnt/test,,,\"file,dir\",,0]
 [u|83]

Or:

$ zabbix_agentd -t 'vfs.dir.count[/mnt/test,,,"file,dir",,0]'
 [u|83]

Double quotes are considered by POSIX-defined shell implementations as a special character that is used to preserve literal value enclosed within them:
https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html

You don't need that when creating items or trigger in Zabbix frontend though as this is only a shell restriction, not unique to Zabbix and is not related to Zabbix. The double quotes are not part of the item key unless escaped (they're trimmed by the shell otherwise).

We will mention this in the relevant section of the documentation to avoid confusion.

Comment by Sergey Simonenko (Inactive) [ 2021 Dec 23 ]

Documentation updated:

Generated at Tue Apr 29 08:26:24 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.