nrpe & NCClient++

This board serves as an open discussion and support collaboration point for Nagios XI. NOTE: Nagios XI customers should use the Customer Support forum to obtain expedited support.

nrpe & NCClient++

Postby crechet51 » Wed Aug 28, 2019 7:02 am

Hi,

I'm trying to check the free space on a Windows PC drive

On Ubuntu-PC, I run:

Code: Select all
#./check_nrpe -H windows-pc-host -p5667
> I (0.5.2.35 2018-01-28) seem to be doing fine ...



I conclude that everything is probably fine and that it works.

I run:

Code: Select all
#./check_nt -H windows-pc-host -p5667 -s 'SuperSecretPassword' -v USEDDISKSPACE -l c -w 90 -c 95
> Free disk space: Invalid drive


Although drive C exists on a Windows PC.

However, even if I write this command with the wrong password, the output will be the same.

What am I doing wrong? :(

P.S.

I also tried through check_nrpe:

Code: Select all
#./check_nrpe -H windows-pc-host -p 5667 -c check_drivesize -a drive=C: 'warning=used>90%' 'critical=used>95%' show-all 'perf-config=*(unit:G)' detail-syntax='{${drive_or_name} ${used_pct}% used / ${size} total}' top-syntax='${status}: ${problem_list}'

> Exception processing request: Request contained arguments (not currently allowed, check the allow arguments option).


If I understand correctly, then check_nrpe reaches windows-pc, but windows does not let it do what it needs?
crechet51
 
Posts: 24
Joined: Mon Aug 05, 2019 9:41 am

Re: nrpe & NCClient++

Postby mbellerue » Wed Aug 28, 2019 12:00 pm

The check_nrpe issue is most likely an issue of NSClient not allowing arguments. You can change this by adding the following under the /settings/NRPE/server section of your nsclient.ini file.

Code: Select all
allow arguments=1


Then restart the NSClient service.

Regarding check_nt, that issue can creep up if the NSClient service doesn't have access to check the drive specified. Are you running the NSClient service using a service account, or is it running as system?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
mbellerue
 
Posts: 575
Joined: Fri Jul 12, 2019 11:10 am

Re: nrpe & NCClient++

Postby crechet51 » Wed Aug 28, 2019 2:47 pm

Ok,

I wrote "allow arguments=1" in nsclient.ini, then I restarted the service.

Code: Select all
#./check_nrpe -H windows-pc-host -p 5667 -c check_drivesize -a drive=C: 'warning=used>90%' 'critical=used>95%' show-all 'perf-config=*(unit:G)' detail-syntax='{${drive_or_name} ${used_pct}% used / ${size} total}' top-syntax='${status}: ${problem_list}'
> CHECK_NRPE STATE CRITICAL: Socket timeout after 10 seconds.

#./check_nt -H windows-pc-host -p5667 -s 'SuperSecretPassword' -v USEDDISKSPACE -l c -w 90 -c 95
> CRITICAL - Socket timeout


:roll:

my nsclient.ini:

Code: Select all
# If you want to fill this file with all available 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


; in flight - TODO
[/settings/default]

; Undocumented key
password = SuperSecretPassword

; Undocumented key
allowed hosts = host1, host2, host3


; in flight - TODO
[/settings/NRPE/server]

; Undocumented key
verify mode = none

; Undocumented key
insecure = true

allow arguments = 1

; in flight - TODO
[/modules]

; Undocumented key
CheckExternalScripts = disabled

; Undocumented key
CheckHelpers = disabled

; Undocumented key
CheckEventLog = disabled

; Undocumented key
CheckNSCP = enabled

; Undocumented key
CheckDisk = enabled

; Undocumented key
CheckSystem = disabled

; Undocumented key
NRPEServer = enabled
crechet51
 
Posts: 24
Joined: Mon Aug 05, 2019 9:41 am

Re: nrpe & NCClient++

Postby mbellerue » Wed Aug 28, 2019 3:10 pm

You don't have a port listed in that ini file. What happens if you use the default port of 5666?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
mbellerue
 
Posts: 575
Joined: Fri Jul 12, 2019 11:10 am

Re: nrpe & NCClient++

Postby crechet51 » Wed Aug 28, 2019 3:33 pm

actually router forwards 5667 port to 5666)))

because 5666 is busy by another pc)
crechet51
 
Posts: 24
Joined: Mon Aug 05, 2019 9:41 am

Re: nrpe & NCClient++

Postby mbellerue » Wed Aug 28, 2019 3:37 pm

Well, let's check out your nsclient.log file.

Also try running this command on the Windows machine to see if it's still listening for connections.

Code: Select all
netstat -a | findstr 5666
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
mbellerue
 
Posts: 575
Joined: Fri Jul 12, 2019 11:10 am

Re: nrpe & NCClient++

Postby crechet51 » Wed Aug 28, 2019 4:08 pm

hmm...

Code: Select all
error:c:\source\master\modules\NRPEServer\NRPEServer.cpp:165: Request contained arguments (not currently allowed, check the allow arguments option).


you were right...

But what can I do with it? I'm already wrote "allow arguments=1"

by the way: netstat -a | findstr 5666
= nothing(
crechet51
 
Posts: 24
Joined: Mon Aug 05, 2019 9:41 am

Re: nrpe & NCClient++

Postby mbellerue » Wed Aug 28, 2019 4:16 pm

Alright, if netstat isn't finding anything, then the service probably isn't running. Let's restart the NSClient service, and then try to verify that it's running with the netstat command. If netstat says the machine is listening on 5666, then we'll try the check_nrpe command again.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
mbellerue
 
Posts: 575
Joined: Fri Jul 12, 2019 11:10 am

Re: nrpe & NCClient++

Postby crechet51 » Thu Aug 29, 2019 3:13 am

Ok)

I did something and the service started :mrgreen:

Code: Select all
>netstat -a | findstr 5666
  TCP    0.0.0.0:5666           WIN-PC-CRECHET:0      LISTENING
  TCP    0.0.0.0:5666           WIN-PC-CRECHET:0      LISTENING
  TCP    [::]:5666              WIN-PC-CRECHET:0      LISTENING


BUT:

Code: Select all
#./check_nrpe -H windows-pc-host -p5667
> I (0.5.2.35 2018-01-28) seem to be doing fine...


Code: Select all
#./check_nt -H windows-pc-host -p5667 -s 'SuperSecretPassword' -v USEDDISKSPACE -l c -w 90 -c 95
> Free disk space : Invalid drive


Code: Select all
#./check_nrpe -H windows-pc-host -p 5667 -c check_drivesize -a drive=C: 'warning=used>90%' 'critical=used>95%' show-all 'perf-config=*(unit:G)' detail-syntax='{${drive_or_name} ${used_pct}% used / ${size} total}' top-syntax='${status}: ${problem_list}'
> Exception processing request: Request command contained illegal metachars!


I Googled one more command:

Code: Select all
#./check_nrpe -c check_drivesize -H windows-pc-host -a "crit=free<5g" "warn=free<8g" drive=c:
> CHECK_NRPE: Receive header underflow - only 0 bytes received (4 expected).


:(
crechet51
 
Posts: 24
Joined: Mon Aug 05, 2019 9:41 am

Re: nrpe & NCClient++

Postby mbellerue » Thu Aug 29, 2019 10:12 am

Alright, we're almost there!

When looking up instructions for NSClient, make sure to prefer legacy commands. Try these versions of the commands.

Code: Select all
./check_nrpe -H windows-pc-host -p 5667 -c checkdrivesize -a 'MaxWarnFree=8G' 'MaxCritFree=5G' 'Drive=C:'

./check_nrpe -H windows-pc-host -p 5667 -c checkdrivesize 'Drive=C' 'MaxWarnUsed=90%' 'MaxCritUsed=95%' show-all 'perf-config=*(unit:G)' detail-syntax='{${drive_or_name} ${used_pct}% used / ${size} total}' top-syntax='${status}: ${problem_list}'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
mbellerue
 
Posts: 575
Joined: Fri Jul 12, 2019 11:10 am

Next

Return to Nagios XI

Who is online

Users browsing this forum: No registered users and 21 guests