Change Drive Checks to GB instead of percentage
Change Drive Checks to GB instead of percentage
I am monitoring Windows servers and currently using the NSClient++. I am using Nagios Xi 2014 R2.7 and this again is for Windows 2003 - 2012 servers. Currently my checks are using the check_xi_service_nsclient with ARG2=USEDDISKSPACE and ARG3=-l D -w 80 -c 95 what I am seeing is some of our file servers are sending out notifications yet the drive still have 63 or 100+GB left. Instead of using the percentage like I am can I specify the amount say 2GB? So when the drives have 2GB a notification will be sent out instead of the percentage?
Re: Change Drive Checks to GB instead of percentage
Maybe you can try something like this:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H <client ip> -p 5666 -c CheckDriveSize -a ShowAll Drive=D MinWarnFree=2G MinCritFree=1GBe sure to check out our Knowledgebase for helpful articles and solutions!
Re: Change Drive Checks to GB instead of percentage
I am trying to avoid using nrpe and would rather stick to the same check command. I have all the necessary firewall rules in place using the check_xi_service_nsclient. Plus, when I try that command I am getting an SSL handshake error. What in the nsclient config do I need to modify if there is no other option?
COMMAND: /usr/local/nagios/libexec/check_nrpe -H <host IP> -t 30 -c CheckDriveSize -a ShowAll Drive=D MinWarnFree=2G MinCritFree=1G -p 5666
OUTPUT: CHECK_NRPE: Error - Could not complete SSL handshake.
COMMAND: /usr/local/nagios/libexec/check_nrpe -H <host IP> -t 30 -c CheckDriveSize -a ShowAll Drive=D MinWarnFree=2G MinCritFree=1G -p 5666
OUTPUT: CHECK_NRPE: Error - Could not complete SSL handshake.
-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Change Drive Checks to GB instead of percentage
I would recommend looking at NRPE - nsclient's developer is headed that way. Read his comments on check_nt at the bottom of this page:
http://docs.nsclient.org/tutorial/nagios/check_nt.html
As for if you choose to use NRPE - it *just works* the way you want it to:
I think if you want check_nt to work that way you'll have to wrap it at the Nagios end.
http://docs.nsclient.org/tutorial/nagios/check_nt.html
As for if you choose to use NRPE - it *just works* the way you want it to:
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;100Re: Change Drive Checks to GB instead of percentage
If you wanted to use check_nt you would have to write a wrapper script (it will add overhead because it's not compiled like check_nt or check_nrpe)
http://serverfault.com/questions/309913 ... heck-nt-co
What version of NSClient are you using?
Please post your sanitized nsclient.ini.
http://serverfault.com/questions/309913 ... heck-nt-co
What version of NSClient are you using?
Please post your sanitized nsclient.ini.
Re: Change Drive Checks to GB instead of percentage
Fair enough. I'll start looking at check_nrpe.
Here is my nsclient.ini file:
Here is my nsclient.ini file:
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 IP address>
; Undocumented section
[/settings/NRPE/server]
use ssl = 1
payload length = 1014
allow nasty characters = false
allow ciphers = ADH
ssl = true
allow arguments = 1
; 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
; ALLOW INSECURE CHIPHERS and ENCRYPTION - Only enable this if you are using legacy check_nrpe client.
insecure = 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.
%SCRIPT% will be replaced by the actual script an %ARGS% will be replaced by any given arguments.
[/settings/external scripts/wrappings]
; POWERSHELL WRAPPING -
ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
; BATCH FILE WRAPPING -
bat = scripts\\%SCRIPT% %ARGS%
; VISUAL BASIC WRAPPING -
vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS%
; A list of aliases available.
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)
[/settings/external scripts/alias]
; alias_volumes_loose - Alias for alias_volumes_loose. To configure this item add a section called: /settings/external scripts/alias/alias_volumes_loose
alias_volumes_loose = check_drivesize
; alias_volumes - Alias for alias_volumes. To configure this item add a section called: /settings/external scripts/alias/alias_volumes
alias_volumes = check_drivesize
; alias_sched_all - Alias for alias_sched_all. To configure this item add a section called: /settings/external scripts/alias/alias_sched_all
alias_sched_all = check_tasksched show-all "syntax=${title}: ${exit_code}" "crit=exit_code ne 0"
; alias_process_stopped - Alias for alias_process_stopped. To configure this item add a section called: /settings/external scripts/alias/alias_process_stopped
alias_process_stopped = check_process "process=$ARG1$" "crit=state != 'stopped'"
; alias_service - Alias for alias_service. To configure this item add a section called: /settings/external scripts/alias/alias_service
alias_service = check_service
; alias_process_hung - Alias for alias_process_hung. To configure this item add a section called: /settings/external scripts/alias/alias_process_hung
alias_process_hung = check_process "filter=is_hung" "crit=count>0"
; alias_process_count - Alias for alias_process_count. To configure this item add a section called: /settings/external scripts/alias/alias_process_count
alias_process_count = check_process "process=$ARG1$" "warn=count > $ARG2$" "crit=count > $ARG3$"
; alias_process - Alias for alias_process. To configure this item add a section called: /settings/external scripts/alias/alias_process
alias_process = check_process "process=$ARG1$" "crit=state != 'started'"
; alias_mem - Alias for alias_mem. To configure this item add a section called: /settings/external scripts/alias/alias_mem
alias_mem = check_memory
; alias_file_size - Alias for alias_file_size. To configure this item add a section called: /settings/external scripts/alias/alias_file_size
alias_file_size = check_files "path=$ARG1$" "crit=size > $ARG2$" "top-syntax=${list}" "detail-syntax=${filename] ${size}" max-dir-depth=10
; alias_event_log - Alias for alias_event_log. To configure this item add a section called: /settings/external scripts/alias/alias_event_log
alias_event_log = check_eventlog
; alias_service_ex - Alias for alias_service_ex. To configure this item add a section called: /settings/external scripts/alias/alias_service_ex
alias_service_ex = check_service "exclude=Net Driver HPZ12" "exclude=Pml Driver HPZ12" exclude=stisvc
; alias_disk - Alias for alias_disk. To configure this item add a section called: /settings/external scripts/alias/alias_disk
alias_disk = check_drivesize
; alias_cpu_ex - Alias for alias_cpu_ex. To configure this item add a section called: /settings/external scripts/alias/alias_cpu_ex
alias_cpu_ex = check_cpu "warn=load > $ARG1$" "crit=load > $ARG2$" time=5m time=1m time=30s
; alias_file_age - Alias for alias_file_age. To configure this item add a section called: /settings/external scripts/alias/alias_file_age
alias_file_age = check_files "path=$ARG1$" "crit=written > $ARG2$" "top-syntax=${list}" "detail-syntax=${filename] ${written}" max-dir-depth=10
; alias_cpu - Alias for alias_cpu. To configure this item add a section called: /settings/external scripts/alias/alias_cpu
alias_cpu = check_cpu
; alias_up - Alias for alias_up. To configure this item add a section called: /settings/external scripts/alias/alias_up
alias_up = check_uptime
; alias_disk_loose - Alias for alias_disk_loose. To configure this item add a section called: /settings/external scripts/alias/alias_disk_loose
alias_disk_loose = check_drivesize
; alias_sched_task - Alias for alias_sched_task. To configure this item add a section called: /settings/external scripts/alias/alias_sched_task
alias_sched_task = check_tasksched show-all "filter=title eq '$ARG1$'" "detail-syntax=${title} (${exit_code})" "crit=exit_code ne 0"
; alias_sched_long - Alias for alias_sched_long. To configure this item add a section called: /settings/external scripts/alias/alias_sched_long
alias_sched_long = check_tasksched "filter=status = 'running'" "detail-syntax=${title} (${most_recent_run_time})" "crit=most_recent_run_time < -$ARG1$"-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Change Drive Checks to GB instead of percentage
You'll have to change allow nasty characters to be able to use < or >
Everything else looks OK and I'm not sure why you got the error you got. Can you check basic communications by running check_nrpe with no args:
Everything else looks OK and I'm not sure why you got the error you got. Can you check basic communications by running check_nrpe with no args:
Code: Select all
[jdalrymple@localhost libexec]$ ./check_nrpe -H <winhost>
I (0.4.3.131 2015-02-15) seem to be doing fine...Re: Change Drive Checks to GB instead of percentage
I changed allow nasty characters to false and tried from the server to run ./check_nrpe -H <host> but still get CHECK_NRPE: Error - Could not complete SSL handshake.
-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Change Drive Checks to GB instead of percentage
You're restarting NSCP after you change nsclient.ini right?
Incidentally allow nasty characters wouldn't affect the SSL handshake bit - it does need to be done for you to get the ultimate result though.
Can you check your firewall situation? Port 5666 is where we need to go - but the default rule implemented by the NSCP installer should handle it. From the Nagios end do an nmap to be certain:
Incidentally allow nasty characters wouldn't affect the SSL handshake bit - it does need to be done for you to get the ultimate result though.
Can you check your firewall situation? Port 5666 is where we need to go - but the default rule implemented by the NSCP installer should handle it. From the Nagios end do an nmap to be certain:
Code: Select all
[jdalrymple@localhost ~]$ nmap -p 5666 <winhost>
Starting Nmap 5.51 ( http://nmap.org ) at 2015-05-11 13:36 CDT
Nmap scan report for <winhost>
Host is up (0.0018s latency).
PORT STATE SERVICE
5666/tcp open nrpe
Nmap done: 1 IP address (1 host up) scanned in 1.29 secondsRe: Change Drive Checks to GB instead of percentage
Yes, I restarted the service.
nmap -p 5666 <winhost>
Starting Nmap 5.51 ( http://nmap.org ) at 2015-05-11 14:40 EDT
Nmap scan report for <winhost> (IP Address)
Host is up (0.00051s latency).
rDNS record for IP Address: <winhost>
PORT STATE SERVICE
5666/tcp open nrpe
Nmap done: 1 IP address (1 host up) scanned in 0.23 seconds
That all looks good.
nmap -p 5666 <winhost>
Starting Nmap 5.51 ( http://nmap.org ) at 2015-05-11 14:40 EDT
Nmap scan report for <winhost> (IP Address)
Host is up (0.00051s latency).
rDNS record for IP Address: <winhost>
PORT STATE SERVICE
5666/tcp open nrpe
Nmap done: 1 IP address (1 host up) scanned in 0.23 seconds
That all looks good.