[ZBX-25199] Bad disk space calc due to type conversion in Linux by SNMP Created: 2024 Sep 09  Updated: 2025 May 29  Resolved: 2024 Sep 29

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Templates (T)
Affects Version/s: 7.0.3
Fix Version/s: 7.0.5rc1, 7.2.0alpha1

Type: Problem report Priority: Major
Reporter: Dennis Skinner Assignee: Denis Rasikhov (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
Team: Team INT
Story Points: 1

 Description   

For Preprocessing on Item Prototypes Space: Available, Total,  Used and Used in % if the value returned from JSON is large enough, Javascript doesn't handle the type conversion properly and the returned value ends up being in ZB instead of TB.  Parsing the values as Int and Float seems to resolve the issue:
 
 

var portionHigh = 4294967296; 

var obj = JSON.parse(value); 

var dskTotalHigh = parseInt(obj['dskTotalHigh'], 10), 
    dskTotalLow = parseFloat(obj['dskTotalLow']);   

return (dskTotalHigh * portionHigh + dskTotalLow) * 1024;

 
 
I suspect it would be good to do explicit type conversions on all of the objects returned from JSON anywhere we do math.
 
Example JSON for "value" above:
 

{#SNMPINDEX}":"30","dskEntry":"30","dskPercentNode":"0","dskTotalLow":"1763059968","dskTotalHigh":"3","dskAvailLow":"360840500","dskAvailHigh":"1","dskUsedLow":"1402219468","dskUsedHigh":"2"}

 
Space: Total without parsing: 1.3194139533492538e+23 (incorrect)
Space: Total with parsing: 14999512940544  (correct)
 



 Comments   
Comment by Dennis Skinner [ 2024 Sep 09 ]

Sorry, should have mentioned this is in the Item Prototypes for:

"SNMP walk mounted filesystems: Mounted filesystem discovery" in the Linux by SNMP.

Comment by Denis Rasikhov (Inactive) [ 2024 Sep 27 ]

Fixed in:

Generated at Sat Dec 13 23:08:33 EET 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.