Available since version: 1.8
This function allows you to retrieve usermacro 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,
Parameter | Type | Description | Details |
---|---|---|---|
nodeids | array | Node IDs | |
groupids | array | Host Group IDs | |
hostids | array | Select all macros from the given hosts and templates. | |
templateids | array | Select all host macros from hosts that are linked to the given templates. | |
hostmacroids | array | Host Usermacro IDs | |
globalmacroids | array | Host Usermacro IDs | |
globalmacro | integer | Search only global macros | |
editable | integer | only with read-write permission. Ignored for SuperAdmins | |
filter | array | Optional filter by usermacro fields | |
search | array | Return user macros by any given usermacro object field pattern | |
startSearch | integer | Search usermacros field pattern only in start of the field | |
excludeSearch | integer | Exclude from result, usermacros by given field pattern | |
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 |
select_templates | string | Select templates | Values: shorten, refer, extend |
countOutput | integer | Count usermacros, return the number of usermacros found | |
preservekeys | integer | Return hash instead of array | Keys of hash are object IDs |
sortfield | string | Sort by usermacro field | Values: macro |
sortorder | string | Sort order | Values: ASC, DESC |
limit | int | max number of usermacro objects to return |
Parameter | Description |
---|---|
result | Operation successful. Result will contain array of Usermacro objects. |
error | In case of any errors |
Get host usermacros details by usermacro name "{$AAA}" in specified host groups ID "100100000000011","100100000000099","100100000010034":
{
"jsonrpc": "2.0",
"method": "usermacro.get",
"params": {
"groupids": ["100100000000011","100100000000099","100100000010034"],
"filter": {"macro": "{$AAA}"},
"output": "extend"
},
"auth": "6f38cddc44cfbb6c1bd186f9a220b5a0",
"id": 2
}
Retrieved host usermacro details: