This item type may be useful in data collection scenarios that require multiple steps or complex logic. As an example, a Script item can be configured to make an HTTP call, then process the data received in the first step in some way, and pass transformed value to the second HTTP call.
Script items are processed by Zabbix server or proxy pollers.
In the Type field of item configuration form select Script then fill out required fields.
All mandatory input fields are marked with a red asterisk.
The fields that require specific information for Script items are:
|Key||Enter a unique key that will be used to identify the item.|
|Parameters||Specify the variables to be passed to the script as the attribute and value pairs.
User macros are supported. To see which built-in macros are supported, do a search for "Script-type item" in the supported macro table.
The code has access to all parameters, it may perform HTTP GET, POST, PUT and DELETE requests and has control over HTTP headers and request body.
Time suffixes are supported, e.g. 30s, 1m.
Depending on the script it might take longer for the timeout to trigger.
Collect the content of https://www.example.com/release_notes:
Collect the content of a specific page and make use of parameters:
var obj = JSON.parse(value); var url = obj.url; var subpage = obj.subpage; var request = new HttpRequest(); return request.get(url + subpage);
Collect the content of both https://www.example.com and https://www.example.com/release_notes:
var request = new HttpRequest(); return request.get("https://www.example.com") + request.get("https://www.example.com/release_notes");
Add the "Log test" entry to the Zabbix server log and receive the item value "1" in return: