Ad Widget

Collapse

Action message as JSON string

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aperture-Development
    Junior Member
    • May 2019
    • 6

    #1

    Action message as JSON string

    Hello everyone,

    Since a few days I am trying to link Zabbix to our Discord server, to post status updates and such directly to a Discord channel, for that I am using a self written bash script. Now to get the variables into the script, I am trying to use the action message as JSON parameter for the script, the issue is sadly that somehow I can't bypass the string as json, it errors out and prevents loading the json into bash variables. My current guess would be that Zabbix bypasses a escaped parameter, I honestly dont know.

    Here are my Monitor informations:
    OS: Debian 9.8 Stretch
    Zabbix Version: 4.2.1

    Here what I put as action message:

    Code:
    "{\"msg\":\"Problem started at {EVENT.TIME} on {EVENT.DATE}\nProblem name: {EVENT.NAME}\nHost: {HOST.NAME}\nSeverity: {EVENT.SEVERITY}\n\nOriginal problem ID: {EVENT.ID}\n{TRIGGER.URL}\",\"ack\":\"{EVENT.ACK.STATUS}\",\"sev\":{TRIGGER.NSEVERITY},\"status\":\"{TRIGGER.STATUS}\"}"
    Also running the script directly with that string does work and causes no errors, so it has to have something to do how Zabbix bypasses Parameters

    Did somebody else attempted something like this ( json as message ) and could help me out by telling me how they fixed the issue?

    Thank you for reading this,
    ApDev

    PS:
    Before I tried to use script parameters in media types directly, but sadly that just supports 3 macros, so now I gotta improvise
  • sachinkhanna48
    Banned
    • May 2018
    • 1

    #2
    Originally posted by Aperture-Development
    Hello everyone,

    Since a few days I am trying to link Zabbix to our Discord server, to post status updates and such directly to a Discord channel, for that I am using a self written bash script. Now to get the variables into the script, I am trying to use the action message as JSON parameter for the script, the best washing machine in india issue is sadly that somehow I can't bypass the string as json, it errors out and prevents loading the json into bash variables. My current guess would be that Zabbix bypasses a escaped parameter, I honestly dont know.

    Here are my Monitor informations:
    OS: Debian 9.8 Stretch
    Zabbix Version: 4.2.1

    Here what I put as action message:

    Code:
    "{\"msg\":\"Problem started at {EVENT.TIME} on {EVENT.DATE}\nProblem name: {EVENT.NAME}\nHost: {HOST.NAME}\nSeverity: {EVENT.SEVERITY}\n\nOriginal problem ID: {EVENT.ID}\n{TRIGGER.URL}\",\"ack\":\"{EVENT.ACK.STATUS}\",\"sev\":{TRIGGER.NSEVERITY},\"status\":\"{TRIGGER.STATUS}\"}"
    Also running the script directly with that string does work and causes no errors, so it has to have something to do how Zabbix bypasses Parameters

    Did somebody else attempted something like this ( json as message ) and could help me out by telling me how they fixed the issue?

    Thank you for reading this,
    ApDev

    PS:
    Before I tried to use script parameters in media types directly, but sadly that just supports 3 macros, so now I gotta improvise
    Hello forum Admin I have same problem please help me
    Last edited by sachinkhanna48; 03-06-2019, 19:31.

    Comment

    • virendra
      Junior Member
      • Feb 2020
      • 1

      #3
      Originally posted by Aperture-Development
      Hello everyone,

      Since a few days I am trying to link Zabbix to our Discord server, to post status updates and such directly to a Discord channel, for that I am using a self written bash script. Now to get the variables into the script, I am trying to use the action message as JSON parameter for the script, the issue is sadly that somehow I can't bypass the string as json, it errors out and prevents loading the json into bash variables. My current guess would be that Zabbix bypasses a escaped parameter, I honestly dont know.

      Here are my Monitor informations:
      OS: Debian 9.8 Stretch
      Zabbix Version: 4.2.1

      Here what I put as action message:

      Code:
      "{\"msg\":\"Problem started at {EVENT.TIME} on {EVENT.DATE}\nProblem name: {EVENT.NAME}\nHost: {HOST.NAME}\nSeverity: {EVENT.SEVERITY}\n\nOriginal problem ID: {EVENT.ID}\n{TRIGGER.URL}\",\"ack\":\"{EVENT.ACK.STATUS}\",\"sev\":{TRIGGER.NSEVERITY},\"status\":\"{TRIGGER.STATUS}\"}"
      Also running the script directly with that string does work and causes no errors, so it has to have something to do how Zabbix bypasses Parameters

      Did somebody else attempted something like this ( json as message ) and could help me out by telling me how they fixed the issue?

      Thank you for reading this,
      ApDev

      PS:
      Before I tried to use script parameters in media types directly, but sadly that just supports 3 macros, so now I gotta improvise
      Facing Same Issuies Help me to solve my problem.

      Comment

      Working...