On 30 August 2011 14:20, David <[email protected]> wrote:
> As of net-snmp 5.7 disk space is incorrectly reported.
Actually, I think the disk space values are correct.
It's the calculation of percentage used that's failing
> UCD-SNMP-MIB::dskTotal.4 = INTEGER: 219227030
> UCD-SNMP-MIB::dskAvail.4 = INTEGER: 153871682
> UCD-SNMP-MIB::dskUsed.4 = INTEGER: 47817186
219227030 / (1024*1024) = 209.07
153871682 / (1024*1024) = 146.74
47817186 / (1024*1024) = 45.60
which match the results from df
> Filesystem Size Used Avail Capacity Mounted on
> /dev/mfid0s1f 209G 46G 147G 24% /usr
> Any ideas what is going wrong here.
The calculation of the percentage usage is as follows:
static int _percent( value, total ) {
return (int) (value * 100 / total );
}
(ucd-snmp/disk_hw.c:250-ish)
Your problem is almost certainly an arithmetic
overflow when multiplying the main value by 100.
What happens if you tweak this line to read
return (int) ( value / (total / 100));
?
The result should be the same, but without the
possibility of overflow.
Dave
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users