check_ftp works, Nagios shows Connection Refused

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
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

check_ftp works, Nagios shows Connection Refused

Post by stecino »

Hi all,

I have this config:

define service{
use generic-service
hostgroup_name stage_alfresco
service_description FTP
check_command check_nrpe!check_ftp_alfresco -a 2 4 1024
notifications_enabled 1
}

command[check_ftp_alfresco]=/usr/local/nagios/libexec/check_ftp -p 1024 -w $ARG1$ -c $ARG2$

Command exectutes fine: [root@stageutil03 libexec]# ./check_nrpe -H prodalf01 -c check_ftp_alfresco -a 2 4 1024
FTP OK - 0.001 second response time on port 1024 [220 FTP server ready]|time=0.000717s;2.000000;4.000000;0.000000;10.000000

But I get Connection refused for that host on Nagios UI
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_ftp works, Nagios shows Connection Refused

Post by scottwilkerson »

is stageutil03 the Nagios server, or the host NRPE is running on?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

Re: check_ftp works, Nagios shows Connection Refused

Post by stecino »

stageutil03 is the Nagios server, prodalf01 is the NRPE
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_ftp works, Nagios shows Connection Refused

Post by scottwilkerson »

This is also going to depend on what you have for the command definition for check_nrpe, can you post that command definition?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

Re: check_ftp works, Nagios shows Connection Refused

Post by stecino »

Here you go

# 'check_nrpe' command definition
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_ftp works, Nagios shows Connection Refused

Post by slansing »

You will need to set warning and critical values in either your service or command definition as see it shows you on the remote host's NRPE.cfg file definition.

Code: Select all

command[check_ftp_alfresco]=/usr/local/nagios/libexec/check_ftp -p 1024 -w $ARG1$ -c $ARG2$
In the service definition change it to the following for example:

Code: Select all

check_command check_nrpe!check_ftp_alfresco -a "-w <value> -c <value>"
These are the available options for use with the plugin:

Code: Select all

[-w <warning time>] [-c <critical time>] [-s <send string>]
[-e <expect string>] [-q <quit string>][-m <maximum bytes>] [-d <delay>]
[-t <timeout seconds>] [-r <refuse state>] [-M <mismatch state>] [-v] [-4|-6] [-j]
[-D <days to cert expiry>] [-S <use SSL>] [-E]
stecino
Posts: 248
Joined: Thu Mar 14, 2013 4:42 pm

Re: check_ftp works, Nagios shows Connection Refused

Post by stecino »

I'm not quite sure I understand what you proposing. I already have it setup that way. NRPE

command[check_ftp_alfresco]=/usr/local/nagios/libexec/check_ftp -p 1024 -w $ARG1$ -c $ARG2$

on Nagios master:

check_command check_nrpe!check_ftp_alfresco -a 2 4 1024
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_ftp works, Nagios shows Connection Refused

Post by slansing »

The difference between what you showed us is that on the remote host you have warning and critical arguments set up, however on the Nagios server's side this is not the case, so.. what you are trying to pass that plugin is getting bounced back because it is not valid, you must match the two command's.

Code: Select all

-a 2 4 1024
Is not valid for what you are trying to connect to the NRPE plugin with as the command on the Remote server expects warning and critical values, not just a -a with a number string, it is asking for you to plug in what is located in the ARG1 and ARG2 fields of the plugin command.
Locked