Page 1 of 2
CheckDriveSize Exclude Certain Disk
Posted: Wed Dec 03, 2014 5:47 am
by warnox
Hi,
I want to know how to exclude a particular drive from the 'CheckDriveSize' command, in this case the Page File drive. The documentation doesn't seem very complete and doesn't have very detailed examples,
http://nsclient.org/nscp/wiki/CheckDisk/check_drivesize. While looking around it seems I should either be able to do this using 'filter' or 'matching' flags but I'm not sure exactly how.
Using the command below I can get the it to show only C and D drives but it doesn't seem to work for drive names, and I'm not sure how to turn it around so it excludes a drive.
Code: Select all
check_nrpe -H 192.168.1.1 -c CheckDriveSize -a FilterType=FIXED matching=.*[CD].* ShowAll=long CheckAll MinWarn=20G MinCrit=10G
According to another post,
http://www.nsclient.org/nscp/ticket/651, the command below should work. Although it includes a '!', but even when I create an alias it fails.
Alias
Code: Select all
[/settings/external scripts/alias]
alias_test = CheckDriveSize "filter=title not regexp '(?!(Page File))'" $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$
Command
Code: Select all
check_nrpe -H 192.168.1.1 -c alias_test -a ShowAll=long CheckAll MinWarn=20G MinCrit=10G
CRITICAL: Could not get free space for: filter filter reason: 3: The system cannot find the path specified.
Any help appreciated.
Re: CheckDriveSize Exclude Certain Disk
Posted: Wed Dec 03, 2014 1:43 pm
by sreinhardt
The command you show as working correctly, and the nsclient config\nrpe command that are not working, are quite different. You will need to set the filter, filtertype, match, etc to the same values as your working command to get the same results. Try the following instead:
Alias
Code: Select all
[/settings/external scripts/alias]
alias_test = CheckDriveSize FilterType=FIXED matching=.*[CD].* ShowAll=long CheckAll $ARG1$ $ARG2$ $ARG3$ $ARG4$
NRPE command
Code: Select all
check_nrpe -H 192.168.1.1 -c alias_test -a MinWarn=20G MinCrit=10G
Be sure to restart nsclient windows service after modifying the configs and before running the nrpe command.
Re: CheckDriveSize Exclude Certain Disk
Posted: Wed Dec 03, 2014 3:47 pm
by warnox
If I use your 'alias_test' definition I get.
Code: Select all
check_nrpe -H 192.168.1.1 -c alias_test -a MinWarn=20G MinCrit=10G
CRITICAL: Could not get free space for: $ARG3$ $ARG3$ reason: 3: The system cannot find the path specified.
But if I remove $ARG3$ and $ARG4$ I get
Code: Select all
check_nrpe -H 192.168.1.1 -c alias_test -a MinWarn=20G MinCrit=10G
CRITICAL: C:\: Total: 49.9G - Used: 13.2G (26%) - Free: 36.7G (74%), D:\: Total: 30G - Used: 24.1G (80%) - Free: 5.89G (20%) < critical|'C:\ %'=74%;59;79 'C:\'=13.157G;20;10;0;49.899 'D:\ %'=20%;33;66 'D:\'=24.111G;20;10;0;30
But, this I don't see how this would let me
exclude a certain drive from being checked?
Thanks again.
Re: CheckDriveSize Exclude Certain Disk
Posted: Wed Dec 03, 2014 6:00 pm
by sreinhardt
OH I see, it may take putting it right in front of me some times though. I will have to check into exclusions, I honestly have never done that and do not know if that is a valid option.
Re: CheckDriveSize Exclude Certain Disk
Posted: Thu Dec 04, 2014 12:33 am
by Box293
Let me help you out Spenser.
You can use the CheckAllOthers argument and specify the drive letter you don't want checked.
Test machine has a C:\ and E:\ fixed drive.
Check showing both drives:
Code: Select all
Command:
check_nrpe -H win2008r2-01 -t 30 -c CheckDriveSize ShowAll=long -a MinWarn=20G
Output:
OK: C:\: Total: 59.9G - Used: 12.6G (21%) - Free: 47.3G (79%), E:\: Total: 40G - Used: 91M (0%) - Free: 39.9G (100%)|'C:\ %'=21% 'C:\'=12.58GB 'E:\ %'=0% 'E:\'=90.97MB
Check excluding E:\ drive:
Code: Select all
Command:
check_nrpe -H win2008r2-01 -t 30 -c CheckDriveSize ShowAll=long -a MinWarn=20G CheckAllOthers Drive=E:
Output:
OK: C:\: Total: 59.9G - Used: 12.6G (21%) - Free: 47.3G (79%)|'C:\ %'=21% 'C:\'=12.58GB
Check excluding C:\ drive:
Code: Select all
Command:
check_nrpe -H win2008r2-01 -t 30 -c CheckDriveSize ShowAll=long -a MinWarn=20G CheckAllOthers Drive=C:
Output:
OK: E:\: Total: 40G - Used: 91M (0%) - Free: 39.9G (100%)|'E:\ %'=0% 'E:\'=90.97MB
Check excluding multiple drives:
Code: Select all
Command:
check_nrpe -H win2008r2-01 -t 30 -c CheckDriveSize ShowAll=long -a MinWarn=20G CheckAllOthers Drive=C: Drive=E:
Output:
OK: All drives within bounds.
Re: CheckDriveSize Exclude Certain Disk
Posted: Thu Dec 04, 2014 4:23 am
by warnox
Ah, I missed that argument. The problem is that the same drive letter is not used for the 'Page File' drive on every server, hence I would like to do it by name. Say, if it contains 'page' or such.
Is it possible to do this with RegEx somehow as per the link on my first page, using 'matching' or 'filter'?
Re: CheckDriveSize Exclude Certain Disk
Posted: Thu Dec 04, 2014 5:47 am
by Box293
Yeah I'm not really sure about that. If you knew that the combination of drive letters was always Q: P: and X: then you could do Drive=Q: Drive=P: Drive=X: however you run the chance of one of these drive letters being a data drive.
I did some more reading and it looks like NSClient++ 0.4.2 might be able to do it HOWEVER I would steel clear of 0.4.2 as it has lots of weird things going wrong with it. 0.4.1 works OK but it doesn't include the newer options that 0.4.2 has. I would wait for 0.4.3.
It sounds like you need to sit down and set some standards for the drive letter used for page drives.
Re: CheckDriveSize Exclude Certain Disk
Posted: Thu Dec 04, 2014 5:58 am
by warnox
Alright, looks like I might have to live with a CRITICAL error on the console for a while, unless I separate this server out of the host group (which I rather not do).
Do you have any documentation showing how this would work in 0.4.2 (or 0.4.3)?
Thanks again.
Re: CheckDriveSize Exclude Certain Disk
Posted: Thu Dec 04, 2014 3:29 pm
by sreinhardt
Not really, unless nsclient provides it on their site. We don't actually develop that agent. Box might chime back in with some useful stuff though!
Re: CheckDriveSize Exclude Certain Disk
Posted: Thu Dec 04, 2014 4:12 pm
by Box293
This is the page that has some information about excluding in 0.4.2:
http://www.nsclient.org/nscp/ticket/651
You could also post a request on the project in github [nscp]. Something like being able to exclude a drive based on the label of a partition.
https://github.com/mickem/nscp