integer/array script.get(object parameters)
The method allows to retrieve scripts according to the given parameters.
(object)
Parameters defining the desired output.
The method supports the following parameters.
Parameter | Type | Description |
---|---|---|
groupids | string/array | Return only scripts that can be run on the given host groups. |
hostids | string/array | Return only scripts that can be run on the given hosts. |
scriptids | string/array | Return only scripts with the given IDs. |
usrgrpids | string/array | Return only scripts that can be run by users in the given user groups. |
selectGroups | query | Return host groups that the script can be run on in the groups property.Does not support shorten or arrays of properties. |
selectHosts | query | Return hosts that the script can be run on in the hosts property.Does not support shorten or arrays of properties. |
sortfield | string/array | Sort the result by the given properties. Possible values are: scriptid and name . |
countOutput | flag | These parameters being common for all get methods are described in detail on the Generic Zabbix API information page. |
editable | boolean | |
excludeSearch | flag | |
filter | object | |
limit | integer | |
nodeids | string/array | |
output | query | |
preservekeys | flag | |
search | object | |
searchByAny | boolean | |
searchWildcardsEnabled | boolean | |
sortorder | string/array | |
startSearch | flag |
(integer/array)
Returns either:
countOutput
parameter has been used.Retrieve all configured scripts.
Request:
{
"jsonrpc": "2.0",
"method": "script.get",
"params": {
"output": "extend"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": [
{
"scriptid": "1",
"name": "Ping",
"command": "/bin/ping -c 3 {HOST.CONN} 2>&1",
"host_access": "2",
"usrgrpid": "0",
"groupid": "0",
"description": "",
"confirmation": "",
"type": "0",
"execute_on": "1"
},
{
"scriptid": "2",
"name": "Traceroute",
"command": "/usr/bin/traceroute {HOST.CONN} 2>&1",
"host_access": "2",
"usrgrpid": "0",
"groupid": "0",
"description": "",
"confirmation": "",
"type": "0",
"execute_on": "1"
},
{
"scriptid": "3",
"name": "Detect operating system",
"command": "sudo /usr/bin/nmap -O {HOST.CONN} 2>&1",
"host_access": "2",
"usrgrpid": "7",
"groupid": "0",
"description": "",
"confirmation": "",
"type": "0",
"execute_on": "1"
}
],
"id": 1
}
CScript::get() in frontends/php/api/classes/CScript.php.