Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-25387

triggerprototype.get API allows cross-use of hostids and templateids parameters

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Won't fix
    • Icon: Trivial Trivial
    • None
    • 6.0.35rc1, 7.0.5rc1, 7.2.0alpha1
    • API (A)
    • None

      Triggerprototype.get API request has two optional parameters: hostids and templateids. The documentation says that both parameters return trigger prototypes that belong only to hosts/templates. In practice, I can get template triggers using the template ID while specifying the hostids key, and vice versa (host ID using the templateids key).

      Steps to reproduce:

      1. Create new host with LLD and trigger prototype,
      2. Send triggerprototype.get request using just created Host ID and templateids key:
      {    
          "jsonrpc": "2.0",    
          "method": "triggerprototype.get",    
          "params": {        
              "output": "extend",
              "selectFunctions": "extend",        
              "templateids": [10636]  // host ID    
           },    
           "id": 1
      } 

      Result:
      You will get just created host trigger prototype:

      {
          "jsonrpc": "2.0",
          "result": [
              {
                  "triggerid": "23798",
                  "expression": "{33950}<>0",
                  "description": "trigger prototype {#ID}",
                  "url": "",
                  "status": "0",
                  "value": "0",
                  "priority": "0",
                  "lastchange": "0",
                  "comments": "",
                  "error": "",
                  "templateid": "0",
                  "type": "0",
                  "state": "0",
                  "flags": "2",
                  "recovery_mode": "0",
                  "recovery_expression": "",
                  "correlation_mode": "0",
                  "correlation_tag": "",
                  "manual_close": "1",
                  "opdata": "",
                  "discover": "0",
                  "event_name": "",
                  "uuid": "",
                  "url_name": "",
                  "functions": [
                      {
                          "functionid": "33950",
                          "itemid": "47584",
                          "triggerid": "23798",
                          "parameter": "$",
                          "function": "last"
                      }
                  ]
              }
          ],
          "id": 1
      } 

      Expected:
      Empty response:

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

       

      Documentation link - triggerprototype.get   

       

            zabbix.dev Zabbix Development Team
            dponomarenko Deniss Ponomarenko
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: