Type: Problem report
Affects Version/s: 4.2.8, 4.4.7
Environment:Zabbix 4.2 or 4.4, latest release, Ubuntu 18.
Sprint:Sprint 64 (May 2020), Sprint 65 (Jun 2020), Sprint 66 (Jul 2020)
I have a calculated item that is expected to return a positive integer. In some rare cases, a negative number is being returned by the calculation. I want to use Item Preprocessing with "custom on fail" to set the Item to return a value of "0" instead of the negative number. See attached screenshot for Preprocessing options used.
With this configuration set, the item gets into "Not supported" state with the error message "Received value [-5.000000] is not suitable for value type [Numeric (unsigned)]." which should not be happening. Instead of such an error message, the value should just be set to 0 which is indeed a valid Unsigned Integer. I suppose the checking for Value Type is happening too early in this specific combination.
On the other hand, if I configure the Item the exact same way, but instead of being a Calculated Item I configure it to be a Agent-based item, getting a negative number back (doesn't matter whether a "negative Integer" or a "negative Float"), the Preprocessing with custom on fail works correctly and in "Latest Data" I see a value of "0" for the item.
Steps to reproduce:
- Create a Calculated Item and put the following in the forumula: "10-15", Value Type "Numeric (unsigned)
- Set the Pre-Processing as shown in attached screenshot
- Observe output of the Item in "Latest Data"
Item will be "Not supported" with following error message: "Received value [-5.000000] is not suitable for value type [Numeric (unsigned)]."
Value set to 0
Steps to reproduce it works with an agent based item:
- Create a Userparameter: UserParameter=neg.num,echo "-5.000"
- Change the existing test item to be a Agent based item with key "neg.num", leave value type at "Numeric (unsigned)" and Preprocessing as-is.
- Item will change to value of 0 as expected
The desired Custom on Fail works if I set the Value Type to "Float", but this should not be the solution to the problem.