Ad Widget

Collapse

How to handle the ' character in a macro, that is used in an action.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • slappywhite
    Junior Member
    • Aug 2018
    • 1

    #1

    How to handle the ' character in a macro, that is used in an action.

    I have some actions calling an external script as an external operation. They are failing because the arguments to the action contain macros that have the ' character in them, for example {TRIGGER.DESCRIPTION}.

    So if the trigger description has text like "Don't be alarmed". and the external operation of the action is :
    echo '{TRIGGER.DESCRIPTION}' >> /tmp/logfile

    then the script will never be executed. The zabbix server log shows:
    sh: 1: Syntax error: Unterminated quoted string
    because the macro has the ' character in it.

    It would be handy if Zabbix had a way to filter out characters that could cause external commands to fail. I was wondering what the best practice is, other than just insuring that all configurations that might be expanded from macros do not have the ' character in them.

    Thanks.
Working...