[Nagios-devel] Patch for check_nt.c

Greg Vickers g.vickers at qut.edu.au
Thu Dec 4 21:51:59 UTC 2003

Hi all,

Please find attached my patch for version of check_nt.c. This patch 
adds the ability to check disk space based on the amount of Mb left on a 
partition. I wrote this because 1% of a 100Gb partition is still a lot of 
space! :D

The command line option is -m or --mb. The logic behind the checks is 
reversed against the percentage checks: the percentage method checks 
against the amount of disk space used; the Mb method checks against the 
amount of free space left.

I could have got the same functionality from NRPE_NT or by using a 3rd 
party solution, but I haven't had cause to deploy NRPE_NT yet, so I decided 
to patch check_nt.c.

Technical stuff:
I used Mb values rather than Gb values because of the use of the unsigned 
long type for the percentage values, which are used extensively through out 
check_nt.c. So rather than rewrite a lot of check_nt.c so you could 
specify, say, -w 1.2 (Gb), I decided to use Mb value on the command line. 
(Debugging revealed that when a float value is converted into an unsigned 
long, you would get a negative value in that unsigned long - not good when 
checking remaining disk space!)

Yves: I've submitted this patch to sourceforge.


Greg Vickers
Computer Systems Officer
Student Support and Systems,
Teaching and Learning Support Systems,
Queensland University of Technology,
Kelvin Grove Campus,

CRICOS No 00213J

Ph: 07 3864 8276 Fax: 07 3864 5425
Mob: 0416 001 674 SD: #66147  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: check_nt.c.diff
Type: application/octet-stream
Size: 4110 bytes
Desc: not available
URL: <http://lists.nagios.com/pipermail/nagios-devel/attachments/20031204/848efdeb/attachment.obj>

More information about the Nagios-devel mailing list