[ZBXNEXT-3673] template.get selectMacros returns empty array Created: 2017 Jan 30  Updated: 2017 May 31  Resolved: 2017 Mar 13

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: API (A)
Affects Version/s: 3.2.3
Fix Version/s: None

Type: Change Request Priority: Major
Reporter: David Angelovich Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: api, macros, template.get
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 16


Attachments: PNG File Screenshot from 2017-01-30 10-04-15.png    

 Description   

template.get with selectMacros = true returns an empty array even when there are macros assigned to the template.

Template 10329: 
[{u'available': u'0',
  u'description': u'',
  u'disable_until': u'0',
  u'error': u'',
  u'errors_from': u'0',
  u'flags': u'0',
  u'host': u'Template_Cassandra',
  u'ipmi_authtype': u'0',
  u'ipmi_available': u'0',
  u'ipmi_disable_until': u'0',
  u'ipmi_error': u'',
  u'ipmi_errors_from': u'0',
  u'ipmi_password': u'',
  u'ipmi_privilege': u'2',
  u'ipmi_username': u'',
  u'jmx_available': u'0',
  u'jmx_disable_until': u'0',
  u'jmx_error': u'',
  u'jmx_errors_from': u'0',
  u'lastaccess': u'0',
  u'macros': [],
  u'maintenance_from': u'0',
  u'maintenance_status': u'0',
  u'maintenance_type': u'0',
  u'maintenanceid': u'0',
  u'name': u'Template_Cassandra',
  u'proxy_hostid': u'0',
  u'snmp_available': u'0',
  u'snmp_disable_until': u'0',
  u'snmp_error': u'',
  u'snmp_errors_from': u'0',
  u'status': u'3',
  u'templateid': u'10329',
  u'tls_accept': u'1',
  u'tls_connect': u'1',
  u'tls_issuer': u'',
  u'tls_psk': u'',
  u'tls_psk_identity': u'',
  u'tls_subject': u''}]

usermacro.get with the templateid = 10329 also returns an empty array, though I'm unclear on whether this is expected from this function.

Screenshot attached of the template's macro definitions



 Comments   
Comment by richlv [ 2017 Jan 30 ]

can you show raw json request ?
not language structures (python in this case ?), raw json.

Comment by David Angelovich [ 2017 Jan 30 ]

Raw json:

{"jsonrpc":"2.0","result":[{"proxy_hostid":"0","host":"Template_Cassandra","status":"3","disable_until":"0","error":"","available":"0","errors_from":"0","lastaccess":"0","ipmi_authtype":"0","ipmi_privilege":"2","ipmi_username":"","ipmi_password":"","ipmi_disable_until":"0","ipmi_available":"0","snmp_disable_until":"0","snmp_available":"0","maintenanceid":"0","maintenance_status":"0","maintenance_type":"0","maintenance_from":"0","ipmi_errors_from":"0","snmp_errors_from":"0","ipmi_error":"","snmp_error":"","jmx_disable_until":"0","jmx_available":"0","jmx_errors_from":"0","jmx_error":"","name":"Template_Cassandra","flags":"0","templateid":"10329","description":"","tls_connect":"1","tls_accept":"1","tls_issuer":"","tls_subject":"","tls_psk_identity":"","tls_psk":"","macros":[]}],"id":1}
Comment by Oleg Egorov (Inactive) [ 2017 Mar 13 ]

Incorrect template.get request
selectMacros should be a array, for example, selectMacros: ["hostmacroid"]

See:
https://www.zabbix.com/documentation/3.2/manual/api/reference/template/get?s[]=selectmacros

Duplicated by ZBX-3783

CLOSED

Generated at Mon Apr 28 20:40:07 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.