View previous topic :: View next topic |
Author |
Message |
evilmonkey
Joined: 03 Jul 2007 Posts: 6
|
Posted: Fri Nov 23, 2007 9:24 pm Post subject: UNC free space calculation |
|
|
Can you publish what formula you use to calculate percentage free for UNC?
Using linux RMA we get a discrepency on Debian based system. e.g.:
OS says:
9.1G 7.2G 1.5G 84% /var
Where 84% is amount used
HM says:
Reply: 21%
Where alert is set to alert on percent < 20%
I've also seen different behaviour than the above from RedHat where the mount didn't work (e.g. /var) but adding the dev device did.
I don't think this is a problem with RMA seems more like someone is using the HD idea of disk and the other the OS idea of disk. |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Mon Nov 26, 2007 4:29 am Post subject: |
|
|
Actually, RMA uses standard function statfs() to retrieve free space information. What exact free space parameter do you check: free space for current user or the total free space?
Regards,
Max
Last edited by KS-Soft Europe on Mon Nov 26, 2007 7:54 am; edited 1 time in total |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12795 Location: USA
|
Posted: Mon Nov 26, 2007 7:18 am Post subject: |
|
|
Code is pretty simple Code: |
struct statfs statbuf;
if (statfs(path, &statbuf)==0)
{
total = (int64)(statbuf.f_blocks) * statbuf.f_bsize;
free = (int64)(statbuf.f_bfree) * statbuf.f_bsize;
freeforuser = (int64)(statbuf.f_bavail) * statbuf.f_bsize;
return True;
}
else return False; |
Regards
Alex |
|
Back to top |
|
|
|