manual:api:reference:host:get

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manual:api:reference:host:get [2020/03/06 11:22]
iivs added and fixed examples (ZBXNEXT-5694)
manual:api:reference:host:get [2021/01/28 15:46] (current)
Line 13: Line 13:
 The method supports the following parameters. The method supports the following parameters.
  
-^Parameter^Type^Description^+^Parameter^[[:​manual/​api/​reference_commentary#​data_types|Type]]^Description^
 |groupids|string/​array| Return only hosts that belong to the given groups. |  |groupids|string/​array| Return only hosts that belong to the given groups. | 
 |applicationids|string/​array| Return only hosts that have the given applications. | |applicationids|string/​array| Return only hosts that have the given applications. |
Line 392: Line 392:
 </​code>​ </​code>​
  
-Retrieve hosts that have "​Disaster"​ problems.+Retrieve hosts that have these tags not only on host level but also in their linked parent templates. 
 Request: Request:
 <code java> <code java>
Line 400: Line 401:
     "​params":​ {     "​params":​ {
         "​output":​ ["​name"​],​         "​output":​ ["​name"​],​
-        "severities": ​5+        "tags": ​[{"​tag":​ "​A",​ "​value":​ "​1",​ "​operator":​ "​0"​}],​ 
 +        "​inheritedTags":​ true
     },     },
     "​auth":​ "​038e1d7b1735c6a5436ee9eae095879e",​     "​auth":​ "​038e1d7b1735c6a5436ee9eae095879e",​
Line 413: Line 415:
     "​result":​ [     "​result":​ [
         {         {
-            "​hostid":​ "10160", +            "​hostid":​ "10623", 
-            "​name":​ "Zabbix server"+            "​name":​ "PC room 1" 
 +        }, 
 +        { 
 +            "​hostid":​ "​10601",​ 
 +            "​name":​ "​Office"
         }         }
     ],     ],
Line 421: Line 427:
 </​code>​ </​code>​
  
-Retrieve ​hosts that have "​Average" ​and "​High"​ problems.+=== Searching host with tags and template tags === 
 + 
 +Retrieve ​a host with tags and all tags that are linked to parent templates. 
 Request: Request:
 <code java> <code java>
Line 429: Line 438:
     "​params":​ {     "​params":​ {
         "​output":​ ["​name"​],​         "​output":​ ["​name"​],​
-        "severities": [34]+        "hostids":​ 10502, 
 +        "​selectTags": ["​tag"​"​value"​],​ 
 +        "​selectInheritedTags":​ ["​tag",​ "​value"​]
     },     },
     "​auth":​ "​038e1d7b1735c6a5436ee9eae095879e",​     "​auth":​ "​038e1d7b1735c6a5436ee9eae095879e",​
Line 442: Line 453:
     "​result":​ [     "​result":​ [
         {         {
-            "​hostid":​ "20170", +            "​hostid":​ "10502", 
-            "​name":​ "Database+            "​name":​ "Desktop", 
-        }, +            "​tags":​ [ 
-        +                { 
-            "hostid": "20183", +                    "​tag":​ "​A",​ 
-            "name": "workstation"+                    "​value":​ "​1"​ 
 +                ​} 
 +            ]
 +            "​inheritedTags":​ [ 
 +                ​
 +                    "tag": "B", 
 +                    "value": "2" 
 +                } 
 +            ]
         }         }
     ],     ],
Line 454: Line 473:
 </​code>​ </​code>​
  
-Retrieve hosts that have these tags not only on host level but also in their linked parent templates.+=== Searching hosts by problem severity === 
 + 
 +Retrieve hosts that have "​Disaster"​ problems. 
 Request: Request:
 <code java> <code java>
Line 462: Line 484:
     "​params":​ {     "​params":​ {
         "​output":​ ["​name"​],​         "​output":​ ["​name"​],​
-        "tags": ​[{"​tag":​ "​A",​ "​value":​ "​1",​ "​operator":​ "​0"​}],​ +        "severities": ​5
-        "​inheritedTags":​ true+
     },     },
     "​auth":​ "​038e1d7b1735c6a5436ee9eae095879e",​     "​auth":​ "​038e1d7b1735c6a5436ee9eae095879e",​
Line 476: Line 497:
     "​result":​ [     "​result":​ [
         {         {
-            "​hostid":​ "10623", +            "​hostid":​ "10160", 
-            "​name":​ "PC room 1" +            "​name":​ "Zabbix server"
-        }, +
-        { +
-            "​hostid":​ "​10601",​ +
-            "​name":​ "​Office"+
         }         }
     ],     ],
Line 488: Line 505:
 </​code>​ </​code>​
  
-Retrieve ​a host with tags and all tags that are linked to parent templates.+Retrieve ​hosts that have "​Average"​ and "​High"​ problems. 
 Request: Request:
 <code java> <code java>
Line 496: Line 514:
     "​params":​ {     "​params":​ {
         "​output":​ ["​name"​],​         "​output":​ ["​name"​],​
-        "hostids":​ 10502, +        "severities": [34]
-        "​selectTags": ["​tag"​"​value"​],​ +
-        "​selectInheritedTags":​ ["​tag",​ "​value"​]+
     },     },
     "​auth":​ "​038e1d7b1735c6a5436ee9eae095879e",​     "​auth":​ "​038e1d7b1735c6a5436ee9eae095879e",​
Line 511: Line 527:
     "​result":​ [     "​result":​ [
         {         {
-            "​hostid":​ "10502", +            "​hostid":​ "20170", 
-            "​name":​ "Desktop", +            "​name":​ "Database
-            "​tags":​ [ +        }, 
-                { +        
-                    "​tag":​ "​A",​ +            "hostid": "20183", 
-                    "​value":​ "​1"​ +            "name": "workstation"
-                ​} +
-            ]+
-            "​inheritedTags":​ [ +
-                ​+
-                    "tag": "B", +
-                    "value": "2" +
-                } +
-            ]+
         }         }
     ],     ],
Line 530: Line 538:
 } }
 </​code>​ </​code>​
- 
  
 ==== See also ==== ==== See also ====
Line 541: Line 548:
 ==== Source ==== ==== Source ====
  
-CHost::​get() in //frontends/​php/​include/​classes/​api/​services/​CHost.php//​.+CHost::​get() in //ui/​include/​classes/​api/​services/​CHost.php//​.