itemprototype.update

Leírás

object itemprototype.update(object/array itemPrototypes)

Ez a módszer lehetővé teszi a meglévő cikkprototípusok frissítését.

Ez a módszer csak az Admin és a Kiemelt rendszergazda számára érhető el felhasználói típusok. A metódus meghívására vonatkozó engedélyek felhasználói szerepkörben visszavonhatók beállítások. Lásd: User roles további információért.

Paraméterek

(objektum/tömb) Frissítendő elem prototípus tulajdonságai.

Az "itemid" tulajdonságot minden egyes cikk prototípushoz meg kell határozni, az összes többihez a tulajdonságok nem kötelezőek. Csak az átadott tulajdonságok frissülnek a többi változatlan marad.

A standard item prototype property, a metódus a következőket fogadja el paramétereket.

Paraméter Típus Leírás
preprocessing array Elem prototípus előfeldolgozás opciók a jelenlegi előfeldolgozási beállítások helyettesítésére.
tags array Elem prototípus címkék.

Visszatérési értékek

(object) A frissített elem azonosítóit tartalmazó objektumot ad vissza prototípusok az "itemids" tulajdonság alatt.

Példák

Egy cikk prototípusának felületének megváltoztatása

Módosítsa a felderített elemek által használt gazdagép felületet.

Kérés:

{
    "jsonrpc": "2.0",
    "method": "itemprototype.update",
    "params": {
        "itemid": "27428",
        "interfaceid": "132"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

Válasz:

{
    "jsonrpc": "2.0",
    "result": {
        "itemids": [
            "27428"
        ]
    },
    "id": 1
}

Update dependent item prototype

Update Dependent item prototype with new Master item prototype ID. Only dependencies on same host (template/discovery rule) are allowed, therefore Master and Dependent item should have same hostid and ruleid.

Request:

{
    "jsonrpc": "2.0",
    "method": "itemprototype.update",
    "params": {
        "master_itemid": "25570",
        "itemid": "189030"
    },
    "auth": "700ca65537074ec963db7efabda78259",
    "id": 1
}

Response:

{
    "jsonrpc": "2.0",
    "result": {
        "itemids": [
            "189030"
        ]
    },
    "id": 1
}

Update HTTP agent item prototype

Change query fields and remove all custom headers.

Request:

{
    "jsonrpc": "2.0",
    "method": "itemprototype.update",
    "params": {
        "itemid":"28305",
        "query_fields": [
            {
                "random": "qwertyuiopasdfghjklzxcvbnm"
            }
        ],
        "headers": []
    }
    "auth": "700ca65537074ec963db7efabda78259",
    "id": 1
}

Response:

{
    "jsonrpc": "2.0",
    "result": {
        "itemids": [
            "28305"
        ]
    },
    "id": 1
}

Updating item preprocessing options

Update an item prototype with item preprocessing rule “Custom multiplier”.

Request:

{
    "jsonrpc": "2.0",
    "method": "itemprototype.update",
    "params": {
        "itemid": "44211",
        "preprocessing": [
            {
                "type": 1,
                "params": "4",
                "error_handler": 2,
                "error_handler_params": "5"
            }
        ]
    },
    "auth": "700ca65537074ec963db7efabda78259",
    "id": 1
}

Response:

{
    "jsonrpc": "2.0",
    "result": {
        "itemids": [
            "44211"
        ]
    },
    "id": 1
}

Updating a script item prototype

Update a script item prototype with a different script and remove unnecessary parameters that were used by previous script.

Request:

{
    "jsonrpc": "2.0",
    "method": "itemprototype.update",
    "params": {
        "itemid": "23865",
        "parameters": [],
        "script": "Zabbix.Log(3, 'Log test');\nreturn 1;"
    },
    "auth": "700ca65537074ec963db7efabda78259",
    "id": 1
}

Response:

{
    "jsonrpc": "2.0",
    "result": {
        "itemids": [
            "23865"
        ]
    },
    "id": 1
}

Forrás

CItemPrototype::update() in ui/include/classes/api/services/CItemPrototype.php.