Check_nt - memory use

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
orani
Posts: 169
Joined: Wed May 06, 2015 3:33 pm

Check_nt - memory use

Post by orani »

Hello,

I have a windows server machine with 128GB RAM. I use check_nt for monitoring the memory usage of that machine.

The total memory recognized from the plug-in defers the true memory of the server.

I tried to use the same plug-in to monitor other servers for testing reasons and i found that the same problem occurs to all servers.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Check_nt - memory use

Post by lmiltchev »

This is a known issue. NSClient++ is moving away from using check_nt. I would recommend that you try using check_nrpe with NSClient++ instead.

Here's an example of a check_nrpe memory check:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -p 5666 -c CheckMem -a MaxWarn=80% MaxCrit=90% ShowAll type=physical
OK: physical: Total: 31.907GB - Used: 18.728GB (58%) - Free: 13.179GB (41%)|'physical'=18.72791GB;25.52584;28.71657;0;31.9073 'physical %'=59%;80;90;0;100
For more info, check this out:
https://docs.nsclient.org/reference/win ... eck_memory
Be sure to check out our Knowledgebase for helpful articles and solutions!
orani
Posts: 169
Joined: Wed May 06, 2015 3:33 pm

Re: Check_nt - memory use

Post by orani »

Ok. I tried running the script you suggested but i get the following error


CHECK_NRPE: (ssl_err != 5) Error - Could not complete SSL handshake with xxx.xxx.xxx.xxx: 1

I think that i should make some changes at the server nsclient configuration file to run properly the nrpe checks but what should be those changes?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Check_nt - memory use

Post by lmiltchev »

Can you post the entire nsclient.ini file on the forum, so that we can see what needs to be modified? You can obfuscate sensitive data - IPs, passwords, etc.
Be sure to check out our Knowledgebase for helpful articles and solutions!
orani
Posts: 169
Joined: Wed May 06, 2015 3:33 pm

Re: Check_nt - memory use

Post by orani »

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]

; PASSWORD - Password used to authenticate against server
password = [i]#mypassword#[/i]

; ALLOWED HOSTS - A comaseparated list of allowed hosts. You can use netmasks (/ syntax) or * to create ranges.
allowed hosts = [i]#mynagiosserverip#[/i]


; Undocumented section
[/settings/NRPE/server]

; 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 = no-sslv2,no-sslv3

; 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 = false


; Undocumented section
[/modules]

; 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

At the NRPEServer = 1 i tried to change it to #mynagiosserverip#. Then i got connection refused as an error when executing the command
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Check_nt - memory use

Post by lmiltchev »

Try the following:

1. Comment out the "ssl options" line, so that it would look like this:

Code: Select all

# ssl options = no-sslv2,no-sslv3
2. Change the "insecure" line to "true":

Code: Select all

insecure = true
3. Ad the following (additional) lines under the [/settings/NRPE/server] section:

Code: Select all

use ssl = 1
allow nasty characters = 1
allow arguments = 1
port = 5666
extended response = 0
allowed ciphers = ALL:!MD5:@STRENGTH
verify mode = none
4. Save and exit.

5. Restart NSClient++ service so that changes can take effect.

Let us know if this helped.
Be sure to check out our Knowledgebase for helpful articles and solutions!
orani
Posts: 169
Joined: Wed May 06, 2015 3:33 pm

Re: Check_nt - memory use

Post by orani »

i have done the changes you wrote me.

The nsclient.ini file is the following

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]

; PASSWORD - Password used to authenticate against server
password = nagios

; ALLOWED HOSTS - A comaseparated list of allowed hosts. You can use netmasks (/ syntax) or * to create ranges.
allowed hosts = 10.0.5.184


; Undocumented section
[/settings/NRPE/server]

use ssl = 1
allow nasty characters = 1
allow arguments = 1
port = 5666
extended response = 0
allowed ciphers = ALL:!MD5:@STRENGTH
verify mode = none

; 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 = no-sslv2,no-sslv3

; 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]

; 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

; NSCAClient - NSCA client can be used both from command line and from queries to submit passive checks via NSCA
NSCAClient = 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]

; 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_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_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_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$"

Comment: When i try to execute from nagios server the service nrpe restart, it says unrecognized service. Is there a possibility of a misconfiguration at the server side nrpe service?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Check_nt - memory use

Post by lmiltchev »

Use the following guide to install NRPE v3 on your Nagios box:
https://support.nagios.com/kb/article/n ... e-515.html
then try your check again. Let us know if this helped.
Be sure to check out our Knowledgebase for helpful articles and solutions!
orani
Posts: 169
Joined: Wed May 06, 2015 3:33 pm

Re: Check_nt - memory use

Post by orani »

i followed the guide successfully.

when i try the command

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H xxx.xxx.xxx.xxx -p 5666 -c CheckMem -a MaxWarn=80% MaxCrit=90% ShowAll type=physical
i get

Code: Select all

CHECK_NRPE: (ssl_err != 5) Error - Could not complete SSL handshake with xxx.xxx.xxx.xxx: 1
but

when i run

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1 -p 5666 -c CheckMem -a MaxWarn=80% MaxCrit=90% ShowAll type=physical
i get

Code: Select all

CRITICAL - load average per CPU: 0.81, 1.05, 1.20|load1=0.805;0.150;0.300;0; load5=1.048;0.100;0.250;0; load15=1.202;0.050;0.200;0;
which i think (the second one) is ok.

EDIT: when i run the check_nrpe to any linux server it works. Only to windows servers there is a problem

Any ideas?
orani
Posts: 169
Joined: Wed May 06, 2015 3:33 pm

Re: Check_nt - memory use

Post by orani »

i Solved it...!!!!!

at the .ini file it shoud be

allow nasty characters = true
allow arguments = true

not 1

and

ssl options = (blank)
Locked