Ad Widget

Collapse

Is it possible to pass parameters to the global script when in the step of an action

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wangwang
    Junior Member
    • Oct 2023
    • 2

    #1

    Is it possible to pass parameters to the global script when in the step of an action

    I defined a global script and called it in a step of an action's operation, how could I pass parameter like {ITEM.NAME} or others custom parameters to the script?

    My zabbix version is 6.2.7 and I didn't find any input boxes for me to fill in the parameters​
  • ISiroshtan
    Senior Member
    • Nov 2019
    • 324

    #2
    {ITEM.NAME} is a macro. You can not pass value into it. Macros will be taken from item/trigger/event that generates a notification. This specific macro will be just replace with name of ITEM that is used in trigger generating alert.

    The common way to get done what you want is to define any extra information you need in tag on host or trigger(depending what level of granularity you want). And then in your notification message use it with macro {EVENT.TAGS.<tag name>}.

    Check out more information about macros, tags and notifications in Zabbix documentation.

    Comment

    • LogimaticUser
      Junior Member
      • Apr 2023
      • 1

      #3
      Did you find any solution to your problem?
      it looks like in the pervious version there were the Remote command option that dose not exist anymore:

      Create a Global Script:
      1. Go to "Configuration" > "Scripts" in the Zabbix web interface.
      2. Click on "Create script" and fill in the required fields.
        • Name: Enter a descriptive name for your script.
        • Type: Choose "Script" as the script type.
        • Command: Enter the actual script command with placeholders for arguments. For example
          /path/to/your/script.sh {ARG1} {ARG2}
      Create an Action:
      1. Go to "Configuration" > "Actions" in the Zabbix web interface.
      2. Click on "Create action" and fill in the required fields.
        • Name: Enter a name for your action.
        • Conditions: Define the conditions under which the action should be triggered.
        • Operations: Add a new operation.
          • Operation type: Choose "Remote command."
          • Target: Select "Host."
          • Type: Choose "Custom script."
          • Script name: Select the global script you created earlier from the dropdown list.
          • Script parameters: Enter the arguments you want to pass to the script, For example: argument1={HOSTNAME1} argument2={ITEM.VALUE1}
      ​But it dose not work anymore.
      ​​

      Comment

      Working...