Ad Widget

Collapse

bug in vfs.dir.count?

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rsokoll
    Junior Member
    • Jun 2018
    • 11

    #1

    bug in vfs.dir.count?

    Hi,

    I want to monitor the number of entries (files and folders) in /etc. To do so, I have an item with that key: vfs.dir.count[/etc,,^\..+\.sw?$,,,0,,,,] The regex ^\..+\.sw?$ should prevent swap files generated by vim from getting counted.
    However:
    Code:
    root@zabbix-server:/etc# zabbix_get -s localhost -k 'vfs.dir.count[/etc,,^\..+\.sw?$,,,0,,,,]'
    250
    root@zabbix-server:/etc# ls -A1 | wc -l
    250
    root@zabbix-server:/etc# touch .test.swp
    root@zabbix-server:/etc# ls -A1 | wc -l
    251
    root@zabbix-server:/etc# zabbix_get -s localhost -k 'vfs.dir.count[/etc,,^\..+\.sw?$,,,0,,,,]'
    251
    Do I misunderstand the documentation at https://www.zabbix.com/documentation...#vfs.dir.count - or is it really a bug?
    Both server and agent2 have version 7.0.16
    Last edited by rsokoll; 17-07-2025, 13:54.
  • Answer selected by rsokoll at 17-07-2025, 15:18.
    Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1781

    Your regex (part of it) is invalid for your purpose: "sw?$" matches strings that end with "s" or "sw" (does not match "swp"). Question mark means "zero or one of the previous character".

    I'm not familiar with vi swap file possible namings, but you maybe meant "sw.?$" (matches sw, swp, swa, ...)

    Markku
    Last edited by Markku; 17-07-2025, 14:02. Reason: Fixed the regex suggestion

    Comment


    • rsokoll
      rsokoll commented
      Editing a comment
      Oh my. Yes, you are correct. It was the missing "." in the regex.
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1781

    #2
    Your regex (part of it) is invalid for your purpose: "sw?$" matches strings that end with "s" or "sw" (does not match "swp"). Question mark means "zero or one of the previous character".

    I'm not familiar with vi swap file possible namings, but you maybe meant "sw.?$" (matches sw, swp, swa, ...)

    Markku
    Last edited by Markku; 17-07-2025, 14:02. Reason: Fixed the regex suggestion

    Comment


    • rsokoll
      rsokoll commented
      Editing a comment
      Oh my. Yes, you are correct. It was the missing "." in the regex.
Working...