[Nagiosplug-devel] Check_disk plugin update

Erik Welch ewelch at nvidia.com
Fri Nov 7 20:19:26 CET 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ah, the benefits of unit testing. Proves me wrong when I so desperately deserve it :-).  My testing consisted of running it in my limited environment and it worked like a charm.  (This is what happens when you have a perl/python programmer learn enough C to try and debug a problem).  Your suggestion to rebuild the mount_list worked perfectly.

On a system that had 120 mounts (115 automounts), there doesn't seem to be much of a performance hit, though I only check one path at a time. I umounted the test volume before each run, and did a couple runs of each binary, dropped the first time result of each, and averaged the times.  Let me know if you want anything more than the output of time for perf testing.


$ time ./check_disk.badautofs -vvvv -w 5% -c 1% -p /home/userdir
calling stat on /home/userdir
Thresholds(pct) for /home/userdir warn: 5.000000 crit 1.000000
calling stat on /home/userdir
DISK UNKNOWN - free space:|
 
real    0m0.018s
user    0m0.000s
sys     0m0.000s

$ time plugins/check_disk -vvvv -w 5% -c 1% -p /home/userdir
calling stat on /home/userdir
Thresholds(pct) for /home/userdir warn: 5.000000 crit 1.000000
calling stat on /home/userdir
For /home/userdir, total=2129920, available=1047858, available_to_root=1047858, used=1082062, fsp.fsu_files=4133162, fsp.fsu_ffree=4031761
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
Freespace_units result=0
Freespace% result=0
Usedspace_units result=0
Usedspace_percent result=0
Usedinodes_percent result=0
Freeinodes_percent result=0
DISK OK - free space: /home/userdir 32745 MB (49% inode=97%);| /home/userdir=33814MB;63232;65894;0;66560
 
real    0m0.027s
user    0m0.000s
sys     0m0.000s

Another thing that I've found is that the version of automount is important.
One of my test systems RHEL R3U2 (kernel 2.4.21-47 automount v4.1.3-154) and none of the check_disk versions work. The stat() never seems to mount the volume. I'm not going to troubleshoot this as this is an old crufty system.
The patched check_disk works on both my RedHat 7.2 (kernel 2.4.35 automount v3.1.7) and CentOS 4.5 (kernel 2.6.24.2, automount v5.0.2) systems.

Can you run the attached patch through your unit tests to see if I break anything new?

I couldn't find a way to add an ARGV to manage the repopulation of mount_list as it needs to happen during process_arguments() in the "case 'p'" section before the np_set_best_match() is executed, but I also couldn't spend much time on this now that I have a working solution...



 <<check_disk.patch>> 

Thanks,
erik

Erik Welch - Unix Administrator
NVIDIA
2701 San Tomas Expwy
Santa Clara, CA 95050

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (MingW32)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAkkUlL4ACgkQgGzpy3g56ScpogCdHf5/A8hv0t5JOSKWnuagxNlr
J/0AnR0CnzNX8V4DzP7lWrcezvvEqLvC
=uxFi
-----END PGP SIGNATURE-----

-----------------------------------------------------------------------------------
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.
-----------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: check_disk.patch.gpg
Type: application/octet-stream
Size: 819 bytes
Desc: check_disk.patch.gpg
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20081107/642e2798/attachment.obj>


More information about the Devel mailing list