[ZBX-15756] regex inclusion match in vfs.dir.count not working Created: 2019 Mar 04  Updated: 2019 Mar 05  Resolved: 2019 Mar 05

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G), Frontend (F)
Affects Version/s: 4.0.4
Fix Version/s: None

Type: Incident report Priority: Minor
Reporter: Scott McGillivray Assignee: Zabbix Support Team
Resolution: Won't fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I have a directory structure like:

d:\directory\4567\file.name
d:\directory\1234\file.name
d:\directory\1\file.name

I want the regex to count the occurrences of "file.name" within sub-directories who's name length is > 1. So in the above example the count should be 2.

 

Here is what i tested with. 

 

This did not work/produce any count:

vfs.dir.count[d:\directory\, "\d{2,}\\file\.name"] 

 

This did not work either:

 

vfs.dir.count[d:\directory\, "\d{2,}"]

 

This worked but counted all contents of the directories.

 

vfs.dir.count[d:\directory\, "[0-9]{2,}"]

 

This did not work:

 

vfs.dir.count[d:\directory\, "[0-9]{2,}\\file\.name"]

 

This worked but gives me one more count than i want.

vfs.dir.count[d:\directory\, "file\.name"]

 

So can someone explain why the below examples don't work ?

"\d{2,}\\file\.name"
"[0-9]{2,}\\file\.name"

 

Thank you.



 Comments   
Comment by Glebs Ivanovskis [ 2019 Mar 04 ]

I believe by design pattern is simply applied to basename.

Comment by Arturs Lontons [ 2019 Mar 05 ]

Hi,

As Glebs said - by design the regex patter is applied to basename. As a workaround you could use an external script with your defined logic to count the occurrences of the file.name and pass it to a zabbix item.

In addition, you can create a Zabbix feature request containing a description of the requested logic and the use case you presented in this ticket.

Since this cannot be classified as a bug report, we will be closing this ticket. Feel free to use our forums or our IRC channel to further discuss the possible ways to define the requested logic within Zabbix.

Generated at Thu Apr 25 23:00:06 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.