Ad Widget

Collapse

Script Parameters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • iflann01
    Junior Member
    • Jun 2015
    • 4

    #1

    Script Parameters


    TIA

    I added a custom script for notifications. I don't seem to be able to use the regular list of macros like {HOST.NAME1}. Can I only use the ALERT items only? I really need just need to get the device name, event type and time of the event.
    Add command-line parameters to the script.
    {ALERT.SENDTO}, {ALERT.SUBJECT} and {ALERT.MESSAGE} macros are supported in script parameters.
    Customizing script parameters is supported since Zabbix 3.0.
  • aigars.kadikis
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2018
    • 208

    #2
    Hi, iflann01!

    Yes, by following documentation rules then only {ALERT.SENDTO}, {ALERT.SUBJECT}, {ALERT.MESSAGE} can be used as alert script arguments.

    As an workaround it is possible to EnableRemoteCommands=1 at Zabbix Agent on Zabbix Server and point the other arguments to cutom script.
    {HOST.NAME1}, {TRIGGER.STATUS} works well there. And if you want to include device name you have to configure it to show in {TRIGGER.NAME}.
    Click image for larger version

Name:	action-to-send-email.png
Views:	4664
Size:	189.0 KB
ID:	356879

    Here is the snipped I tested with:
    Code:
    cat >> /tmp/operation.log << EOF
    {EVENT.TIME} {HOST.NAME1} {TRIGGER.STATUS}
    {TRIGGER.NAME}
    {ITEM.VALUE1}
    =============================
    EOF
    Remember it to include in both [Operations] and [Recovery operations] section.

    Regards,
    Aigars

    Comment

    Working...