[ZBXNEXT-1466] Allow macro usage in {TRIGGER.COMMENT} Created: 2012 Oct 12  Updated: 2017 Apr 13  Resolved: 2013 Mar 07

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Server (S)
Affects Version/s: 2.0.3
Fix Version/s: 2.1.0

Type: New Feature Request Priority: Major
Reporter: lubyou Assignee: Pavels Jelisejevs (Inactive)
Resolution: Fixed Votes: 2
Labels: actions, macros, trivial
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File ZBXNEXT-1466.diff    
Issue Links:
Duplicate
is duplicated by ZBXNEXT-1536 Macros expansion in trigger comment Closed

 Description   

I am using zabbix actions to create tickets in an incident system.

This is what a message of an action usually looks like:

The monitoring system discovered a problem with

{HOSTNAME}

.

{EVENT.DATE}

{EVENT.TIME}

(

{EVENT.AGE}

ago):

{TRIGGER.NAME}

Details:

{TRIGGER.COMMENT}

Vendor: {INVENTORY.VENDOR}
Model: {INVENTORY.MODEL}
Service Tag: {INVENTORY.TAG}



While this is already quite nice, it would be very convenient to be able to have macros in {TRIGGER.COMMENT}

in order to provide additional information.

For example I am monitoring backup jobs and upon encountering a failed job I would like to supply additional information like when the next attempt is scheduled,

http://www.zabbix.com/forum/showthread.php?t=33985 explains what I want to do.

Thank you

Spec: https://zabbix.org/wiki/Docs/specs/ZBXNEXT-1466



 Comments   
Comment by lubyou [ 2012 Nov 07 ]

Macros that are valid for trigger names are now also valid for trigger comments/descriptions.

Additionally simple macros à la "

{host:key.func(param)}

" are now supported in trigger comments/descriptions as well.

Comment by richlv [ 2012 Nov 07 ]

it would probably look a bit awkward if these macros would not be resolved in trigger comments when viewed from "monitoring -> triggers", though

Comment by dimir [ 2012 Nov 27 ]

Will be available in 2.2 .

Comment by dimir [ 2012 Nov 27 ]

Thanks a lot for the patch, it's certainly useful!

Comment by dimir [ 2012 Nov 27 ]

Add link to spec to description.

Comment by lubyou [ 2012 Nov 27 ]

Thank you very much for including this functionality in Zabbix!

I had a quick glance at the spec and I was wondering if you could allow simple functions ("

{host:key.func(param)}

") as well.

It would be tremendously useful!

Example:

The last execution of backup exec job "

{#JOB_NAME}

" on

{HOST.HOST} failed.

The next execution is scheduled for {{HOST.HOST}

:symantec.backup_exec[--get-next-runtime-for-job,

{#JOB_ID}

].last(0)} (local time).

Thank you

Comment by dimir [ 2012 Nov 27 ]

We had a discussion about this today and decided to leave support for functions out for now. The problem is that while it's very simple to implement on the server side it takes quite a bit of work to do that for frontend.

Comment by dimir [ 2012 Nov 27 ]

Server side ready in development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-1466 .

Comment by lubyou [ 2012 Nov 27 ]

Could we make it an compile time option? I would hate having to maintain a patch for this just for the functions.

Comment by dimir [ 2012 Nov 28 ]

Sorry, as I said we cannot support this feature without frontend and frontend changes require quite a bit of time which we are not ready to invest at this point.

Comment by dimir [ 2012 Nov 28 ]

Frontend changes to be done.

Comment by Eduards Samersovs (Inactive) [ 2012 Dec 07 ]

Frontend part implemented in same development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-1466

Comment by Pavel Timofeev [ 2012 Dec 08 ]

Excuse me, what about {$USER_MACRO}?

Comment by dimir [ 2012 Dec 08 ]

User macros will be supported in trigger names and descriptions.

Comment by Alexander Vladishev [ 2012 Dec 20 ]

Successfully tested! Please review my change in r32257.

Comment by Eduards Samersovs (Inactive) [ 2012 Dec 20 ]

Fixed in versions pre-2.1.0 (beta) r32269

Comment by Alexander Vladishev [ 2013 Jan 08 ]

(15) Broken Last 20 issues widget (with PostgreSQL):

pg_query(): Query failed: ERROR:  column "t.lastchange" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: ...WEEN 000000000000000 AND 099999999999999 ORDER BY lastchange...
                                                             ^ [db.inc.php:441]
Error in query [SELECT   COUNT(DISTINCT t.triggerid) AS rowscount FROM triggers t WHERE NOT EXISTS (SELECT NULL FROM functions f,items i,hosts h WHERE t.triggerid=f.triggerid AND f.itemid=i.itemid AND i.hostid=h.hostid AND (i.status<>0 OR h.status<>0)) AND t.status=0 AND ( t.value='1' AND t.flags IN ('0','4') ) AND t.triggerid BETWEEN 000000000000000 AND 099999999999999 ORDER BY lastchange DESC,t.lastchange DESC] [ERROR:  column "t.lastchange" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: ...WEEN 000000000000000 AND 099999999999999 ORDER BY lastchange...
                                                             ^]
pg_fetch_assoc() expects parameter 1 to be resource, boolean given [db.inc.php:578]
pg_free_result() expects parameter 1 to be resource, boolean given [db.inc.php:579]
ngettext() expects parameter 3 to be long, array given [gettextwrapper.inc.php:74]

Eduards RESOLVED r.32580

tomtom CLOSED. This problem will be resolved under ZBXNEXT-1491

Comment by richlv [ 2013 Jan 14 ]

regression : ZBX-6119

Comment by Alexander Vladishev [ 2013 Mar 04 ]

Documentation isn't ready. I'm reopening the issue.

martins-v Documented at:

https://www.zabbix.com/documentation/2.2/manual/introduction/whatsnew220#macros_in_trigger_descriptions
https://www.zabbix.com/documentation/2.2/manual/appendix/macros/supported_by_location
https://www.zabbix.com/documentation/2.2/manual/config/triggers/trigger#configuration

Comment by Martins Valkovskis [ 2013 Mar 05 ]

trigger.get page must be updated, then the issue can be closed.

jelisejev Updated trigger.get parameters and the API changelog.
https://www.zabbix.com/documentation/2.2/manual/api/reference/trigger/get?&#parameters

Comment by Steam [ 2017 Apr 13 ]

Hi,
are there any plans in supporting simple functions

{host:key.func(param)}

in

{TRIGGER.DESCRIPTION}

as well?

Generated at Fri Mar 29 16:24:23 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.