Hi
There is a bug reported on the net-snmp site about filesystems returning 0 values for Total size, available and used (but not percentage utilised) on AIX :
https://sourceforge.net/tracker/?func=detail&atid=112694&aid=843719&group_id=12694
I have seen this in version 5.0.6, 5.1.1 and 5.1.2 (I haven't tested all the others).
I have fixed this issue and put the details in the comments on the web site, but I believe I need to submit the patch to this mailing list to get it included in further versions of the code.
Below are the details of the issue and the fix.
There only appears to be an issue if the filesystem is defined with a fragment size of 512 bytes - all other values (1024, 2048, 4096 bytes are OK).
AIX 4.3.3 sets up its /home and /var filesystems with a 512 byte fragment size.
SOLUTION
----------
The issue is caused by integer division in agent/mibgroup/ucd-snmp/disk.c - there are two lines which calculate a multiplier by dividing the blocksize and fragmentsize (if > 255) by 1024.
On AIX the fragment size can be 512, 1024, 2048 or 4096 so integer division is fine with all EXCEPT the 512 case beacuse C truncates towards zero (i.e. 512 / 1024 = 0 ).
The multiplier variable is a float but the truncation is done before the assignment so all the values are then multiplied by 0. (NB The percent calculation does not use the multiplier so that still works OK).
FIX :
(Line numbers refer to source from 5.1.2 - it should be straightforward to apply the same fix to other versions)
File : agent/mibgroup/ucd-snmp/disk.c
In function var_extensible_disk(...), two lines need changing :
line 658 :
WAS : multiplier = vfs.f_bsize / 1024;
NEW : multiplier = vfs.f_bsize / 1024.0;
line 661 :
WAS : multiplier = vfs.f_frsize / 1024;
NEW : multiplier = vfs.f_frsize / 1024.0;
The line 661 change is the one that really matters on AIX (it is within a conditional 'if (vfs.f_frsize > 255)' which is always true and overwrites the value calculated in line 658.
Adding the .0 to the constant 1024 forces the calculation to be done using floats (or maybe single or double ???).
Regards
Paul
-------------------------------------------------------------------------------
If you are not the intended recipient please notify the author by replying to
this email. Internet communications are not secure and therefore Red Squared
plc does not accept legal responsibility for the contents of this message.
Although we operate anti-virus programs, Red Squared does not accept
responsibility for any damage that may be caused by viruses being passed.
Any views or opinions presented are solely those of the author and do not
necessarily represent those of Red Squared.