ZABBIX Forums  
  #1  
Old 07-02-2012, 22:53
akushner akushner is offline
Junior Member
 
Join Date: Feb 2012
Posts: 4
Default JSON API output filter

From zabbix API documentation:

Get methods output parameter

Output can be “shorten”, “refer”, “extend” and array of db field names.

-shorten: only ids of elements are returned. (for hosts it's hostid, for items itemid etc)
-refer: element ids are returned with element ids that were used in query.
For example request item.get(output: refer, hostids: [1,2,3])) will return items with itemids and hostids.
-extend: all db fields of element are returned (select *)
-array of db fields: listed db fields are returned


What is the correct format to pass an array of db fields? I have tried the following:

Code:
{
   "id":"1",
   "method":"item.get",
   "params":
   {
	"search":{"description":"Comp."},
	"seachWildcardsEnabled":"1",
	"output":["lastvalue","lastclock","host"]
   },
   "jsonrpc":"2.0",
   "auth":"045fe742cf405bb83281bff2567b1eef"
}
but this only returns the itemids

Code:
{
   "jsonrpc":"2.0",
   "result":[
      {"itemid":"22319"},
      {"itemid":"22318"},
      {"itemid":"22328"},
      {"itemid":"22330"},
      {"itemid":"22332"},
      {"itemid":"22334"},
      {"itemid":"22336"},
      {"itemid":"22338"},
      {"itemid":"22324"},
      {"itemid":"22326"},
      {"itemid":"22325"},
      {"itemid":"22327"},
      {"itemid":"22329"},
      {"itemid":"22331"},
      {"itemid":"22333"},
      {"itemid":"22335"},
      {"itemid":"22337"},
      {"itemid":"22339"}],
   "id":"1"
}
or is there a different way to filter the returned fields?

Last edited by akushner; 07-02-2012 at 23:03.
Reply With Quote
  #2  
Old 17-02-2012, 12:09
akushner akushner is offline
Junior Member
 
Join Date: Feb 2012
Posts: 4
Default Not supported for items

After doing a little more digging, I found an update that states the following

from http://www.zabbix.com/documentation/...etting_started

Quote:
“output”:“extend” means that you want to get all available info about each group. This, in a way, is similar to “SELECT *” in SQL. Possible options of “output” are:

“extend” - get all info;
“shorten” - get only ids of an object;
“refer” - get id of an object and also ids of related objects;
list of fields, like [“groupid”, “name”] - get only listed fields.

List of fields is only supported in Alert, DCheck, Host, DService, Screenitem, Template and Trigger get methods.
Reply With Quote
Reply

Tags
api, filter, output

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 17:24.