Search code examples
zabbix

Executing a script from Zabbix Server with parameters


I have made some script that a zabbix user can run from the zabbix server.

I would like to know if it's possible to run a script (from Administration -> script) on zabbix server with filled parameters ?

For example I have the script "doSomething" in Zabbix server that launch a script localy, this script need 1 parameter that change every time. How can i do that ?

Thank you


Solution

  • From the documentation, the scripts defined in Administration -> scripts

    become available for execution by clicking on the host in various frontend locations (Dashboard, Problems, Latest data, Maps)

    You can supply parameters with macros:

    The following macros are supported in the commands: {HOST.CONN}, {HOST.IP}, {HOST.DNS}, {HOST.HOST}, {HOST.NAME}. If a macro may resolve to a value with spaces (for example, host name), don't forget to quote as needed. Since Zabbix 2.2, user macros are supported in script commands.

    You can define a user macro (ie: {$SOMEPARAM}) and use it as a param, but you need an external tool to redefine its value: it depends on what you are trying to achieve.