[ZBXNEXT-1797] Use of HOST.ID macro in action messages Created: 2013 Jun 17  Updated: 2024 Apr 10  Resolved: 2020 Feb 25

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Frontend (F)
Affects Version/s: 2.1.0
Fix Version/s: 5.0.0alpha3, 5.0 (plan)

Type: New Feature Request Priority: Minor
Reporter: Jan Weidhaase Assignee: Andrejs Tumilovics
Resolution: Fixed Votes: 28
Labels: host, macros, notification, trivial
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

x86_64-suse-linux-gnu (Open Suse 12.2), Zabbix 2.1.0


Attachments: PNG File image-2020-02-11-09-33-18-592.png     PNG File image-2020-02-11-09-35-40-474.png     PNG File image-2020-02-11-09-42-48-912.png     PNG File image-2020-02-11-09-43-20-282.png    
Team: Team C
Sprint: Sprint 61 (Feb 2020)
Story Points: 0.25

 Description   

it would be helpful to use

{HOST.ID} in notification massages on actions as well. It could be used to generate URLs like https://zabbixsrv/zabbix/latest.php?hostid={HOST.ID}

in eMail for Support Team.



 Comments   
Comment by romale [ 2013 Oct 11 ]

+1. and in Actions should available too.
example, adding HOST.ID to URL
http://zabbix-server/zabbix/host_screen.php?hostid=

{HOST.ID}

and send this url (with other alarm info) in email message.

Comment by Amos Donovan Meyers III [ 2016 Apr 14 ]

Yep I'd like to be able to link to custom graphs for the host.

https://zabbix.domain.com/zabbix/charts.php?hostid={HOST.ID}
Comment by Michael Gray [ 2017 May 19 ]

I was struggling with this and figured out a way to do it... In the trigger, add a Trigger URL like this:

https://zabbix-server.yourco.com/zabbix/host_screen.php?hostid={HOST.ID}

Then, in the action you can add something like this to the Default message:

Host Metrics:{TRIGGER.URL}

The point is, the TRIGGER.URL macro is supported in action messages. I agree it would be nice to have more macros available in messages, but this is a reasonable workaround for me...

Comment by Nicola Mauri [ 2017 Jun 25 ]

I agree this macro would be extremely useful in notifications and hope its support will soon be added.
In the meanwhile I worked around the problem by creating a custom php page which accepts the host name as parameter (so you can call it using

{HOST.HOST} macro which is supported in action messages), looks up the correspondent host id in the db, then redirects to the desired url using the hostid parameter.

For example, suppose you want to add a link to host inventory in your notification:
1) put following url in message: http://zabbixsrv/zabbix/search_custom.php?search={HOST.HOST}

2) write search_custom.php page and place it in zabbix frontend directory
3) search_custom.php looks up host id, then redirects users to /zabbix/hostinventories.php?hostid=<hostid>

Have a look to zabbix default "search.php" page to get some ideas on how to implement your search_custom.php.
Hope this helps

Comment by Marco Hofmann [ 2018 Mar 07 ]

Just yesterday I thought, that there must be an easier way to access the host inventory screen, as it's one of the best features to navigate to all of the infos I need for a host! It's a pitty it's so hidden.. :'(
So I wanted to be smart and link it into the notifications. Too bad I failed...

https://zabbix-server/zabbix/hostinventories.php?hostid={HOST.ID}

This would be so helpful. Thanks for listening!

Comment by roy h [ 2018 Dec 04 ]

+1 for this.

 

Fortunately there is an even easy work around. Just as you can put the host id in the trigger url, you can also put it in the trigger tags. Then in your Action {EVENT.TAGS} will resolve the ID.

Comment by Alexei Vladishev [ 2020 Feb 10 ]

Support of {HOST.ID} macro will be implemented in Zabbix 5.0 for trigger based notifications and commands, also for internal and problem update notifications.

Comment by Ingus Vilnis [ 2020 Feb 10 ]

Hi Alexei, would you consider {HOST.ID} to be supported in trigger URL field too?

Use case - immediate navigation to templated screens.

https://zabbix/host_screen.php?hostid=\{HOST.ID\}
Comment by Marco Hofmann [ 2020 Feb 10 ]

Screens are going to be replaced in Zabbix 5.0 with Dashboards, as announced on the Roadmap: https://www.zabbix.com/roadmap#v5_0

Comment by Ingus Vilnis [ 2020 Feb 10 ]

Marco, nothing in the roadmap is said about screens in templates. 

https://www.zabbix.com/documentation/5.0/manual/config/visualisation/host_screens

But if these get removed then it is a major loss of functionality. 

Comment by Janne Korkkula [ 2020 Feb 10 ]

We also use templated host screens extensively, this is a major concern.

Comment by Alexei Vladishev [ 2020 Feb 10 ]

ingus.vilnis, is there a separate feature request about support of {HOST.ID} in trigger URLs?

jannek, do not worry about host screens. This functionality will be supported in one way or another, no plans of dropping it whatsoever. It is offtopic here.

Comment by roy h [ 2020 Feb 11 ]

Awesome guys. Thank you.

 

Will it also be available in scripts?  I have the following script that I use often from the Problems list:

 

Which produces this output:

 

host.conn and hostname work as expected, but presently host.id does not.

Oddly though, host.id works in the Maps context menu, but hostname does not.

Obviously it would be great if this would produce HTML Clickable Links, but one thing at a time.

 

Looking forward to March. Thanks again.

 

Roy

 

 

 

Comment by Alexei Vladishev [ 2020 Feb 12 ]

[email protected], we will implement it for notifications and remote commands first.

Comment by Andrejs Tumilovics [ 2020 Feb 21 ]

Available in 5.0.0beta1 (master) 34767a1bef

Generated at Fri Apr 26 04:28:49 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.