I have been looking over the documentation for script items [ https://www.zabbix.com/documentation...emtypes/script ] and trying to implement an item for a while in different ways and feel I don't understand this at all.
In the documentation, parameters are made, but don't seem to be utilized IN the scripts (in this example, host isn't in the provided example script:
But the explanation of Parameters is:
In any case, my use case is I have a discovery rule, it generates three macros, and I would like to run a calculation on one of those macros for this items value.
Generates this error: Cannot execute script: ReferenceError: identifier 'mygreatvalue' undefined
Zabbix Version 5.4beta1
In the documentation, parameters are made, but don't seem to be utilized IN the scripts (in this example, host isn't in the provided example script:
Code:
Use the {HOST.CONN} macro as parameter value and get a response with expanded macro:[LIST][*]Create an item with type “Script”.[*]Create a parameter:[/LIST]
[I]Name:[/I] host
[I]Value:[/I] {HOST.CONN}[LIST][*]In the [I]Script[/I] field, enter the following code:[/LIST]
var request = new CurlHttpRequest(); return request.Post("https://postman-echo.com/post", JSON.parse(value));
| Specify the variables to be passed to the script as the attribute and value pairs. |
In any case, my use case is I have a discovery rule, it generates three macros, and I would like to run a calculation on one of those macros for this items value.
Code:
Name: Value Data
Type: Script
Key: some.unique.name
Prameters: { mygreatvalue : {#mygreatmacro} }
Script: return mygreatvalue <---- ? where I am lost
Zabbix Version 5.4beta1

Comment