Remotely checking Debian services failing

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.
CanadianLuke
Posts: 7
Joined: Fri Dec 20, 2019 1:23 pm

Remotely checking Debian services failing

Post by CanadianLuke »

Nagios Core 4.4.3 (I know there's an update available, I'll be updating during the holidays)

NRPE Version 3.2.1.

Issue: Trying to check a remote service on Debian Linux. Locally, it succeeds. I am trying to check it remotely, but it keeps failing as per below:

Code: Select all

# /usr/lib/nagios/plugins/check_nrpe -H 10.32.10.1 -t 30 -c check_service -a 'smbd'
NRPE: Command 'check_service!smbd' not defined
Nagios command configuration:

Code: Select all

define command {
    command_name        check_nrpe
    command_line        /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$
}
NRPE Server Command Configuration (and other settings):

Code: Select all

nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=127.0.0.1,10.32.10.12
dont_blame_nrpe=1
command[check_service]=/usr/lib/nagios/plugins/check_service -s $ARG1$
The log on the target server shows:

Code: Select all

Dec 20 10:25:24 fs1 nrpe[3302]: Connection from 10.32.10.12 port 35559
Dec 20 10:25:24 fs1 nrpe[3302]: Host address is in allowed_hosts
Dec 20 10:25:25 fs1 nrpe[3302]: Host 10.32.10.12 is asking for command 'check_service' to be run...
Dec 20 10:25:25 fs1 nrpe[3302]: Running command: /usr/lib/nagios/plugins/check_service -s
Dec 20 10:25:25 fs1 nrpe[3302]: Command completed with return code 2 and output: CRITICAL: Service  is not running!
Dec 20 10:25:25 fs1 nrpe[3302]: Return Code: 2, Output: CRITICAL: Service  is not running!
Dec 20 10:25:25 fs1 nrpe[3302]: Connection from 10.32.10.12 closed.
Any thoughts/ideas?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Remotely checking Debian services failing

Post by scottwilkerson »

Can you show what $ARG1$ is set to for the service in Nagios?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
CanadianLuke
Posts: 7
Joined: Fri Dec 20, 2019 1:23 pm

Re: Remotely checking Debian services failing

Post by CanadianLuke »

Code: Select all

define service {
    use                 local-service
    host_name           fs1
    service_description Samba Daemon
    check_command       check_nrpe!check_service!smbd
}
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Remotely checking Debian services failing

Post by scottwilkerson »

Ok, so
$ARG1$ = check_service
$ARG2$ = smbd

Your check command is

Code: Select all

define command {
    command_name        check_nrpe
    command_line        /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$
}
When you populate this with the arguments it doesn't built the command you want as you do not have $ARG2$ in the command

Change your service definition to

Code: Select all

define service {
    use                 local-service
    host_name           fs1
    service_description Samba Daemon
    check_command       check_nrpe!check_service -a smbd
}
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
CanadianLuke
Posts: 7
Joined: Fri Dec 20, 2019 1:23 pm

Re: Remotely checking Debian services failing

Post by CanadianLuke »

On the GUI:

NRPE: Command 'check_service!smbd' not defined

Service Definition:

Code: Select all

define service {
    use                 local-service
    host_name           fs1
    service_description Samba Daemon
    check_command       check_nrpe!check_service -a smbd
}
On the NRPE Server:

Code: Select all

Dec 20 11:03:31 fs1 nrpe[4031]: Connection from 10.32.10.12 port 33515
Dec 20 11:03:31 fs1 nrpe[4031]: Host address is in allowed_hosts
Dec 20 11:03:31 fs1 nrpe[4031]: Host 10.32.10.12 is asking for command 'check_service!smbd' to be run...
Dec 20 11:03:31 fs1 nrpe[4031]: NRPE: Command 'check_service!smbd' not defined
Dec 20 11:03:31 fs1 nrpe[4031]: Return Code: 2, Output: NRPE: Command 'check_service!smbd' not defined
Dec 20 11:03:31 fs1 nrpe[4031]: Connection from 10.32.10.12 closed.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Remotely checking Debian services failing

Post by scottwilkerson »

Did you restart Nagios after making the change?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
CanadianLuke
Posts: 7
Joined: Fri Dec 20, 2019 1:23 pm

Re: Remotely checking Debian services failing

Post by CanadianLuke »

Yes, I restarted Nagios on my server, and also the Nagios-NRPE-Server service on the target. No change, same error message in both the log and the GUI as before.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Remotely checking Debian services failing

Post by scottwilkerson »

Code: Select all

# /usr/lib/nagios/plugins/check_nrpe -H 10.32.10.1 -t 30 -c check_service -a 'smbd'
NRPE: Command 'check_service!smbd' not defined
this is really bizzarre, I see no reason why this would ever concatenation the check command and argument into check_service!smbd

Is your check_nrpe working on other servers/services?

Can you show the output of the following on the client

Code: Select all

ps -ef|grep nrpe
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
CanadianLuke
Posts: 7
Joined: Fri Dec 20, 2019 1:23 pm

Re: Remotely checking Debian services failing

Post by CanadianLuke »

Code: Select all

# ps -ef | grep nrpe
nagios    4121     1  0 11:06 ?        00:00:00 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -f
root      4424  2929  0 11:17 pts/0    00:00:00 grep nrpe
Yes, it works for other checks that are in my nrpe.cfg file. However, this is the only one that accepts (or, at least, I hope accepts) arguments.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Remotely checking Debian services failing

Post by scottwilkerson »

Can you show the output of running the following command

Code: Select all

/usr/sbin/nrpe
Also, can you attach your whole /etc/nagios/nrpe.cfg
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked