[ZBX-9656] description added to single alert was vanish over time Created: 2015 Jun 25  Updated: 2017 May 30  Resolved: 2016 Oct 17

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F), Server (S)
Affects Version/s: 2.4.4
Fix Version/s: 2.2.16rc1, 3.0.6rc1, 3.2.2rc1, 3.4.0alpha1

Type: Incident report Priority: Blocker
Reporter: Natalia Kagan Assignee: Unassigned
Resolution: Fixed Votes: 2
Labels: database, sql, triggers
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

centos6 ,
server, proxy,mysql ,web - installed on separate servers


Issue Links:
Duplicate

 Description   

Hi,

description added to single alert was vanish over time.

not all description disappeared and I can't find any rule for all disappeared triggers.

We find in DB log that some process run the following (clean description) :
3932739 Query update triggers set comments='' where triggerid=780684

But I don't understand why ?

Please advise,

Thanks



 Comments   
Comment by richlv [ 2015 Jun 25 ]

are these normal triggers or lld generated triggers ? are they templated or directly attached to a template or host ?

Comment by Natalia Kagan [ 2015 Jun 25 ]

It's happened for both normal and lld as well.all triggers we have they are templated and host assign to template.
Thanks!

Comment by Natalia Kagan [ 2015 Jun 26 ]

Could you tell in which case you perform  "Query   update triggers set comments=where triggerid=..."
?
I can't find it in php side,so looks like it performed by zabbix-server.

Thanks for help.

Comment by Aleksandrs Saveljevs [ 2015 Jun 26 ]

This might be a SQL statement performed by Zabbix server in src/libs/zbxdbhigh/lld_trigger.c, lld_triggers_save() function:

if (0 != (trigger->flags & ZBX_FLAG_LLD_TRIGGER_UPDATE_COMMENTS))
{
	comments_esc = DBdyn_escape_string(trigger->comments);
	zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset, "%scomments='%s'", d,
			comments_esc);
	zbx_free(comments_esc);
	d = ",";
}

It is supposed to only be executed when a discovered trigger description has changed and needs to be updated.

Comment by Natalia Kagan [ 2015 Jun 26 ]

Thanks!

But I have this problem for normal trigger as well not only for lld ....and not all triggers.
Lld is a trapper, but it send the same value
How can I debug the issue ?
I installed zabbix server by rpm.
Could you check the issue ?
I am able to reproduce it.

Thanks.

Comment by Aleksandrs Saveljevs [ 2015 Jul 02 ]

Here is how we currently understand the problem. LLD triggers cannot be edited in configuration, so it is not possible to change their description there. However, it is currently possible to add a description for an LLD trigger in "Monitoring" -> "Triggers" by clicking "Add" in the "Description" column. There, LLD triggers are not distinguished from normal triggers. When next time LLD runs, it removes the added description, because there is no description in the trigger prototype.

Comment by Natalia Kagan [ 2015 Jul 02 ]

We are running zabbix on large scale and counting on zabbix dashboard.

This bug prevent our NOC (operators) working effectively.

Since it's really urgent (show stopper) for us, can you provide ETA when it can be fix?

It will be much appreciate if you guys could provide temporary workaround so we could work with the Dashboard.

Thanks

Comment by Aleksandrs Saveljevs [ 2015 Jul 02 ]

If you are in a hurry, you can apply the following patch:

$ svn di
Index: src/libs/zbxdbhigh/lld_trigger.c
===================================================================
--- src/libs/zbxdbhigh/lld_trigger.c    (revision 53288)
+++ src/libs/zbxdbhigh/lld_trigger.c    (working copy)
@@ -1266,7 +1266,7 @@
                                d = ",";
                        }
 
-                       if (0 != (trigger->flags & ZBX_FLAG_LLD_TRIGGER_UPDATE_COMMENTS))
+                       if (0 != (trigger->flags & ZBX_FLAG_LLD_TRIGGER_UPDATE_COMMENTS) && '\0' != *trigger->comments)
                        {
                                comments_esc = DBdyn_escape_string(trigger->comments);
                                zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset, "%scomments='%s'", d,

This will prevent LLD from clearing trigger description.

Comment by Natalia Kagan [ 2015 Jul 02 ]

Many Thanks ! will implement.

Comment by Natalia Kagan [ 2015 Jul 05 ]

Hi,

after change lld_trigger.c and replace zabbix_server.exe, I see the following error in /var/log/zabbix/zabbix_server.log :

[Z3005] query failed: [1064] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where triggerid=1089259' at line 1 [update triggers set where triggerid=1089259

is it relate to the fix ? I didn't see this error before.

Thanks

Comment by Aleksandrs Saveljevs [ 2015 Jul 06 ]

Yes, the problem is related to the patch I offered above. Sorry for not testing it properly. The following patch should be better:

$ svn di
Index: src/libs/zbxdbhigh/lld_trigger.c
===================================================================
--- src/libs/zbxdbhigh/lld_trigger.c    (revision 53288)
+++ src/libs/zbxdbhigh/lld_trigger.c    (working copy)
@@ -664,7 +664,7 @@
                buffer = zbx_strdup(buffer, comments_proto);
                substitute_discovery_macros(&buffer, jp_row, ZBX_MACRO_ANY, NULL, 0);
                zbx_lrtrim(buffer, ZBX_WHITESPACE);
-               if (0 != strcmp(trigger->comments, buffer))
+               if (0 != strcmp(trigger->comments, buffer) && '\0' != *buffer)
                {
                        trigger->comments_orig = trigger->comments;
                        trigger->comments = buffer;

Please revert the old patch and apply the new one instead.

Comment by Natalia Kagan [ 2015 Jul 06 ]

Now I see the following :

10672:20150706:052612.455 [Z3005] query failed: [1452] Cannot add or update a child row: a foreign key constraint fails (`zabbix`.`functions`, CONSTRAINT `c_functions_1` FOREIGN KEY (`itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE) [insert into functions (functionid,itemid,triggerid,function,parameter) values (2328445,1368708,1302612,'strlen',''),(2328446,1368708,1302612,'last','');
]

is it relate ?

Thanks

Comment by Aleksandrs Saveljevs [ 2015 Jul 06 ]

I currently do not see how this error could be related.

Comment by Natalia Kagan [ 2015 Aug 05 ]

Hi,

just want to update that your fix solved the problem - Many Thanks !!!

will it included in v3.0 ?

Thanks
Natalia

Comment by Aleksandrs Saveljevs [ 2015 Aug 05 ]

My patch above was just a simple hack that is specific to your use case. For the general use case, we currently do not have a solution.

For instance, we thought about forbidding to add a trigger description for LLD triggers through "Monitoring" -> "Triggers". This looks logical, because then the behavior would be the same as in "Configuration", and the current behavior of allowing to modify trigger description in "Monitoring" can be considered a bug. Unfortunately, that would break your use case entirely.

Comment by Natalia Kagan [ 2015 Aug 05 ]

we need/must possibility to add trigger description for LLD triggers through "Monitoring" -> "Triggers".
We have a lot of LLD and NOC (operators) adding description a lot via "Monitoring" -> "Triggers".

Please update once you will get any decision.

Thanks!

Comment by Ivo Kurzemnieks [ 2016 Oct 07 ]

We discussed this and decided not to allow comment updating for discovered triggers.

RESOLVED for 2.2 in svn://svn.zabbix.com/branches/dev/ZBX-9656-22

Comment by Ivo Kurzemnieks [ 2016 Oct 07 ]

(1) No translation string changes.

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2016 Oct 11 ]

(2) [A] Zabbix 2.2 PHP min version is 5.3
But you use short array syntax - [], which is available only from 5.4.

	$result = API::Trigger()->update([
		'triggerid' => getRequest('triggerid'),
		'comments' => $comments
	]);

No other frontend issue, after fixing you can merge to 2.2

iivs RESOLVED in r63103

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2016 Oct 11 ]

TESTED

Comment by Ivo Kurzemnieks [ 2016 Oct 12 ]

Fixed in:

  • pre-2.2.16rc1 r63116
  • pre-3.0.6rc1 r63117
  • pre-3.2.2rc1 r63118
  • pre-3.3.0 (trunk) r63119
Comment by Martins Valkovskis [ 2016 Oct 12 ]

(3) Documentation

RESOLVED

iivs Looks good to me.

CLOSED

Generated at Fri Apr 19 05:15:52 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.