object discoveryrule.update(object/array lldRules)
Este método permite actualizar las reglas LLD existentes.
Este método solo está disponible para los tipos de usuario Administrador y Superadministrador. Los permisos para llamar al método se pueden revocar en la configuración del rol de usuario. Ver Roles de usuario para más información.
(object/array)
LLD rule properties to be updated.
The itemid
property must be defined for each LLD rule, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged.
Additionally to the standard LLD rule properties, the method accepts the following parameters.
Parameter | Type | Description |
---|---|---|
filter | object | LLD rule filter object to replace the current filter. |
preprocessing | array | LLD rule preprocessing options to replace the current preprocessing options. |
lld_macro_paths | array | LLD rule lld_macro_path options. |
overrides | array | LLD rule overrides options. |
(objeto)
Devuelve un objeto que contiene los ID de las reglas LLD actualizadas bajo la propiedad "itemids".
Add a filter so that the contents of the {#FSTYPE} macro would match the @File systems for discovery regexp.
Request:
{
"jsonrpc": "2.0",
"method": "discoveryrule.update",
"params": {
"itemid": "22450",
"filter": {
"evaltype": 1,
"conditions": [
{
"macro": "{#FSTYPE}",
"value": "@File systems for discovery"
}
]
}
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
Request:
{
"jsonrpc": "2.0",
"method": "discoveryrule.update",
"params": {
"itemid": "22450",
"lld_macro_paths": [
{
"lld_macro": "{#MACRO1}",
"path": "$.json.path"
}
]
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
Disable LLD trapping for discovery rule.
Request:
{
"jsonrpc": "2.0",
"method": "discoveryrule.update",
"params": {
"itemid": "28336",
"allow_traps": "0"
},
"id": 36,
"auth": "d678e0b85688ce578ff061bd29a20d3b"
}
Response:
Update an LLD rule with preprocessing rule “JSONPath”.
Request:
{
"jsonrpc": "2.0",
"method": "discoveryrule.update",
"params": {
"itemid": "44211",
"preprocessing": [
{
"type": "12",
"params": "$.path.to.json",
"error_handler": "2",
"error_handler_params": "5"
}
]
},
"auth": "700ca65537074ec963db7efabda78259",
"id": 1
}
Response:
Actualice una secuencia de comandos de regla LLD con una secuencia de comandos diferente y elimine los parámetros innecesarios que fueron utilizados por el script anterior.
Solicitud:
{
"jsonrpc": "2.0",
"method": "discoveryrule.update",
"params": {
"itemid": "23865",
"parameters": [],
"script": "Zabbix.Log(3, 'Log test');\nreturn 1;"
},
"auth": "700ca65537074ec963db7efabda78259",
"id": 1
}
Respuesta:
CDiscoveryRule::update() en ui/include/classes/api/services/CDiscoveryRule.php.