Page 1 of 1

Missing scripts

Posted: Tue Jul 22, 2014 1:18 pm
by Callahan
Hi,

Try as I might I cannot find the checkfilesize script that is supposed to come with NSClient++. I'm running the latest version (V0.4.2) and I need to check the size of a folder containing multiple folders/files and warn me if it reaches set levels. Trouble is that the latest version of NSClient++ only seems to come with checkfiles or check_files scripts. Both of which (as fart as my testing goes) only check number of files in a given folder. People are clearly using the checkfilesize script - see here: http://www.nsclient.org/forums/search/folder+size/ so I don't know what I'm missing as it's definitely not installed with the latest copy of NSClient++.

Could someone point me in the direction of where to get this script?

Many thanks.

Re: Missing scripts

Posted: Wed Jul 23, 2014 1:20 am
by Box293
checkfilesize is not actually a script but an alias for the CheckFiles command.

CheckFiles will allow you to check just one file. Here are some examples using CheckFiles:

For example I want to check the size of C:\Windows\Regedit.exe. It is approx 417k.
Here you can see I am checking if it is over 500k in size:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 10.25.14.2 -c CheckFiles -a path=c:\\Windows\\regedit.exe "filter=size > 500k" "syntax=%filename%: %size%" MaxWarn=1 MaxCrit=1
CheckFile ok|'found files'=0;1;1
You can see that it found 0 files so it reported OK.

Here you can see I am checking if it is over 400k in size:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 10.25.14.2 -c CheckFiles -a path=c:\\Windows\\regedit.exe "filter=size > 400k" "syntax=%filename%: %size%" MaxWarn=1 MaxCrit=1
regedit.exe: 417K, found files: 1 > critical|'found files'=1;1;1
You can see that it found 1 files so it reported CRITICAL.

It's a little bit complicated because CheckFiles was written to be very flexible.

If you look in nsclient.ini you'll find a line alias_file_size which can perform the same check I've described above:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 10.25.14.2 -c alias_file_size -a c:\\Windows\\regedit.exe 500k
CheckFile ok|'found files'=0;1;1

/usr/local/nagios/libexec/check_nrpe -H 10.25.14.2 -c alias_file_size -a c:\\Windows\\regedit.exe 400k
regedit.exe 417K, found files: 1 > critical|'found files'=1;1;1

Re: Missing scripts

Posted: Wed Jul 23, 2014 6:47 am
by Callahan
Thanks for your explanation. I was looking for a script to check folder size though. I've found 2 so far - here: http://exchange.nagios.org/directory/Pl ... 29/details and here: http://exchange.nagios.org/directory/Pl ... bs/details. Both seem to do what I need but the documentation for them is limited.

If you know of an easier way, please let me know. Personally, I can't see why this script isn't rolled into NSClient++ as I think it's a pretty standard thing to want to do.

Re: Missing scripts

Posted: Wed Jul 23, 2014 4:32 pm
by Box293
Doh I misread your post, sorry about that.

If you've got a script that does the job then I would stick with that, NSClient gets too complicated at times and the documentation / examples do not work so it makes it very difficult to understand.