[ZBXNEXT-2087] Custom fields to use and show in dashboard events Created: 2013 Dec 23  Updated: 2017 Feb 14  Resolved: 2016 Oct 18

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Frontend (F), Server (S)
Affects Version/s: None
Fix Version/s: 3.2.0alpha1

Type: New Feature Request Priority: Trivial
Reporter: Ronny M Assignee: Unassigned
Resolution: Fixed Votes: 7
Labels: events, tags
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by ZBXNEXT-1645 Macros on trigger level for use in ac... Closed
is duplicated by ZBXNEXT-2246 Add detailed info/values to events vi... Closed
is duplicated by ZBXNEXT-3459 Create/Retrieve/Update/Delete Trigger... Closed

 Description   

I would like the have the possibility to add values/information to a custom field (summary, information, info, tag, key or something like that) which can be used to show additionally information in an event which can also be used in filters or triggers.

Example use cases are:

  • tag an event with a key/tag that can be used in maps/screens as a filter. For example a tag could be an application name, service name or any other identifier which can be used to show only events with this tag in a map.
  • add an application name tag/key to an event so an user can see to which application/service an alert belongs to.
  • simpler queries/triggers based an a tag to group similar events based on common values which can than be used in triggers?
  • show custom/extra useful information in a event
  • problem/resolution correlation for log/trap or other similar alerts. A unique key in combination with type problem or resolution can be used to clear problems based on known solutions.

If I think longer I can probably think of much more possible use cases for custom/additional columns/fields.

fields should a least be able to be filled by custom_parameters, zabbix-sender, logfile items, traps and probably some more collection methods.



 Comments   
Comment by Marc [ 2013 Dec 24 ]

By now the latter might be achieved partly by populating host inventory fields via items. Theses fields may then be used via macros.
ZBXNEXT-336 might gain usefulness for this use case a lot.

Since events are objects that don't exist before triggers change, I don't expect this to become an customizable object.
But maybe one approach could be ZBXNEXT-1645. This would allow to add macros on trigger level.

The last missing part would then be to add proper filter functionality based on macros(macro values) - what should be easy to implement in most places
A useful side-effect in using macros might be its support for inheritance:
global macro <- template macro <- host macro <- trigger macro

Comment by Marc [ 2016 Mar 15 ]

ZBXNEXT-2976 asks for "support of tags for configuration entities".

Comment by Andris Zeila [ 2016 Apr 27 ]

(1) [S] Database patch created in development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-2087

sasha Successfully tested! CLOSED

Comment by Andris Zeila [ 2016 May 05 ]

[S] Server side ready for review & testing.

Comment by Alexander Vladishev [ 2016 May 09 ]

(2) [A] trigger.create(), triggerprototype.create(), trigger.update(), triggerprototype.update(): tags array must be validated:

  • tag cannot be empty
  • tag cannot contain character '/'

gunarspujats RESOLVED in r59993

sasha the reason must be in such error messages instead of real value

  1. _s('Incorrect value for field "%1$s": %2$s.', 'tag', $tag['tag'])
    _s('Incorrect value for field "%1$s": %2$s.', 'tag', _('a character string is expected'))
    _s('Incorrect value for field "%1$s": %2$s.', 'tag', _('unacceptable characters are used'))
  2. the original value must be checked here
    if (trim($tag['tag']) === '') {

REOPENED

sasha RESOLVED in r60004

gunarspujats CLOSED

Comment by Alexander Vladishev [ 2016 May 09 ]

(3) [A] CTriggerGeneral:504,678: check for an empty array is useless

if (array_key_exists('tags', $trigger) && $trigger['tags']) {
        $this->validateAddTags($trigger['tags']);
}

gunarspujats RESOLVED in r59993

sasha CLOSED

Comment by Alexander Vladishev [ 2016 May 09 ]

(4) [A] frontends/php/include/classes/api/services/CTriggerGeneral.php:884:906: $db_trigger['tags'] and $trigger['tags'] must be sorted before processing

gunarspujats RESOLVED in r60002

sasha CLOSED

Comment by Alexander Vladishev [ 2016 May 09 ]

(5) [A] "Undefined index" errors

Undefined index: tag [hostgroups.php:63 → CFrontendApiWrapper->update() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CTrigger->update() → CTriggerGeneral->validateUpdate() → CTriggerGeneral->validateAddTags() → CArrayHelper::findDuplicate() in include/classes/helpers/CArrayHelper.php:204]
Undefined index: value [hostgroups.php:63 → CFrontendApiWrapper->update() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CTrigger->update() → CTriggerGeneral->validateUpdate() → CTriggerGeneral->validateAddTags() → CArrayHelper::findDuplicate() in include/classes/helpers/CArrayHelper.php:207]
Undefined index: tag [hostgroups.php:63 → CFrontendApiWrapper->update() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CTrigger->update() → CTriggerGeneral->updateReal() in include/classes/api/services/CTriggerGeneral.php:891]

gunarspujats RESOLVED in r60002

sasha Have a look at my changes in r60009

gunarspujats CLOSED

sasha checkTriggerTags() returns incorrect value if tags is not present. REOPENED

sasha RESOLVED in 60013.

gunarspujats CLOSED

Comment by Alexander Vladishev [ 2016 May 09 ]

(6) [A] trigger.get() and triggerprototype.get() produces PHP errors with selectTags = API_OUTPUT_COUNT

array_merge(): Argument #1 is not an array [hostgroups.php:64 → CFrontendApiWrapper->get() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CTrigger->get() → CTrigger->addRelatedObjects() → CTriggerGeneral->addRelatedObjects() → CApiService->outputExtend() → array_merge() in include/classes/api/CApiService.php:238]
array_flip() expects parameter 1 to be array, null given [hostgroups.php:64 → CFrontendApiWrapper->get() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CTrigger->get() → CTrigger->addRelatedObjects() → CTriggerGeneral->addRelatedObjects() → CApiService->outputExtend() → array_flip() in include/classes/api/CApiService.php:238]
array_keys() expects parameter 1 to be array, null given [hostgroups.php:64 → CFrontendApiWrapper->get() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CTrigger->get() → CTrigger->addRelatedObjects() → CTriggerGeneral->addRelatedObjects() → CApiService->outputExtend() → array_keys() in include/classes/api/CApiService.php:238]
Undefined index: triggerid [hostgroups.php:64 → CFrontendApiWrapper->get() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CTrigger->get() → CTrigger->addRelatedObjects() → CTriggerGeneral->addRelatedObjects() → CApiService->createRelationMap() in include/classes/api/CApiService.php:327]
Undefined index: triggerid [hostgroups.php:64 → CFrontendApiWrapper->get() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CTrigger->get() → CTrigger->addRelatedObjects() → CTriggerGeneral->addRelatedObjects() → CApiService->createRelationMap() in include/classes/api/CApiService.php:327]

gunarspujats RESOLVED in r60007

sasha CLOSED

Comment by Alexander Vladishev [ 2016 May 09 ]

(7) [A] Have a look at my changes in r59985.

gunarspujats CLOSED

Comment by Alexander Vladishev [ 2016 May 10 ]

(8) [A] better naming of validateAddTags(): checkTriggerTags()?

gunarspujats RESOLVED in r60002

sasha CLOSED

Comment by Alexander Vladishev [ 2016 May 10 ]

(9) [A] "selectTags" => API_OUTPUT_EXTEND returns triggertagid and triggerid

sasha RESOLVED in r60010 (CTriggerGeneral), r60012 (CEvent)

gunarspujats Deletion of old tags is broken. REOPENED

sasha RESOLVED in r60015

gunarspujats CLOSED

Comment by Alexander Vladishev [ 2016 May 10 ]

API was successfully tested!

Comment by Alexander Vladishev [ 2016 May 11 ]

(10) XML import/export

sasha RESOLVED in r60018

gunarspujats CLOSED

Comment by Alexander Vladishev [ 2016 May 11 ]

(11) [A] trigger tags inheritance doesn't work

sasha RESOLVED in r60020

gunarspujats CLOSED

Comment by Gunars Pujats (Inactive) [ 2016 May 11 ]

(12) [F] Tags input form in triggers and trigger prototypes.

gunarspujats RESOLVED in r60028 (triggers), r60033 (trigger prototypes).

sasha

  • tags must be sorted by ['tag', 'value'] in the forms
  • have a look at my changes in r60082

REOPENED

gunarspujats RESOLVED in r60091

sasha Tags sorting should be applied in the form.

REOPENED

gunarspujats RESOLVED in r60111

sasha CLOSED

Comment by Alexander Vladishev [ 2016 May 12 ]

(13) [I] added new field value2 into conditions table

wiper CLOSED

Comment by Alexander Vladishev [ 2016 May 12 ]

(14) [S] action conditions processing doesn't respect tag field for "Tag value" condition

wiper RESOLVED in r60084

sasha CLOSED

Comment by Alexander Vladishev [ 2016 May 14 ]

(15) [S] lld_trigger.c trigger tags are not validated

wiper RESOLVED in r60096.

sasha Trigger tag cannot contain '/'. It must be validated. REOPENED

wiper RESOLVED in r60112.

sasha CLOSED with minor fix in r60123

Comment by Alexander Vladishev [ 2016 May 14 ]

(16) [S] src/zabbix_server/events.c:193 Only tag cannot contain character '/'.

if (0 != strchr(event_tag_local.tag->tag, '/') || 0 != strchr(event_tag_local.tag->value, '/'))

wiper RESOLVED in r60110

sasha CLOSED

Comment by Alexander Vladishev [ 2016 May 14 ]

(17) [S] src/zabbix_server/events.c:195 seems this code is useless

zbx_free_tag(event_tag_local.tag);
events[i].tags.values[j] = events[i].tags.values[--events[i].tags.values_num];
j--;

wiper RESOLVED in r60110

sasha CLOSED

Comment by Alexander Vladishev [ 2016 May 16 ]

(18) [S] Have a look at my changes in r60102, r60103, r60104, r60105, r60106, r60107, r60108 and r60109

wiper CLOSED

Comment by Alexander Vladishev [ 2016 May 16 ]

(19) [AF] Tags sorting should be removed from event.get and trigger.get.

gunarspujats RESOLVED in r60111

sasha CLOSED

Comment by Gunars Pujats (Inactive) [ 2016 May 16 ]

(20) [AF] New action conditions "Tag" and "Tag value".

gunarspujats RESOLVED in r60111

sasha CLOSED with minor changes in r60125

Comment by Alexander Vladishev [ 2016 May 17 ]

Successfully tested!

Comment by Alexander Vladishev [ 2016 May 18 ]

Available in pre-3.1.0 (trunk) r60130.

Comment by Aleksandrs Saveljevs [ 2016 Jun 06 ]

This seems to have caused ZBX-10876.

Comment by Martins Valkovskis [ 2016 Jun 15 ]

(21) Updated documentation:

Trigger configuration screenshots in LLD will be updated in the viewable LLD items/triggers/graphs task.

RESOLVED

glebs.ivanovskis As I understand {ITEM.LASTVALUE} is supported in Event tags too.

sasha {ITEM.LASTVALUE} is supported in Event tags and values. There are no differences between these macros. Documentation must be updated.

martins-v Updated:

RESOLVED

sasha Thanks! CLOSED

Comment by Andris Zeila [ 2016 Jun 20 ]

(22) [I] Database upgrade can get stuck if there are more than 10k discovery/autoregistration events in row.

wiper RESOLVED in r60700

sasha CLOSED

Fixed in pre-3.1.0 (trunk) r60821

Comment by Andris Zeila [ 2016 Jun 28 ]

(23) [F] Trigger tag

{{ITEM.VALUE}.regsub("CLASS:([a-zA-Z0-9/]+)","\1")}

fails validation while being valid. Probably because of / symbol in macro function parameters. Macros can be used in both - trigger tags and tag values.

sasha RESOLVED in r60802

gunarspujats Coding style

  • missing PHPDoc in include/classes/validators/CTagValidator.php:42

sasha RESOLVED in r60819

gunarspujats CLOSED

Fixed in pre-3.1.0 (trunk) r60821

Comment by Alexander Vladishev [ 2016 Jun 30 ]

(25) [D] API documentation:

sandis.neilands Description for tags except for "correlation_tag" is missing.

iivs Updated:

RESOLVED

sasha The wrong example for trigger prototypes methods. LLD macros are not included in the description and expression.

REOPENED

iivs Couldn't think of anything logical, so I deleted the that example and added tags for the first example. Updated:

RESOLVED

sasha Looks good to me. Thank you! CLOSED

Comment by Glebs Ivanovskis (Inactive) [ 2016 Jul 11 ]

(26) [S] Thanks to gunarspujats for discovering a crash!
Judging by backtrace and objdump Zabbix server crashes in lld_triggers_validate() on attempt to zbx_vector_ptr_clear_ext(&db_triggers, (zbx_clean_func_t)lld_trigger_free) where elements of db_triggers do not have a properly initialized tags field.

wiper I remember fixing this in one event correlation related branch. As the corresponding branches (3274, 3277) are already merged in trunk - this might be fixed. Have to check.

glebs.ivanovskis Yes, I confirm that.

+++ src/libs/zbxdbhigh/lld_trigger.c	(revision 61049)
@@ -1905,6 +1941,7 @@
 			zbx_vector_ptr_create(&db_trigger->functions);
 			zbx_vector_ptr_create(&db_trigger->dependencies);
 			zbx_vector_ptr_create(&db_trigger->dependents);
+			zbx_vector_ptr_create(&db_trigger->tags);
 
 			zbx_vector_ptr_append(&db_triggers, db_trigger);
 		}

CLOSED

Generated at Fri Apr 26 11:41:08 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.