Ad Widget

Collapse

pass folder path to zabbix windows agent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • orionweb
    Junior Member
    • Feb 2010
    • 17

    #1

    pass folder path to zabbix windows agent

    I'm creating a UserParameter item to cont the number of files in a folder. I need to then pass this item the folder path where to count the file. However I'm not able to do this as what I'm passing appears to be cut off.

    Example:

    Code:
    UserParameter=file.countfiles_by_extention[*],dir /b $1\*.$2 | find /c /v "~~~"
    I then config in the item:
    Code:
    file.countfiles_by_extention[C:/Applications/images,jpg,150KB]
    I test using zabbix_get and got the below error:
    Code:
    Parameter format not correct - "pplications".
    It appears that the forward slashes are causing issue so the zabbix agent cannot get the full data I'm passing.

    What I am I doing wrong?
  • BrandStorm
    Junior Member
    • May 2009
    • 7

    #2
    You should use double slashes "C://Application//images" as a symbol after single slash is translated as special symbol.

    Comment

    • orionweb
      Junior Member
      • Feb 2010
      • 17

      #3
      Thank you, that worked

      In case it may be useful to others

      My zabbix config file looks like
      Code:
      UserParameter=file.count_by_extention[*],powershell.exe -Command "@(get-ChildItem -path "$1\*.$2" -recurse -ErrorAction "SilentlyContinue").count"
      UserParameter=file.count_by_extention_and_size_greater_than[*],powershell.exe -Command "@(get-ChildItem -path "$1\*.$2" -recurse -ErrorAction "SilentlyContinue" | where-Object {$_.Length -gt $3}).count"
      The items looks like
      Code:
      file.count_by_extention[D://Applications//images,jpg]
      file.count_by_extention_and_size_greater_than[D://Applications//images,jpg,250KB]
      The item will return number of files found or 0 if none found

      Comment

      Working...