Page 2 of 2
Re: Change Drive Checks to GB instead of percentage
Posted: Mon May 11, 2015 1:47 pm
by jdalrymple
Let's take this stuff out and see if that helps:
Code: Select all
; VERIFY MODE - Comma separated list of verification flags to set on the SSL socket. none The server will not send a client certificate request to the client, so the client will not send a certificate. peer The server sends a client certificate request to the client and the certificate returned (if any) is checked. fail-if-no-cert if the client did not return a certificate, the TLS/SSL handshake is immediately terminated. This flag must be used together with peer. peer-cert Alias for peer and fail-if-no-cert. workarounds Various bug workarounds. single Always create a new key when using tmp_dh parameters. client-once Only request a client certificate on the initial TLS/SSL handshake. This flag must be used together with verify-peer
verify mode = peer-cert
I'm totally unfamiliar with it so I really don't know what effect it could be having. It sounds like an extended client/server cert based auth mechanism, which I assume is NOT something you have in place?
Re: Change Drive Checks to GB instead of percentage
Posted: Mon May 11, 2015 1:55 pm
by jkinning
Well I am getting a different error now -
./check_nrpe -H <winhost>
CHECK_NRPE: Response packet had invalid CRC32.
Code: Select all
# If you want to fill this file with all avalible options run the following command:
# nscp settings --generate --add-defaults --load-all
# If you want to activate a module and bring in all its options use:
# nscp settings --activate-module <MODULE NAME> --add-defaults
# For details run: nscp settings --help
; Undocumented section
[/settings/default]
; ALLOWED HOSTS - A comaseparated list of allowed hosts. You can use netmasks (/ syntax) or * to create ranges.
allowed hosts = <nagios server>
; Undocumented section
[/settings/NRPE/server]
allow ciphers = ADH
; VERIFY MODE - Comma separated list of verification flags to set on the SSL socket. default-workarounds Various workarounds for what I understand to be broken ssl implementations no-sslv2 Do not use the SSLv2 protocol. no-sslv3 Do not use the SSLv3 protocol. no-tlsv1 Do not use the TLSv1 protocol. single-dh-use Always create a new key when using temporary/ephemeral DH parameters. This option must be used to prevent small subgroup attacks, when the DH parameters were not generated using "strong" primes (e.g. when using DSA-parameters).
; ssl options =
; COMMAND ALLOW NASTY META CHARS - This option determines whether or not the we will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments.
allow nasty characters = true
; ALLOW INSECURE CHIPHERS and ENCRYPTION - Only enable this if you are using legacy check_nrpe client.
insecure = true
; VERIFY MODE - Comma separated list of verification flags to set on the SSL socket. none The server will not send a client certificate request to the client, so the client will not send a certificate. peer The server sends a client certificate request to the client and the certificate returned (if any) is checked. fail-if-no-cert if the client did not return a certificate, the TLS/SSL handshake is immediately terminated. This flag must be used together with peer. peer-cert Alias for peer and fail-if-no-cert. workarounds Various bug workarounds. single Always create a new key when using tmp_dh parameters. client-once Only request a client certificate on the initial TLS/SSL handshake. This flag must be used together with verify-peer
verify mode = none
; COMMAND ARGUMENT PROCESSING - This option determines whether or not the we will allow clients to specify arguments to commands that are executed.
allow arguments = true
; PAYLOAD LENGTH - Length of payload to/from the NRPE agent. This is a hard specific value so you have to "configure" (read recompile) your NRPE agent to use the same value for it to work.
payload length = 1014
; ENABLE SSL ENCRYPTION - This option controls if SSL should be enabled.
use ssl = true
; Undocumented section
[/modules]
; Undocumented key
Scheduler = 0
; NRPEServer - A server that listens for incoming NRPE connection and processes incoming requests.
NRPEServer = 1
; CheckSystem - Various system related checks, such as CPU load, process state, service state memory usage and PDH counters.
CheckSystem = 1
; NSClientServer - A server that listens for incoming check_nt connection and processes incoming requests.
NSClientServer = 1
; CheckExternalScripts - Execute external scripts
CheckExternalScripts = 1
; CheckHelpers - Various helper function to extend other checks.
CheckHelpers = 1
; CheckEventLog - Check for errors and warnings in the event log.
CheckEventLog = 1
; CheckNSCP - Use this module to check the healt and status of NSClient++ it self
CheckNSCP = 1
; CheckDisk - CheckDisk can check various file and disk related things.
CheckDisk = 1
; A list of templates for wrapped scripts.
[/settings/external scripts/wrappings]
; WRAPPING - An external script wrapping
bat = scripts\\%SCRIPT% %ARGS%
; WRAPPING - An external script wrapping
An alias is an internal command that has been predefined to provide a single command without arguments. Be careful so you don't create loops (ie check_loop = check_a, check_a=check_loop)
; WRAPPING - An external script wrapping
vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS%
; WRAPPING - An external script wrapping
ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
[/settings/external scripts/alias]
; ALIAS - Query alias
alias_volumes_loose = check_drivesize
; ALIAS - Query alias
alias_volumes = check_drivesize
; ALIAS - Query alias
alias_sched_all = check_tasksched show-all "syntax=${title}: ${exit_code}" "crit=exit_code ne 0"
; ALIAS - Query alias
alias_service = check_service
; ALIAS - Query alias
alias_process_stopped = check_process "process=$ARG1$" "crit=state != 'stopped'"
; ALIAS - Query alias
alias_process_hung = check_process "filter=is_hung" "crit=count>0"
; ALIAS - Query alias
alias_process_count = check_process "process=$ARG1$" "warn=count > $ARG2$" "crit=count > $ARG3$"
; ALIAS - Query alias
alias_mem = check_memory
; ALIAS - Query alias
alias_file_size = check_files "path=$ARG1$" "crit=size > $ARG2$" "top-syntax=${list}" "detail-syntax=${filename] ${size}" max-dir-depth=10
; ALIAS - Query alias
alias_disk = check_drivesize
; ALIAS - Query alias
alias_cpu_ex = check_cpu "warn=load > $ARG1$" "crit=load > $ARG2$" time=5m time=1m time=30s
; ALIAS - Query alias
alias_file_age = check_files "path=$ARG1$" "crit=written > $ARG2$" "top-syntax=${list}" "detail-syntax=${filename] ${written}" max-dir-depth=10
; ALIAS - Query alias
alias_service_ex = check_service "exclude=Net Driver HPZ12" "exclude=Pml Driver HPZ12" exclude=stisvc
; ALIAS - Query alias
alias_event_log = check_eventlog
; ALIAS - Query alias
alias_cpu = check_cpu
; ALIAS - Query alias
alias_process = check_process "process=$ARG1$" "crit=state != 'started'"
; ALIAS - Query alias
alias_up = check_uptime
; ALIAS - Query alias
alias_sched_task = check_tasksched show-all "filter=title eq '$ARG1$'" "detail-syntax=${title} (${exit_code})" "crit=exit_code ne 0"
; ALIAS - Query alias
alias_disk_loose = check_drivesize
; ALIAS - Query alias
alias_sched_long = check_tasksched "filter=status = 'running'" "detail-syntax=${title} (${most_recent_run_time})" "crit=most_recent_run_time < -$ARG1$"
Re: Change Drive Checks to GB instead of percentage
Posted: Mon May 11, 2015 2:04 pm
by jdalrymple
Try replacing your nsclient.ini with this, I removed the unnecessary cruft:
Code: Select all
[/settings/default]
allowed hosts = <nagios server>
[/settings/NRPE/server]
allow ciphers = ADH
allow nasty characters = true
insecure = true
allow arguments = true
payload length = 1014
use ssl = true
[/modules]
NRPEServer = 1
CheckSystem = 1
NSClientServer = 1
CheckExternalScripts = 1
CheckHelpers = 1
CheckEventLog = 1
CheckNSCP = 1
CheckDisk = 1
Re: Change Drive Checks to GB instead of percentage
Posted: Mon May 11, 2015 2:07 pm
by jkinning
You are never going to believe this! Boy it has been a long day. After I looked over everything again very slowly I realize I have payload length = 1014 DOH! I changed it to payload length = 1024 and got a return on the check -
./check_nrpe -H <winhost>
I (0.4.3.131 2015-02-15) seem to be doing fine...
Now I'll try out the disk check. Thanks for sticking with me!! You gotta love the typos.

Re: Change Drive Checks to GB instead of percentage
Posted: Mon May 11, 2015 2:32 pm
by jdalrymple
I'm sorry that I didn't spot that typo for you - would have saved us both a bunch of time and effort.
I think from here you'll find the disk check is going to be trivial. I'll leave the thread open though so just shout out if you run into any more snags.
Re: Change Drive Checks to GB instead of percentage
Posted: Thu May 14, 2015 10:56 am
by jkinning
In the examples given:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H <client ip> -p 5666 -c CheckDriveSize -a ShowAll Drive=D MinWarnFree=2G MinCritFree=1G
Code: Select all
[jdalrymple@localhost libexec]$ ./check_nrpe -H <winhost> -c check_drivesize -a "warn=free<8G" "crit=free<3G" "drive=c:"
OK All 1 drive(s) are ok|'c: free'=8.94279GB;8;3;0;107.46972 'c: free %'=8%;7;2;0;100
[jdalrymple@localhost libexec]$ ./check_nrpe -H <winhost> -c check_drivesize -a "warn=free<10G" "crit=free<3G" "drive=c:"
WARNING c:: 98.527GB/107.47GB used|'c: free'=8.94279GB;10;3;0;107.46972 'c: free %'=8%;9;2;0;100
Is there a way to show ALL disks instead of specify a Drive=? I try using ShowAll and get No Drives found.
./check_nrpe -H <host> -t 30 -c CheckDriveSize -a "Warn=free<4G" "Crit=free<2G" ShowAll FilterType=Fixed
So I tried this and the output doesn't seem right.
./check_nrpe -H <host> -t 30 -c CheckDriveSize -a ShowAll MinWarn=4G MinCrit=2G FilterType=Fixed CheckAll
CRITICAL critical(: Total: 99.996MB - Used: 30.75MB (31%) - Free: 69.246MB (69%)), C:\: Total: 29.9GB - Used: 24.655GB (83%) - Free: 5.245GB (17%), D:\: Total: 14.997GB - Used: 8.512GB (57%) - Free: 6.485GB (43%)|'C:\ free'=5.24547GB;4;2;0;29.90038 'C:\ free %'=17%;13;6;0;100 'D:\ free'=6.48526GB;4;2;0;14.99706 'D:\ free %'=43%;26;13;0;100 '\\?\Volume{bc5e05ee-a120-11e2-9576-806e6f6e6963}\ free'=69.24609MB;4096;2048;0;99.99609 '\\?\Volume{bc5e05ee-a120-11e2-9576-806e6f6e6963}\ free %'=69%;4096;2048;0;100
The drives have more than 2G free so why would it show CRITICAL?
I also tried this thinking it would reflect "free" space but same result.
./check_nrpe -H <host> -t 30 -c CheckDriveSize -a ShowAll MinWarnFree=4G MinCritFree=2G FilterType=Fixed CheckAll
CRITICAL critical(: Total: 99.996MB - Used: 30.75MB (31%) - Free: 69.246MB (69%)), C:\: Total: 29.9GB - Used: 24.655GB (83%) - Free: 5.245GB (17%), D:\: Total: 14.997GB - Used: 8.512GB (57%) - Free: 6.485GB (43%)|'C:\ free'=5.24547GB;4;2;0;29.90038 'C:\ free %'=17%;13;6;0;100 'D:\ free'=6.48526GB;4;2;0;14.99706 'D:\ free %'=43%;26;13;0;100 '\\?\Volume{bc5e05ee-a120-11e2-9576-806e6f6e6963}\ free'=69.24609MB;4096;2048;0;99.99609 '\\?\Volume{bc5e05ee-a120-11e2-9576-806e6f6e6963}\ free %'=69%;4096;2048;0;100
Re: Change Drive Checks to GB instead of percentage
Posted: Thu May 14, 2015 1:03 pm
by jdalrymple
I don't know how to filter out the system partition:
Code: Select all
'\\?\Volume{bc5e05ee-a120-11e2-9576-806e6f6e6963}\ free'=69.24609MB;4096;2048;0;99.99609 '\\?\Volume{bc5e05ee-a120-11e2-9576-806e6f6e6963}\ free %'=69%;4096;2048;0;100
But I do know how to only include partitions with drive letters:
Code: Select all
[root@localhost libexec]# ./check_nrpe -H <winhost> -c check_drivesize -a "filter=type = 'fixed' and drive regexp '.*[C-Z].*'"
CRITICAL C:\: 99.661GB/107.47GB used|'C:\ used'=99.66107GB;85.97577;96.72275;0;107.46972 'C:\ used %'=92%;79;89;0;100 'D:\ used'=97.36162GB;745.20859;838.35966;0;931.51073 'D:\ used %'=10%;79;89;0;100
Re: Change Drive Checks to GB instead of percentage
Posted: Thu May 14, 2015 1:19 pm
by jkinning
jdalrymple wrote:I don't know how to filter out the system partition:
Code: Select all
'\\?\Volume{bc5e05ee-a120-11e2-9576-806e6f6e6963}\ free'=69.24609MB;4096;2048;0;99.99609 '\\?\Volume{bc5e05ee-a120-11e2-9576-806e6f6e6963}\ free %'=69%;4096;2048;0;100
But I do know how to only include partitions with drive letters:
Code: Select all
[root@localhost libexec]# ./check_nrpe -H <winhost> -c check_drivesize -a "filter=type = 'fixed' and drive regexp '.*[C-Z].*'"
CRITICAL C:\: 99.661GB/107.47GB used|'C:\ used'=99.66107GB;85.97577;96.72275;0;107.46972 'C:\ used %'=92%;79;89;0;100 'D:\ used'=97.36162GB;745.20859;838.35966;0;931.51073 'D:\ used %'=10%;79;89;0;100
Thanks! That cleans up alot of mess. So I am going to try this:
./check_nrpe -H <host> -c check_drivesize -a "filter=type = 'fixed' and drive regexp '.*[C-Z].*'" "warning=used < 4G" "critical=used < 2G"
Re: Change Drive Checks to GB instead of percentage
Posted: Thu May 14, 2015 1:21 pm
by jdalrymple
That might do ya - the only thing that might be sticky is if you have cluster boxes with very small quorum disks with a drive letter assigned. Typically people use percentages when doing broad disk checking like that - I can understand why one wouldn't want to though.
Certainly you'll find out if it's an issue or not as you proceed

I think we're long past the point of being done with "Change Drive Checks to GB instead of percentage" so I'm going to lock this one up. Fair deal?
Re: Change Drive Checks to GB instead of percentage
Posted: Thu May 14, 2015 1:56 pm
by jkinning
Fair enough. Lock it up.