[ZBX-5625] If the dynamic indexes use a macros an item set is unsupported Created: 2012 Sep 26  Updated: 2017 May 30  Resolved: 2012 Oct 01

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 2.0.2rc2, 2.1.0
Fix Version/s: 2.0.3rc2, 2.1.0

Type: Incident report Priority: Blocker
Reporter: Victor Bashkirov Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: dynamicindexes, items
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

CentOS release 5.8 (Final)


Attachments: JPEG File item config.jpg     JPEG File node items status.jpg     JPEG File node macros config.jpg    
Issue Links:
Duplicate
is duplicated by ZBXNEXT-1381 user macros (declared in the host) in... Closed

 Description   

After installing the new version of the pre-zabbix-2.1.0-30326 stopped working an item with dynamic indices that use macros.

not working example SNMP OID
IF-MIB :: ifHCInOctets ["index", "IF-MIB :: ifDescr", "{$ SNMP_IFDESCR}"]

Log:
10194:20120926:201134.144 In DCconfig_get_poller_items() poller_type:0
10194:20120926:201134.144 End of DCconfig_get_poller_items():1
10194:20120926:201134.144 In substitute_key_macros() data:'ifInOctets'
10194:20120926:201134.144 End of substitute_key_macros():SUCCEED data:'ifInOctets'
10194:20120926:201134.144 In substitute_simple_macros() data:'161'
10194:20120926:201134.144 In substitute_simple_macros() data:'{$SNMP_COMMUNITY}'
10194:20120926:201134.144 In DCget_user_macro() macro:'{$SNMP_COMMUNITY}'
10194:20120926:201134.144 In DCget_host_macro() macro:'{$SNMP_COMMUNITY}'
10194:20120926:201134.144 End of DCget_host_macro():SUCCEED
10194:20120926:201134.144 End of DCget_user_macro()
10194:20120926:201134.144 End substitute_simple_macros() data:'public'
10194:20120926:201134.144 In substitute_key_macros() data:'IF-MIB::ifHCInOctets["index","IF-MIB::ifDescr","{$SNMP_IFDESCR}"]'
10194:20120926:201134.144 In substitute_simple_macros() data:'{$SNMP_IFDESCR}'
10194:20120926:201134.144 In DCget_user_macro() macro:'{$SNMP_IFDESCR}'
10194:20120926:201134.144 In DCget_host_macro() macro:'{$SNMP_IFDESCR}'
10194:20120926:201134.144 End of DCget_host_macro():FAIL
10194:20120926:201134.144 In DCget_global_macro() macro:'{$SNMP_IFDESCR}'
10194:20120926:201134.144 End of DCget_global_macro()
10194:20120926:201134.144 End of DCget_user_macro()
10194:20120926:201134.144 End substitute_simple_macros() data:'{$SNMP_IFDESCR}'
10194:20120926:201134.144 End of substitute_key_macros():SUCCEED data:'IF-MIB::ifHCInOctets["index","IF-MIB::ifDescr","{$SNMP_IFDESCR}"]'
10194:20120926:201134.144 In get_value() key:'ifInOctets'
10194:20120926:201134.144 In get_value_snmp() key:'ifInOctets' oid:'IF-MIB::ifHCInOctets["index","IF-MIB::ifDescr","{$SNMP_IFDESCR}"]'
10194:20120926:201134.144 In snmp_open_session()
10194:20120926:201134.144 SNMP [[email protected]:161]
10194:20120926:201134.144 End of snmp_open_session()
10194:20120926:201134.144 Special processing
10194:20120926:201134.144 method:index
10194:20120926:201134.144 oid_index:IF-MIB::ifDescr
10194:20120926:201134.144 index_value:{$SNMP_IFDESCR}
10194:20120926:201134.144 In snmp_normalize(oid:IF-MIB::ifDescr)
10194:20120926:201134.144 End of snmp_normalize():IF-MIB::ifDescr
10194:20120926:201134.144 In cache_get_snmp_index() oid:'IF-MIB::ifDescr' value:'{$SNMP_IFDESCR}'
10194:20120926:201134.144 End of cache_get_snmp_index():FAIL index:0
10194:20120926:201134.144 In snmp_get_index() oid:'IF-MIB::ifDescr' value:'{$SNMP_IFDESCR}' bulk:1
10194:20120926:201134.147 snmp_get_index() snmp_synch_response():0
10194:20120926:201134.147 In snmp_get_octet_string()
10194:20120926:201134.147 snmp_get_octet_string() full value:'STRING: FastEthernet1'
10194:20120926:201134.147 End of snmp_get_octet_string():'FastEthernet1'
10194:20120926:201134.148 snmp_get_index() snmp_synch_response():0
10194:20120926:201134.148 In snmp_get_octet_string()
10194:20120926:201134.148 snmp_get_octet_string() full value:'STRING: TenGigabitEthernet1/1'
10194:20120926:201134.148 End of snmp_get_octet_string():'TenGigabitEthernet1/1'
10194:20120926:201134.148 snmp_get_index() snmp_synch_response():0
10194:20120926:201134.148 In snmp_get_octet_string()



 Comments   
Comment by Victor Bashkirov [ 2012 Sep 27 ]

in the old version works

в старых версиях работало

Comment by Victor Bashkirov [ 2012 Sep 27 ]

worked in the pre-zabbix-2.1.0-29194
noticed what does not work in pre-zabbix-2.1.0-29445

Comment by Eric Gearhart [ 2012 Sep 28 ]

Are you sure this isn't a duplicate of https://support.zabbix.com/browse/ZBX-4793 ? Dynamic indexes seem to be broken for a bunch of folks (me included)

Comment by Victor Bashkirov [ 2012 Sep 28 ]

I think problem in file src\libs\zbxserver\expression.c
function substitute_simple_macros(
...............................................
else if (macro_type & MACRO_TYPE_ITEM_KEY)
{
if (0 == strncmp(m, "{$", 2)) /* user defined macros */
DCget_user_macro(&dc_item->host.hostid, 1, m, &replace_to);
else if (0 == strcmp(m, MVAR_HOST_HOST) || 0 == strcmp(m, MVAR_HOSTNAME))
replace_to = zbx_strdup(replace_to, dc_item->host.host);
else if (0 == strcmp(m, MVAR_HOST_NAME))
replace_to = zbx_strdup(replace_to, dc_item->host.name);
else if (0 == strcmp(m, MVAR_HOST_IP) || 0 == strcmp(m, MVAR_IPADDRESS))

{ if (INTERFACE_TYPE_UNKNOWN != dc_item->interface.type) replace_to = zbx_strdup(replace_to, dc_item->interface.ip_orig); else ret = FAIL; }

else if (0 == strcmp(m, MVAR_HOST_DNS))

{ if (INTERFACE_TYPE_UNKNOWN != dc_item->interface.type) replace_to = zbx_strdup(replace_to, dc_item->interface.dns_orig); else ret = FAIL; }

else if (0 == strcmp(m, MVAR_HOST_CONN))

{ if (INTERFACE_TYPE_UNKNOWN != dc_item->interface.type) replace_to = zbx_strdup(replace_to, dc_item->interface.addr); else ret = FAIL; }

}
...............................................
can not understand the logic of the function
Why test the type of interface?

Comment by Alexander Vladishev [ 2012 Oct 01 ]

Confirmed. Broken by:

r29444 | sasha | 2012-08-08 09:10:24 +0300 (Wed, 08 Aug 2012) | 1 line

.......PS. ZBX-5397 fixed resolving of

{HOST.IP}

,

{HOST.DNS}

and

{HOST.CONN}

macros in item key parameters

Comment by Alexander Vladishev [ 2012 Oct 01 ]

Changed priority to Blocker.

Comment by Alexander Vladishev [ 2012 Oct 01 ]

Fixed in the development branch svn://svn.zabbix.com/branches/dev/ZBX-5625

Comment by Andris Mednis [ 2012 Oct 01 ]

Successfully tested.

Comment by Alexander Vladishev [ 2012 Oct 01 ]

Fixed in version pre-2.0.3 r30443 and pre-2.1.0 (trunk) r30445.

Generated at Fri Apr 19 16:10:44 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.