[Nagiosplug-devel] [ nagiosplug-Bugs-1516427 ] check_disk bugfix
SourceForge.net
noreply at sourceforge.net
Thu Jul 20 01:07:41 CEST 2006
Bugs item #1516427, was opened at 2006-07-03 17:08
Message generated for change (Comment added) made by tonvoon
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1516427&group_id=29880
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: General plugin execution
Group: None
>Status: Pending
Resolution: None
Priority: 5
Submitted By: Shakhab (shakhab)
>Assigned to: Ton Voon (tonvoon)
Summary: check_disk bugfix
Initial Comment:
check_disk (nagios-plugins 1.4.3) 1.64
I investigated the situation, when check_disk plugin
works incorrectly.
Plugins run under FreeBSD 5.5-RELEASE-p1 i386.
When any filesystem is full like this:
Filesystem 1K-blocks Used Avail Capacity
Mounted on
100% /dev
/dev/mirror/m0s1d 118766 109548 -282
100% /tmp
check_disk plugin lies:
# ./check_disk -p /dev/mirror/m0s1d -w 20% -c 10%
DISK CRITICAL - free space: /tmp 36028797018963968 MB
(31064015077900328%
inode=99%);| /tmp=116MB;92;103;98;115
You see the sign of signed operand is ignored, and as
a result we have incorrect size of filesystem's free
space.
I took a look at two files: check_disk.c and fsusage.h
and found several errors. I corrected them, built
check_disk, and afterwards everything is ok: it shows
correct information about free space and works
properly:
# ./check_disk -p /dev/mirror/m0s1d -w 20% -c 10%
DISK CRITICAL - free space: /tmp -0 MB (-0%
inode=99%);| /tmp=116MB;92;103;98;115
These are diffs:
# diff fsusage.h.new fsusage.h.orig
28,29c28,29
< intmax_t fsu_bfree; /* Free blocks
available to superuser. */
< intmax_t fsu_bavail; /* Free blocks
available to non-superuser. */
---
> uintmax_t fsu_bfree; /* Free blocks
available to superuser. */
> uintmax_t fsu_bavail; /* Free blocks
available to non-superuser. */
# diff check_disk.c.new check_disk.c.orig
160c160
< double free_space, free_space_pct, total_space,
inode_space_pct;
---
> float free_space, free_space_pct, total_space,
inode_space_pct;
256,258c256,258
< free_space = (double)
fsp.fsu_bavail*fsp.fsu_blocksize/mult;
< free_space_pct = (double)
fsp.fsu_bavail*100/fsp.fsu_blocks;
< total_space = (double)
fsp.fsu_blocks*fsp.fsu_blocksize/mult;
---
> free_space = (float)
fsp.fsu_bavail*fsp.fsu_blocksize/mult;
> free_space_pct = (float)
fsp.fsu_bavail*100/fsp.fsu_blocks;
> total_space = (float)
fsp.fsu_blocks*fsp.fsu_blocksize/mult;
----------------------------------------------------------------------
>Comment By: Ton Voon (tonvoon)
Date: 2006-07-20 00:07
Message:
Logged In: YES
user_id=664364
Shakhab,
Thanks for the report. There have been major changes to check_disk. Can you
please try the snapshot at http://nagiosplug.sf.net/snapshot as I think this
has been fixed.
Marking this call into PENDING.
Ton
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1516427&group_id=29880
More information about the Devel
mailing list