PDA

View Full Version : PATCH: fix OK events


sauron
25-11-2008, 11:58
I'm upgrade zabbix 1.4.7 to zabbix 1.6.1 with migrate from standalone to distributed. After this OK event broken. I'm debug this and found bug. When trigger updated this try update event but sorting wrong (need by clock but sorted by objectid). I'm create patch for fix this.

UPD: fix some issues in web interface. more fix in web interface.

Aly
25-11-2008, 12:54
This patch is wrong! There is no need in it.

sauron
25-11-2008, 13:35
Really?! Compare this:


zabbix=# select eventid,value,to_timestamp(clock),object,objectid from events where source=0 and object=0 and objectid=100100000012888 order by object desc,objectid desc,eventid desc limit 2;
eventid | value | to_timestamp | object | objectid
-----------------+-------+------------------------+--------+-----------------
100100000145899 | 0 | 2008-11-13 13:53:27+05 | 0 | 100100000012888
100100000145309 | 2 | 2008-11-13 08:44:20+05 | 0 | 100100000012888
(2 rows)

This default zabbix query. It's got wrong events.


select eventid,value,to_timestamp(clock),object,objectid from events where source=0 and object=0 and objectid=100100000012888 order by object desc,clock desc,eventid desc limit 2;
eventid | value | to_timestamp | object | objectid
-----------------+-------+------------------------+--------+-----------------
100100000001624 | 0 | 2008-11-25 15:50:25+05 | 0 | 100100000012888
100100000001623 | 1 | 2008-11-25 15:49:29+05 | 0 | 100100000012888
(2 rows)

This patched zabbix query. This right events.

Database not shuld sort by time if this not specifed. Our base contain eventid larger than new generated, and need sort by time. You can ignored this.

PS We used PostgreSQL.

sauron
25-11-2008, 13:46
Hmm. Now i'm think this migration bug. We migrate from 1.4 to 1.6 and next migrate from standalone to distributed. And Zabbix reset counters and generate this bug (smaller new id than older id). Where zabbix store counters?

Aly
25-11-2008, 14:47
Our base contain eventid larger than new generated...

This is definitely wrong!

id counters stored in table ids ;)

sauron
25-11-2008, 16:22
This is definitely wrong!

id counters stored in table ids ;)
Zabbix get max id in table?

Aly
25-11-2008, 16:29
it stores max id per table.

sauron
25-11-2008, 18:29
Bah! Fixed. Thx for help.

PS I'm think need check migration function. It's contain bugs.