triggerprototype.create

Description

object triggerprototype.create(object/array triggerPrototypes)

This method allows to create new trigger prototypes.

This method is only available to Admin and Super admin user types. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object/array) Trigger prototypes to create.

Additionally to the standard trigger prototype properties the method accepts the following parameters.

ParameterTypeDescription
dependenciesarrayTriggers and trigger prototypes that the trigger prototype is dependent on.

The triggers must have the triggerid property defined.
tagsarrayTrigger prototype tags.

The trigger expression has to be given in its expanded form and must contain at least one item prototype.

Return values

(object) Returns an object containing the IDs of the created trigger prototypes under the triggerids property. The order of the returned IDs matches the order of the passed trigger prototypes.

Examples

Creating a trigger prototype

Create a trigger prototype to detect when a file system has less than 20% free disk space.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "triggerprototype.create",
  4. "params": {
  5. "description": "Free disk space is less than 20% on volume {#FSNAME}",
  6. "expression": "last(/Zabbix server/vfs.fs.size[{#FSNAME},pfree])<20",
  7. "tags": [
  8. {
  9. "tag": "volume",
  10. "value": "{#FSNAME}"
  11. },
  12. {
  13. "tag": "type",
  14. "value": "{#FSTYPE}"
  15. }
  16. ]
  17. },
  18. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  19. "id": 1
  20. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "triggerids": [
  5. "17372"
  6. ]
  7. },
  8. "id": 1
  9. }

Source

CTriggerPrototype::create() in ui/include/classes/api/services/CTriggerPrototype.php.