<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Arial, sans-serif" size="2">
<div>Bug in plugins/check_disk.c from nagios-plugins-1.4.12 (and prior)</div>
<div>* $Id: check_disk.c 1991 2008-05-07 10:02:42Z dermoth $</div>
<div> </div>
<div>The program collects the mounted filesystem data before it processes the command line arguments. This is a problem for multiple reasons:</div>
<div>* Why spend cycles on the filesystem if there is an error or --help in the arguments?</div>
<div>* The argument processing stats the -p options to mount them in an autofs environment, but they won't have been mounted yet...</div>
<div> </div>
<div>Detailed output showing the autofs problem:</div>
<div>$ sudo umount /home/userdir</div>
<div>$ plugins/check_disk -w 5% -c 1% -vvvvv -e -p /home/userdir</div>
<div>calling stat on /home/userdir</div>
<div>Thresholds(pct) for /home/userdir warn: 5.000000 crit 1.000000</div>
<div>calling stat on /home/userdir</div>
<div>DISK UNKNOWN - free space:|</div>
<div> </div>
<div>Simply changing the order of the mount_list creation does not fix the problem as process_arguments uses the mount list in calls to np_set_best_match(), but does nothing with the results.  I commented them and now the program works as it should.</div>
<div> </div>
<div>Diff output:</div>
<div>$ diff check_disk.c check_disk.c.new</div>
<div>193,194d192</div>
<div><   mount_list = read_file_system_list (0);</div>
<div><</div>
<div>200a199,200</div>
<div>>   mount_list = read_file_system_list (0);</div>
<div>></div>
<div>642c642</div>
<div><       np_set_best_match(se, mount_list, exact_match);</div>
<div>---</div>
<div>>       /* np_set_best_match(se, mount_list, exact_match); */</div>
<div>750c750</div>
<div><       np_set_best_match(path_select_list, mount_list, exact_match);</div>
<div>---</div>
<div>>       /* np_set_best_match(path_select_list, mount_list, exact_match); */</div>
<div> </div>
<div>Detailed output from fixed binary:</div>
<div>$ sudo umount /home/userdir</div>
<div>$ plugins/check_disk.new -w 5% -c 1% -vvvvv -e -p /home/userdir</div>
<div>calling stat on /home/userdir</div>
<div>Thresholds(pct) for /home/userdir warn: 5.000000 crit 1.000000</div>
<div>calling stat on /home/userdir</div>
<div>For /home/userdir, total=2129920, available=1047846, available_to_root=1047846, used=1082074, fsp.fsu_files=4133162, fsp.fsu_ffree=4031760</div>
<div>For /home/userdir, used_pct=51 free_pct=49 used_units=33814 free_units=32745 total_units=66560 used_inodes_pct=3 free_inodes_pct=97 fsp.fsu_blocksize=32768 mult=1048576</div>
<div>Freespace_units result=0</div>
<div>Freespace% result=0</div>
<div>Usedspace_units result=0</div>
<div>Usedspace_percent result=0</div>
<div>Usedinodes_percent result=0</div>
<div>Freeinodes_percent result=0</div>
<div>DISK OK /home/userdir 32745 MB (49% inode=97%);| /home/userdir=33814MB;63232;65894;0;66560</div>
<div> </div>
<div> </div>
<div>Thanks,</div>
<div>Erik</div>
<div> </div>
<div>Erik Welch - Unix Administrator</div>
<div>NVIDIA</div>
<div>2701 San Tomas Expwy</div>
<div>Santa Clara, CA 95050</div>
<div> </div>
<div> </div>
</font>

<DIV>
<HR>
</DIV>
<DIV>This email message is for the sole use of the intended recipient(s) and may 
contain confidential information.  Any unauthorized review, use, disclosure 
or distribution is prohibited.  If you are not the intended recipient, 
please contact the sender by reply email and destroy all copies of the original 
message. </DIV>
<DIV>
<HR>
</DIV>
<P></P>
</body>
</html>