[ZBX-4976] HOST.CONN doesn't work in global scripts Created: 2012 May 10  Updated: 2017 May 30  Resolved: 2012 Jul 24

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

Type: Incident report Priority: Blocker
Reporter: richlv Assignee: Unassigned
Resolution: Fixed Votes: 7
Labels: globalscripts
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

trunk rev 27311


Issue Links:
Duplicate
is duplicated by ZBX-5768 GUI script macros resolve to *UNKNOWN* Closed

 Description   

global scripts don't seem to work with HOST.CONN macro anymore. tried with agent and snmp interfaces and ip specified for them.

debuglevel 4 gives :

In substitute_simple_macros() data:'/bin/ping -c 3

{HOST.CONN} 2>&1'
cannot resolve macro '{HOST.CONN}

'
End substitute_simple_macros() data:'/bin/ping -c 3 UNKNOWN 2>&1'
In zbx_execute_script()
In zbx_popen() command:'/bin/ping -c 3 UNKNOWN 2>&1'
End of zbx_popen():7



 Comments   
Comment by Alexander Vladishev [ 2012 May 10 ]

With Agent interface all work fine. If only SNMP interface is specified in a host the macro expands according documentation.

http://www.zabbix.com/documentation/2.0/manual/appendix/macros/supported_by_location

"In the context of remote command execution, GUI scripts, item key's parameters, and interface IP/DNS fields, only the main Agent interface will be considered as the source of information."

Comment by Oleksii Zagorskyi [ 2012 May 10 ]

I know this problem.
I do not like current behavior (as described in documentation) because to use GUI scripts for a SNMP-based device I have also add Agent interface to already existing and used (only) SNMP interface. A real case described in the ZBXNEXT-1089
Maybe it could be reviewed ?

Rich, do not forget about configuration cache update interval.

Comment by richlv [ 2012 May 11 ]

after a bunch of testing, yes, configuration caching confused me
unless i'm forgetting something, current behaviour doesn't seem to make much sense - this makes frontend scripts unusable for hosts with snmp interface only, unless "dummy", unused agent interface is added as well.

i'd probably go for agent-snmp-jmx-ipmi, to be the same ordering as in the frontend

<zalex> I recall I was also mislead because of using server cache (for interfaces) for macros expending when I created the ZBXNEXT-1089
So, this is an unclear problem already for two people and it's serious indicator

Maybe server cache should not be used here (for GUI scripts) ?
For example it's already done for disabled host (ZBX-4889)

Users can change interfaces setting (add/delete, change IP) and very fast try to use GUI scripts (with macros) and it's absolutely not clear why they do not work or work as not expected.
From forum I recall that many users (even experienced) did not know that zabbix scripts actually executed by server daemon, but not by the fronted itself.

So, I support Rich's point of view (agent-snmp-jmx-ipmi) and I suggest to not use server cache to expanding macros in GUI scripts.

<richlv> not sure about skipping the cache, performance is the king

Comment by Александр Новосёлов [ 2012 May 30 ]

google translate
---------------------------------------------

The device was found on snmp (autodiscovery), respectively, the agent interface he does not - but there is an element of data a_est_li_eto_chudo_na_karte ["

{HOST.CONN}"]
respectively, the work was broken. manually add the interface agent incorrectly - what shall we do with it? Logical external audits performed on any interface ip if it is.


original
---------------------------------------------

Устройство нашлось по snmp (автообнаружение) соответственно интерфейса агента у него нет - но есть элемент данных а_есть_ли_это_чудо_на_карте["{HOST.CONN}

"]
соответственно работа сломалась. вручную добавлять интерфейс агента неправильно - что будем делать с этим? Логичней внешние проверки выполнять на ип любого интерфейса если он есть.

http://www.zabbix.com/forum/showthread.php?t=26378

Comment by richlv [ 2012 Jun 29 ]

ZBXNEXT-1293 is related

Comment by Oleksii Zagorskyi [ 2012 Jul 06 ]

Additional forum thread (in Russian) http://www.zabbix.com/forum/showthread.php?t=27075

Comment by Tobias van Hoogen [ 2012 Jul 13 ]

ah, no need to file a new ticket...

We used to do this via a template on a couple of hundred devices, simple external check with a custom script in 1.8.12:

Template_X_Poiprouter: PoipLocalIkePeer PoipLocalIkePeer.sh["

{HOST.CONN}

",] 86400 14 External check

Now we migrated to 2.0.1, all the items are stuck in the queue - big issue.

Thanks!

Comment by Alexander Vladishev [ 2012 Jul 19 ]

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

Comment by Oleksii Zagorskyi [ 2012 Jul 19 ]

(1) it seems we need to see updated documentation do know how it should work now

<zalex> ohh, SVN log message in the dev branch is very useful, I'm copying it here:

........S. ZBX-4976 improved

{HOST.CONN}

, {HOST.IP) and

{HOST.DNS}

macros substitution for global scripts
Before this change:

  • macros are replaced with values from the host's main "Zabbix agent" interface
  • macros are replaced with UNKNOWN if such interface isn't present
    After this change:
  • macros are replaced with values from the host's main interfaces in the following order:
  • "Zabbix agent" interface
  • SNMP interface
  • JMX interface
  • IPMI interface
  • macros are replaced with UNKNOWN if such interfaces aren't present

<richlv> should be documented in http://www.zabbix.com/documentation/2.0/manual/appendix/macros/supported_by_location and the note below the table updated (mentioning which version changes the behaviour, probably 2.0.3)

<Sasha> updated documentation. Please review.

<richlv> docs seem to be good, CLOSED

Comment by Oleksii Zagorskyi [ 2012 Jul 19 ]

the dev branch successfully tested. works as described above.

Comment by dimir [ 2012 Jul 20 ]

Successfully tested!

Comment by richlv [ 2012 Jul 23 ]

ZBX-3619 talks about more global lack of consistency in this area

Comment by Alexander Vladishev [ 2012 Jul 24 ]

Fixed in pre-2.0.2 r29111 and pre-2.1.0 (beta) r29112.

Generated at Tue May 20 07:36:50 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.