Ad Widget

Collapse

File name with spaces in user defined parameter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cinic
    Junior Member
    • Oct 2012
    • 1

    #1

    File name with spaces in user defined parameter

    Hi,

    I've created user parameter that performs needed checks on file.
    FileName and 2 more additional parameters are passed to external program.
    Here is the definition of user parameter in zabbix_agentd.conf:
    UserParameter=fileAgeExt[*],c:\dev\fileAge\fileAgeExt.exe $1 $2 $3
    Note - 3 params expected: filename, timeFrom, timeTo.

    Here are contents of my check user parameter cmd file:
    zabbix_get -s 127.0.0.1 -p 10050 -k "fileAgeExt[\"c:/zabbix/test custom param.txt\",8:00:00,23:00:00]"

    PROBLEM: zabbix gives 5 params to the fileAgeExt.exe routine (file name is split by space into 3 params). Using double quotes doesn't help. Escaping them with "\" doesn't help too.

    Here is the log that lists params (put in []) passed to fileAgeExt.exe from the example above:
    [c:/zabbix/test][custom][param.txt][8:00:00][23:00:00]

    Ideas?
  • dirckcopeland
    Member
    • Oct 2013
    • 50

    #2
    Answer to File name with spaces in user defined parameter

    Cinic,
    I know it's been over a year since you posted this but I struggled with this as well and believe I found the answer.

    your user parameter in zabbix_agentd.conf:

    UserParameter=fileAgeExt[*],c:\dev\fileAge\fileAgeExt.exe $1 $2 $3

    it should have args inclosed in double quotes:

    UserParameter=fileAgeExt[*],c:\dev\fileAge\fileAgeExt.exe "$1" "$2" "$3"

    You do not need to escape the characters in the zabbix_get command

    That worked for me although I was usign a linux command, not DOS

    Comment

    Working...