[ZBX-11125] Interesting behaviour of nodata(0) Created: 2016 Aug 24  Updated: 2017 May 30  Resolved: 2016 Oct 27

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A), Server (S)
Affects Version/s: 3.2.0beta1
Fix Version/s: 3.0.6rc1, 3.2.2rc1, 3.4.0alpha1

Type: Incident report Priority: Trivial
Reporter: Glebs Ivanovskis (Inactive) Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: calculateditems, triggerfunctions
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

This can be considered either a nasty bug or a very cool undocumented feature.

nodata(0) returns 0 (there is data) for items with at least one value stored in history or value cache.

nodata(0) returns 1 (there is no data) for items with empty history (no data gathered or all data deleted by housekeeper and value cache cleared).



 Comments   
Comment by Vladislavs Sokurenko [ 2016 Aug 31 ]

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

steps:

test "{test1:agent.ping.nodata(0)}=1"

expected:
Server shows invalid fist parameter error

steps2:

test "{test1:agent.ping.nodata(5)}=1"

Expected:
There are no more errors and trigger works as before, if you kill agent you get your trigger activated after 5 seconds.
Reactivate agent and trigger resolves

Comment by Andris Mednis [ 2016 Sep 20 ]

Server side successfully tested. It should be documented that nodata(0) is not valid.

martins-v Interestingly the documentation already says that "The period should not be less than 30 seconds." So is it untrue for 2.0-3.2 then?

sasha It because timer process calculates such trigger functions every 30 seconds.
First parameter of nodata() function can be less than 30 seconds, but it won't give the expected effect.

glebs.ivanovskis But nodata() can also be used in calculated items, where update interval is set by user and parameter values less than 30 seconds can actually make sense.

martins-v Thanks for all the explanations.

Documented in Trigger functions for 3.4.

sasha Copied changes to 3.0 and 3.2. CLOSED

Comment by richlv [ 2016 Sep 20 ]

there's one case where nodata(0) could be useful - let's say somebody has a bunch of items, and they want to alert on items that have received a value at least one, but have no data now. something like this could do it :

{h:i.nodata(0)}=0 and {h:i.nodata(300)}=1

if that sounds useful to somebody, they should probably open a new feature request to revert the changes in this issue

Comment by Alexander Vladishev [ 2016 Sep 22 ]

Such functions nodata(0) can produce heavy load on the database. This undocumented functionality must be dropped.

Comment by richlv [ 2016 Sep 22 ]

thanks for the update, that's a good reason. it could probably be worked around by introducing an item-level property "has received data", but the need for such feature doesn't seem to be there yet.

Comment by Alexander Vladishev [ 2016 Oct 24 ]

API is ready for testing.

Comment by Alexander Vladishev [ 2016 Oct 25 ]

Server side was successfully tested.

Comment by Ivo Kurzemnieks [ 2016 Oct 25 ]

(1) No translation string changes.

sasha CLOSED

Comment by Ivo Kurzemnieks [ 2016 Oct 25 ]

Frontend TESTED

Comment by Alexander Vladishev [ 2016 Oct 27 ]

Released in:

  • pre-3.0.6rc1 r63397
  • pre-3.2.2rc1 r63396
  • pre-3.3.0 (trunk) r63395
Generated at Sat Apr 20 09:25:56 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.