Ad Widget

Collapse

Issue while running a custom alert script in Zabbix

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dgiripra
    Junior Member
    • Jun 2022
    • 2

    #1

    Issue while running a custom alert script in Zabbix

    Hi folks,

    I'm trying to send events from Zabbix to Kafka via Logstash using a custom alert script. I have defined a python script in the /usr/lib/zabbix/alertscripts folder. In the script parameters, I'm using a macro {ALERT.MESSAGE}. I'm trying to pass a custom message which I would like to receive in Kafka. But I'm facing a KeyError and unable to successfully run the python script.

    I have defined the Custom message in Configurations -> Actions -> Operations.

    Below is the Custom message I have used:
    [zabbix_data]
    message_type=default
    action_id={ACTION.ID}
    action_name={ACTION.NAME}
    date={DATE}
    esc_history={ESC.HISTORY}

    Error I'm getting is as below:
    Traceback (most recent call last):
    File "/usr/lib/zabbix/alertscripts/logstashAlerts.py", line 32, in <module>
    json_data = json.dumps(config._sections['zabbix_data'])
    KeyError: 'zabbix_data'

    On looking at the documentation, I see that
    {ALERT.MESSAGE} → Alert script parameters 'Default message' value from action configuration.
    Supported since 3.0.0.

    But I'm not able to find Default message in Zabbix 6 under Actions. Could anyone guide me to the right direction.

    Regards
    Divya
    Attached Files
Working...