check_tcp from monitored to ancillary device

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.
Locked
walterwerner
Posts: 2
Joined: Mon May 01, 2017 12:30 pm

check_tcp from monitored to ancillary device

Post by walterwerner »

I'm trying to setup this scenario...

NAGIOS Server (Version 3.2.3) on CENTOS 5.5
NSClient++ (Version 0.4.0.172) on Windows Server

create a service monitor that has the Windows Server report it's ability to connect to a third device.

I've done this...

On the NAGIOS Server

define command {
command_name check_remote_tcp
command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c chk_remote_tcp -a $ARG1$ $ARG2$ $ARG3$ $ARG4$
}

define service{
use generic-service ; Name of service template to use
host_name WINDOWS_SERVER
service_description remote_ping
normal_check_interval 5
retry_check_interval 5
notification_interval 15
check_command check_remote_tcp!REMOTE_DEVICE!80!100!1000
contact_groups testing
}



On the Windows Server in nsclient.ini I've added the following in the [/settings/external scripts/scripts] section

chk_remote_tcp=C:\PROGRA~2\NSCLIE~1\scripts\check_tcp.exe -H $ARG1$ -p $ARG2$ -w $ARG3$ -c $ARG4$

and acquired the check_tcp.exe executable and placed it in the scripts folder



when I run the check command manually on the NAGIOS Server like this

..../libexec/check_nrpe -H WINDOWS_SERVER -p 5666 -c chk_remote_tcp -a REMOTE_DEVICE 80 100 1000

I get the output

TCP OK - 0.085 second response time on port 80 |'time'=0.085077s


But in the NAGIOS Web interface I get this result


Current Status: CRITICAL (for 0d 3h 48m 38s) (Has been acknowledged)
Status Information: (Return code of 127 is out of bounds - plugin may be missing)
Performance Data:
Current Attempt: 3/3 (HARD state)
Last Check Time: 04-10-2019 14:26:15
Check Type: ACTIVE
Check Latency / Duration: 0.005 / 0.008 seconds
Next Scheduled Check: 04-10-2019 14:31:15
Last State Change: 04-10-2019 10:42:37
Last Notification: 04-10-2019 13:56:21 (notification 20)
Is This Service Flapping? NO (0.00% state change)
In Scheduled Downtime? NO
Last Update: 04-10-2019 14:31:11 ( 0d 0h 0m 4s ago)



I cannot figure out what I'm doing wrong??? any help would be appreciated.


thank you
User avatar
swolf
Developer
Posts: 294
Joined: Tue Jun 06, 2017 9:48 am

Re: check_tcp from monitored to ancillary device

Post by swolf »

Hi @walterwerner,

It looks to me like you aren't using the full path to check_nrpe in your command. If you change it to

Code: Select all

define command {
command_name check_remote_tcp
command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -p 5666 -c chk_remote_tcp -a $ARG1$ $ARG2$ $ARG3$ $ARG4$
}
Does it fix your issue? (You may need to change that path if you chose a custom base directory.)
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy
walterwerner
Posts: 2
Joined: Mon May 01, 2017 12:30 pm

Re: check_tcp from monitored to ancillary device

Post by walterwerner »

@swolf

Yes.. that did it...

When I reviewed the other command statements they had $USER1$/ in front of them.
So sorry for this, I should have seen that, but just didn't see that in the configuration file.

Much appreciated.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_tcp from monitored to ancillary device

Post by scottwilkerson »

walterwerner wrote:@swolf

Yes.. that did it...

When I reviewed the other command statements they had $USER1$/ in front of them.
So sorry for this, I should have seen that, but just didn't see that in the configuration file.

Much appreciated.
glad we could help!

Locking thread
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked