Closed neo954 closed 7 years ago
301 $expected = 1;
302 $msg = "The free space of /var directory is more than $expected G";
303 $diskspace = `df -h|awk '{print \$4,\$6}'|grep -E "/var\$"`;
304 if (!$?) {
305 chomp($diskspace);
306 my ($size, $dir) = split(" ", $diskspace);
307 $size =~ s/G//g;
308 probe_utils->send_msg("$output", "d", "The free space of /var is $size G") if ($verbose);
309 if ($size < $expected) {
310 probe_utils->send_msg("$output", "w", "The free space of /var is less than $expected G");
311 } else {
312 probe_utils->send_msg("$output", "o", "$msg");
313 }
314 }
The free space is calculated by run df -h
, which is totally wrong. With -h
command line argument of df
, the unit will change base the number in order to make it "human read". It will show 628M
as the example above, or 1.2T
when there are large amount of disk space.
Actually, the h
in the command df -h
means "human readable". See man df
. Since xcatprobe
is a piece of machine code instead of human, use "human readable" display here is improper.
And when the /var directory is not on a separate file system. This checking will not be performed at all. Which is pity :'(
When there is anther file system mounted on a directory with the name ending /var, let us say /srv/chroot/ia32/var, this piece of code will display an improper result as well. Since it checks with grep -E "/var$"
. Which is not good.
Fix this bug by pull request #1701, @neo954 , could you help to verify it? thanks
Please read the last comment I wrote. That problem is still there.
Okay, I will consider this bug was fixed properly, and close this one.
Sorry. While I was reading the patch. There is one problem still unfixed.
Consider the directory /tmp
or /install
is not a separate file system, and is not a part of the root file system as well. Instead, it is a symbolic link point to another directory in a separate file system other than the root file system. In this case, the code logic is wrong. And the correct free space is not calculated correctly.
For example, /install
is a symbolic link point to /media/cnfs/install
. While /media/cnfs
is a NFS mounted file system, which is a GPFS file system at the back end. This kind of configuration is quite common in large HPC cluster.
@neo954 , I have fixed this issue by PR #2071, Could you verify it? thanks
@hu-weihua,
Cool. I will verify this issue ASAP after new daily build is available.
This issue was fixed and verified with 2.12.4 RC build. I will close this one.
While I do not have enough free disk space under
/var
,xcatprobe
reports I have.