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

Re: Remotely checking Debian services failing

Post by CanadianLuke »

Code: Select all

# /usr/sbin/nrpe

NRPE - Nagios Remote Plugin Executor
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 3.0.1
Last Modified: 09-08-2016
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available, OpenSSL 0.9.6 or higher required
TCP Wrappers Available

Usage: nrpe [-n] -c <config_file> [-4|-6] <mode>

Options:
 -n               = Do not use SSL
 -c <config_file> = Name of config file to use
 -4               = use ipv4 only
 -6               = use ipv6 only
 <mode>           = One of the following operating modes:
   -i             =    Run as a service under inetd or xinetd
   -d             =    Run as a standalone daemon
   -d -s          =    Run as a subsystem under AIX
   -f             =    Don't fork() for systemd, launchd, etc.

Notes:
This program is designed to process requests from the check_nrpe
plugin on the host(s) running Nagios.  It can run as a service
under inetd or xinetd (read the docs for info on this), or as a
standalone daemon. Once a request is received from an authorized
host, NRPE will execute the command/plugin (as defined in the
config file) and return the plugin output and return code to the
check_nrpe plugin.

Code: Select all

# cat /etc/nagios/nrpe.cfg
# Managed by Ansible. Local changes may be lost.

log_facility=daemon
debug=1
pid_file=/var/run/nagios/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=127.0.0.1,10.32.10.12
dont_blame_nrpe=1
allow_bash_command_substitution=0
command_timeout=60
connection_timeout=300

command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200

include=/etc/nagios/nrpe_local.cfg
include_dir=/etc/nagios/nrpe.d/
include_dir=/etc/nagios-plugins/config/

# cat /etc/nagios/nrpe_local.cfg
## Note: Managed by Ansible

######################################
# Do any local nrpe configuration here
######################################
command[users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_swap]=/usr/lib/nagios/plugins/check_swap -w 20% -c 10%
command[check_root]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p / -m
command[check_home]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /home/ -m
command[check_share_part]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /usr/local/share/ -m
command[check_backups]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /mnt/backups/ -m
command[zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[total_procs]=/usr/lib/nagios/plugins/check_procs -w 190 -c 200
command[check_mdadm]=/usr/lib/nagios/plugins/check_mdadm
command[check_service]=/usr/lib/nagios/plugins/check_service -s $ARG1$

# cat /etc/nagios/nrpe.d/*

# ALLOWED HOST ADDRESSES
allowed_hosts=127.0.0.1,10.1.30.26

# ADDED CHECKS
command[check_root]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
command[check_home]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /home
command[check_backup]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /var/backups
command[check_apt]=/usr/lib/nagios/plugins/check_apt
#command[check_dvr]=/usr/lib/nagios/plugins/check_tcp -H 192.168.0.58 -p 7778
#command[check_dvr]=/usr/lib/nagios/plugins/check_tcp -H 192.168.0.58 -p 80
#command[check_dvr]=/usr/lib/nagios/plugins/check_ping -H 192.168.0.58 -w 100.0,60% -c 200.0,60%
command[check_pa]=/usr/lib/nagios/plugins/check_ping -H 10.32.10.19 -w 100.0,60% -c 200.0,60%
command[check_pa_zone2]=/usr/lib/nagios/plugins/check_ping -H 10.32.10.19 -w 100.0,60% -c 200.0,60%
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 »

This NRPE wasn't compiled with command argument support, if it was it would show the following when you run /usr/sbin/nrpe

Code: Select all

***************************************************************
** POSSIBLE SECURITY RISK - COMMAND ARGUMENTS ARE SUPPORTED! **
**      Read the NRPE SECURITY file for more information     **
***************************************************************
With this in mind you cannot pass arguments and would just need to add a new command to the nrpe.cfg such as:

Code: Select all

command[check_service_smbd]=/usr/lib/nagios/plugins/check_service -s smbd
Then change your service on Nagios to be

Code: Select all

define service {
    use                 local-service
    host_name           fs1
    service_description Samba Daemon
    check_command       check_nrpe!check_service_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 »

Argh... Alright. I'll look at specifying the services then, and having multiple checks.

Thanks for your assistance!
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 »

CanadianLuke wrote:Argh... Alright. I'll look at specifying the services then, and having multiple checks.

Thanks for your assistance!
Sounds good!

Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked