Ad Widget

Collapse

Opsgenie integration fails when field has quotes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • guyisit
    Junior Member
    • Nov 2020
    • 3

    #1

    Opsgenie integration fails when field has quotes

    I am running Zabbix 5.0 on CentOS 7, and sending triggers to Opsgenie using actions that call the Send2Opsgenie utility.

    This works great most of the time, but when one of the fields I pass has the quote character ["], it breaks the command that the Action runs. Here's the Action:
    Code:
    /home/opsgenie/oec/opsgenie-zabbix/send2opsgenie -triggerName="{TRIGGER.NAME}" -triggerId="{TRIGGER.ID}" -triggerStatus="{TRIGGER.STATUS}" -triggerSeverity="{TRIGGER.SEVERITY}" -triggerDescription="{TRIGGER.DESCRIPTION}" -triggerUrl="{TRIGGER.URL}" -triggerValue="{TRIGGER.VALUE}" -triggerHostGroupName="{TRIGGER.HOSTGROUP.NAME}" -hostName="{HOST.NAME}" -ipAddress="{IPADDRESS}" -eventId="{EVENT.ID}" -date="{DATE}" -time="{TIME}" -itemKey='{ITEM.KEY}' -itemValue="{ITEM.VALUE}" -recoveryEventStatus="{EVENT.RECOVERY.STATUS}"
    As you can see, for each flag that's passed, the value is encapsulated in quotes. If the value also contains quotes, then that will end the flag early, and throw off the rest of the command.

    I opened a ticket with Opsgenie support, and they suggested I move from "double quotes" to 'single quotes'. The only option is that the values can contain either one, so neither is useful.

    My question is: Is there way for Zabbix to normalize the value's so that all double quotes are single quotes, or vice versa?

    Example: {TRIGGER.DESCRIPTION} is
    Code:
    The service "example service" has crashed unexpectedly.
    Zabbix would then change that to
    Code:
    The service 'example service' has crashed unexpectedly.
    That changed value would then be piped to the action command shown above- that way the single/ double quotes don't interfere with each out.
Working...