Zabbix Documentation 1.8

Sidebar

Table of Contents

get()

Available since version: 1.8
This function allows you to retrieve script details based on filtering options. All parameters are optional. If parameter is set in query this option counted as ON, except if parameter is equal to NULL.

Parameters

Parameter Type Description Details
nodeids array Node IDs
groupids array HostGroup IDs
hostids array Host IDs
scriptids array Script IDs
editable integer only with read-write permission. Ignored for SuperAdmins
filter array Optional filter by script fields
search string Return scripts by given script fields pattern
startSearch integer Search given patterns only in start of the field
excludeSearch integer Exclude from result scripts by given patterns
searchWildcardsEnabled integer Search pattern in whole field using wildcards 1 - enable, 0 - disable
output string Output options Values: shorten, refer, extend
select_groups string Select host groups Values: shorten, refer, extend
select_hosts string Select hosts Values: shorten, refer, extend
countOutput integer Count scripts, return number of scripts found
preservekeys integer Return hash instead of array Keys of hash are object IDs
sortfield string Sort by script field Values: scriptid, name
sortorder string Sort order Values: ASC, DESC
limit int max number of script objects to return

Returns

Parameter Description
result Operation successful. Result will contain array of Script objects.
error In case of any errors

Example

Get scripts details by script description pattern "Apache" and limit output to 10 scripts, return only script IDS:

{
       "jsonrpc":"2.0",
       "method":"script.get",
       "params":{
           "filter": {"name": "TEST"},
           "output": "extend",
           "limit": 1
       },
       "auth":"6f38cddc44cfbb6c1bd186f9a220b5a0",
       "id":2
       }

Retrieved scripts details:

{
       "jsonrpc":"2.0",
       "result":[{
           "groups":[{
               "groupid":"0"
           }],
           "scriptid":"100100000000006",
           "name":"TEST",
           "command":"\/bin\/ping -c 3 {HOST.CONN}",
           "host_access":"3",
           "usrgrpid":"100100000000002",
           "groupid":"0"
       }],
       "id":2
       }