[ZBX-7573] item with flexible interval checked at a wrong time Created: 2013 Dec 21  Updated: 2017 May 30  Resolved: 2014 Jan 03

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 2.2.1
Fix Version/s: 2.0.11rc1, 2.2.2rc1, 2.3.0

Type: Incident report Priority: Major
Reporter: Aleksandrs Saveljevs Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: flexibleintervals
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate

 Description   

I have two items scheduled to be checked once a week on Mondays:

  • Item A should be checked early morning using interval "60" + "1,03:45-03:46".
  • Item B should be checked during the day using interval "60" + "1,12:45-12:46".

However, both of these items were checked today in the morning (on Saturday). Here is the list of last checked times for these two items:

  • Item A:

2013.Dec.21 08:25:06 No (0)
2013.Dec.16 03:45:06 Yes (1)
2013.Dec.09 03:45:06 Yes (1)

  • Item B:

2013.Dec.21 08:25:07 No (0)
2013.Dec.16 12:45:07 Yes (1)
2013.Dec.09 12:45:07 Yes (1)



 Comments   
Comment by Aleksandrs Saveljevs [ 2013 Dec 21 ]
mysql> select itemid, from_unixtime(clock), clock, ns, value from history_uint where itemid=23106 order by clock desc;
+--------+----------------------+------------+-----------+-------+
| itemid | from_unixtime(clock) | clock      | ns        | value |
+--------+----------------------+------------+-----------+-------+
|  23106 | 2013-12-21 08:25:06  | 1387607106 | 591003940 |     0 |
|  23106 | 2013-12-16 03:45:06  | 1387158306 | 914034405 |     1 |
|  23106 | 2013-12-09 03:45:06  | 1386553506 | 493183023 |     1 |
+--------+----------------------+------------+-----------+-------+

mysql> select itemid, from_unixtime(clock), clock, ns, value from history_uint where itemid=23107 order by clock desc;
+--------+----------------------+------------+-----------+-------+
| itemid | from_unixtime(clock) | clock      | ns        | value |
+--------+----------------------+------------+-----------+-------+
|  23107 | 2013-12-21 08:25:07  | 1387607107 | 597804269 |     0 |
|  23107 | 2013-12-16 12:45:07  | 1387190707 |  53387764 |     1 |
|  23107 | 2013-12-09 12:45:07  | 1386585907 | 423022265 |     1 |
+--------+----------------------+------------+-----------+-------+
Comment by Strahinja Kustudic [ 2013 Dec 21 ]

I also had the same problem with one item which is in a template used on 230 servers. The item's flexible interval is "2000" + 1-7,08:00-09:00 and today it executed when it was supposed to, but it also executed from one hour to a few hours later depending on a server. Here are the last 4 executions on a few servers:

server-001:
12/21/2013 10:04:05 AM
12/21/2013 08:57:25 AM
12/21/2013 08:24:05 AM
12/20/2013 08:30:45 AM

server-100:
12/21/2013 10:04:34 AM
12/21/2013 08:57:54 AM
12/21/2013 08:24:34 AM
12/20/2013 08:31:14 AM

server-150:
12/21/2013 12:26:24 PM
12/21/2013 08:33:04 AM
12/20/2013 08:39:44 AM
12/20/2013 08:06:24 AM

server-224:
12/21/2013 04:14:25 PM
12/21/2013 08:27:45 AM
12/20/2013 08:34:25 AM
12/20/2013 08:01:05 AM

Also I'm running Zabbix 2.0.6, so this probably isn't an issue just with the latest version. I also find this very odd that it had happened to me as well as the issue creator on the same day. It must be some strange bug with Zabbix and today's date.

Comment by richlv [ 2013 Dec 22 ]

for the record, we changed how flexible interval calculation worked in ZBX-4852

Comment by Aleksandrs Saveljevs [ 2013 Dec 27 ]

It is interesting to note that December 21, 08:25:06 is also mentioned in the above issue at https://support.zabbix.com/browse/ZBX-4852?focusedCommentId=58308&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-58308 .

Comment by Aleksandrs Saveljevs [ 2013 Dec 28 ]

Let me describe the problem briefly. There is a function calculate_item_nextcheck() and the comment used to say the following: "if item check is forbidden with delay=0 (default and flexible), a timestamp approximately one year in the future is returned". That, however, was not true. The value actually returned was nextcheck calculated as if item's update interval was set to once a year, which could as well happen in the near future, and this was the case on December 21.

I have changed this function in two ways. First of all, instead of using SEC_PER_YEAR to signify that an item should not be checked, we now use 0, same as "delay" value in the database. Second, if item should not be checked, this function now returns a timestamp for January 1, 2038.

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-7573 .

Comment by Aleksandrs Saveljevs [ 2014 Jan 02 ]

Reopening, because the changes were only done on the server side. Frontend side should be fixed, too.

Comment by Aleksandrs Saveljevs [ 2014 Jan 03 ]

Frontend side fixed. Development branch svn://svn.zabbix.com/branches/dev/ZBX-7573 available for review.

Comment by Aleksandrs Saveljevs [ 2014 Jan 07 ]

There were conflicts when merging from 2.0 into 2.2, so I have merged the changes in a separate development branch. URL is the same: svn://svn.zabbix.com/branches/dev/ZBX-7573 .

sasha Successfully tested! CLOSED

Comment by Aleksandrs Saveljevs [ 2014 Jan 08 ]

Fixed in pre-2.0.11 r41324, pre-2.2.2 r41373, and pre-2.3.0 (trunk) r41374.

Generated at Fri Mar 29 01:17:57 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.