check_dir_files plugin can't get to work on remote nrpe serv

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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_dir_files plugin can't get to work on remote nrpe

Post by scottwilkerson »

Can you show the check_nrpe command definition on the nagios server?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
gmills
Posts: 114
Joined: Wed Jun 12, 2019 2:08 pm

Re: check_dir_files plugin can't get to work on remote nrpe

Post by gmills »

# 'check_dir_files' command definition
define command{
command_name check_dir_files
command_line $USER1$/check_dir_files -d $ARG1$ -w $ARG2$ -c $ARG3$ -f
}
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_dir_files plugin can't get to work on remote nrpe

Post by scottwilkerson »

This is the definition for check_dir_files

I wanted to see check_nrpe
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
gmills
Posts: 114
Joined: Wed Jun 12, 2019 2:08 pm

Re: check_dir_files plugin can't get to work on remote nrpe

Post by gmills »

sorry Scott

###############################################################################
# NRPE CHECK COMMAND
#
# Command to use NRPE to check remote host systems
###############################################################################

define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_dir_files plugin can't get to work on remote nrpe

Post by scottwilkerson »

Change this to

Code: Select all

define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ $ARG2$
}
then restart nagios
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
gmills
Posts: 114
Joined: Wed Jun 12, 2019 2:08 pm

Re: check_dir_files plugin can't get to work on remote nrpe

Post by gmills »

command[check_dir_files]=/usr/local/nagios/libexec/check_dir_files.sh -d $ARG1$ -w $ARG2$ -c $ARG3$ -f

I hope this is what you are looking for
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_dir_files plugin can't get to work on remote nrpe

Post by scottwilkerson »

Did you see this? You need to add $ARG2$
scottwilkerson wrote:Change this to

Code: Select all

define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ $ARG2$
}
then restart nagios
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
gmills
Posts: 114
Joined: Wed Jun 12, 2019 2:08 pm

Re: check_dir_files plugin can't get to work on remote nrpe

Post by gmills »

Scott
I just couldn't get the passing of parameters to the NRPE server working. from the logs on the nagios and nrpe servers I can see that parms are being passed, I just couldn't get it working. So, I simply took an alternative work around, please let me know if this is ok. I just created static commands and services for the calling methods. it is working just not the way of passing parameters from the nagios server.


my new config for this plugin check_dir_
NAGIOS SERVER
command.cfg

# 'check_dir_files_CoP_Alaska' command definition
define command{
command_name check_dir_files_CoP_Alaska
command_line $USER1$/check_dir_files
}
# 'check_dir_files_BPCRP' command definition
define command{
command_name check_dir_files_BPCRP
command_line $USER1$/check_dir_files
}
# 'check_dir_files_GCMS' command definition
define command{
command_name check_dir_files_GCMS
command_line $USER1$/check_dir_files
}
# 'check_dir_files_MaerskDrilling' command definition
define command{
command_name check_dir_files_MaerskDrilling
command_line $USER1$/check_dir_files
}
# 'check_dir_files_MSCommand' command definition
define command{
command_name check_dir_files_MSCommand
command_line $USER1$/check_dir_files
}
# 'check_dir_files_Noble' command definition
define command{
command_name check_dir_files_Noble
command_line $USER1$/check_dir_files
}


services.cfg

define service{
use generic-service ; Name of service template to use
host_name alphprdfuse1i
service_description Inbound Dir Count CoP_Alaska
check_command check_nrpe!check_dir_files_CoP_Alaska
notifications_enabled 0
}
define service{
use generic-service ; Name of service template to use
host_name alphprdfuse1i
service_description Inbound Dir Count BP Cooper
check_command check_nrpe!check_dir_files_BPCRP
notifications_enabled 0
}
define service{
use generic-service ; Name of service template to use
host_name alphprdfuse1i
service_description Inbound Dir Count MaerskDrilling
check_command check_nrpe!check_dir_files_MaerskDrilling
notifications_enabled 0
}
define service{
use generic-service ; Name of service template to use
host_name alphprdfuse1i
service_description Inbound Dir Count GCMS
check_command check_nrpe!check_dir_files_GCMS
notifications_enabled 0
}
define service{
use generic-service ; Name of service template to use
host_name alphprdfuse1i
service_description Inbound Dir Count MSCommand
check_command check_nrpe!check_dir_files_MSCommand
notifications_enabled 0
}
define service{
use generic-service ; Name of service template to use
host_name alphprdfuse1i
service_description Inbound Dir Count Noble
check_command check_nrpe!check_dir_files_Noble
notifications_enabled 0
}


ON NRPE SERVER

command[check_dir_files_CoP_Alaska]=/usr/local/nagios/libexec/check_dir_files.sh -d /GlobalScapeSftpRepo/CoP_Alaska -w 10 -c 100 -f
command[check_dir_files_BPCRP]=/usr/local/nagios/libexec/check_dir_files.sh -d /GlobalScapeSftpRepo/BPCRP -w 10 -c 100 -f
command[check_dir_files_GCMS]=/usr/local/nagios/libexec/check_dir_files.sh -d /GlobalScapeSftpRepo/GCMS -w 10 -c 100 -f
command[check_dir_files_MaerskDrilling]=/usr/local/nagios/libexec/check_dir_files.sh -d /GlobalScapeSftpRepo/MaerskDrilling -w 10 -c 100 -f
command[check_dir_files_MSCommand]=/usr/local/nagios/libexec/check_dir_files.sh -d /GlobalScapeSftpRepo/MSCommand -w 10 -c 100 -f
command[check_dir_files_Noble]=/usr/local/nagios/libexec/check_dir_files.sh -d /GlobalScapeSftpRepo/Noble -w 10 -c 100 -f


LOG of NRPE SERVER
Host 3.239.245.209 is asking for command 'check_dir_files_MaerskDrilling' to be run...
[1560796045] Running command: /usr/local/nagios/libexec/check_dir_files.sh -d /GlobalScapeSftpRepo/MaerskDrilling -w 10 -c 100 -f
[1560796045] Command completed with return code 0 and output: OK - There are 0 files in dir /GlobalScapeSftpRepo/MaerskDrilling|'size'=0;10;100
[1560796045] Return Code: 0, Output: OK - There are 0 files in dir /GlobalScapeSftpRepo/MaerskDrilling|'size'=0;10;100
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_dir_files plugin can't get to work on remote nrpe

Post by scottwilkerson »

This should be fine.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
gmills
Posts: 114
Joined: Wed Jun 12, 2019 2:08 pm

Re: check_dir_files plugin can't get to work on remote nrpe

Post by gmills »

thank you Scott, I deeply appreciate your help
Locked