[ZBX-24541] Calculated item issue in zabbix 7 Created: 2024 May 24  Updated: 2024 May 26  Resolved: 2024 May 26

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Edvards Assignee: Zabbix Development Team
Resolution: Won't fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File image-2024-05-24-11-59-05-012.png     PNG File image-2024-05-24-11-59-47-294.png     PNG File image-2024-05-24-12-01-20-838.png     PNG File image-2024-05-24-12-05-46-251.png     PNG File image-2024-05-24-12-06-16-064.png    

 Description   

Issue: 

Want to create calcualted item which would sum the item value of 1 day.
But when i want to test the item i get error: 

Cannot evaluate expression: function argument "vfs.file.contents[/home/ubuntu/scripts/logs/test.log]" is not a numeric value at "sum("vfs.file.contents[/home/ubuntu/scripts/logs/test.log]",1d)" 

How to reproduce:
Create item with this key : 

vfs.file.contents[/home/ubuntu/scripts/logs/test.log]

test.log contains just digit 3

then create calculated item:

click on Test and then Get value and test

 

Either its a bug or sytax has changed? I understand that there is no docs for zabbix 7 calcualted items yet.

I tested exactlly the same on zabbix 5 and was succesfull to acomplish what i wanted.

 

 



 Comments   
Comment by Alexander Vladishev [ 2024 May 26 ]

Zabbix has two different functions called "sum". One is mathematical, and the other is aggregate. You are trying to use the mathematical one, where each parameter is either a constant or a mathematical expression. Please note that text data can be converted to a number. For example, the result of this function will be 5.

sum("1", 1 + 3)

In this case, you need to use the aggregate function "sum." The syntax of this function is different: sum(/host/key, <period>):

sum(/<host name>/vfs.file.contents[/home/ubuntu/scripts/logs/test.log], 1d)

In calculated items, the host name can be omitted. This would result in the following expression:

sum(//vfs.file.contents[/home/ubuntu/scripts/logs/test.log], 1d)

 

Generated at Sat Jun 28 05:08:32 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.