Query regarding Nagios monitoring

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
JABI786
Posts: 2
Joined: Wed Jan 22, 2020 4:01 am

Query regarding Nagios monitoring

Post by JABI786 »

Please excuse if my query appears silly to all you experts out there. My question is

I have set up a demo environmnet with 3 apache web backends behind a nginx loadbalancer and am monitoring them with a nagios server in the same subnet. I used the default standard *.cfg file (for apache web backends and loadbalancer )in /etc/nagios3/conf.d that was already present for localhost( that is nagios monitoring host itself). They contain a host check and 3 service check for disk space, number of users and load. But for some reason all service checks show green , except disk space which is in WARNING status ?with "null" status information.

My first question , how does the nagios host perform these service checks on external hosts without nrpe? ( Is it SNMP , but netstat shows no snmp processes or open 161/162 ports)

Second, what could be the reason for the disk space check giving WARNING with "null" status information
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Query regarding Nagios monitoring

Post by mbellerue »

Welcome to the forums!
JABI786 wrote:Please excuse if my query appears silly to all you experts out there.
No need to worry about questions being silly or not, all questions are good. Ask questions, we're here to help!
I have set up a demo environmnet with 3 apache web backends behind a nginx loadbalancer and am monitoring them with a nagios server in the same subnet. I used the default standard *.cfg file (for apache web backends and loadbalancer )in /etc/nagios3/conf.d that was already present for localhost( that is nagios monitoring host itself). They contain a host check and 3 service check for disk space, number of users and load. But for some reason all service checks show green , except disk space which is in WARNING status ?with "null" status information.
Okay, so very first thing here. /etc/nagios3. This tells me that you installed Nagios via the distribution's package manager. With any other application, this is the way to go. However, with Nagios, for some reason those packages never get updated. For example, you've got Nagios 3. We're on 4.4.5. We'll keep helping with what you have, it's still Nagios after all, but I just want to make sure you know that there are improvements to be had. Take a look here if you want to check out 4.4.5.
https://assets.nagios.com/downloads/nag ... start.html

My first question , how does the nagios host perform these service checks on external hosts without nrpe? ( Is it SNMP , but netstat shows no snmp processes or open 161/162 ports)
To answer this we will need the configuration file you mentioned earlier, as well as your commands.cfg file. If you could post those here, I can walk you through what's happening in the service check.

Also, just to make sure you're going in the right direction, know that we have another agent out there. Nagios Cross-Platform Agent (NCPA). You can check it out here,
https://www.nagios.org/ncpa/
Second, what could be the reason for the disk space check giving WARNING with "null" status information
Usually, and this varies from plugin to plugin, when some kind of unknown status is returned, the plugin will return a warning. But that does vary, so for one plugin it may be a warning, another may be critical, and yet a third plugin may return a status of unknown.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
JABI786
Posts: 2
Joined: Wed Jan 22, 2020 4:01 am

Re: Query regarding Nagios monitoring

Post by JABI786 »

Thanks a ton for your reply. Here is the information you requested.

the commands.cfg at /etc/nagios3/ does not have disk space command information. I assume you are referring to the command plugins, hence , pasting the same.

Code: Select all

jabir@Nagios-lab:/etc/nagios-plugins/config$ pwd
/etc/nagios-plugins/config
jabir@Nagios-lab:/etc/nagios-plugins/config$ cat disk.cfg 
# 'check_disk' command definition
define command{
	command_name	check_disk
	command_line	/usr/lib/nagios/plugins/check_disk -w '$ARG1$' -c '$ARG2$' -e -p '$ARG3$'
	}

# 'check_all_disks' command definition
define command{
	command_name	check_all_disks
	command_line	/usr/bin/sudo /usr/lib/nagios/plugins/check_disk -w 'aaaa' -c 'bbbb' -e
	}

# 'ssh_disk' command definition
define command{
	command_name	ssh_disk
	command_line    /usr/lib/nagios/plugins/check_by_ssh -H '$HOSTADDRESS$' -C "/usr/lib/nagios/plugins/check_disk -w '$ARG1$' -c '$ARG2$' -e -p '$ARG3$'"
	}

####
# use these checks, if you want to test IPv4 connectivity on IPv6 enabled systems
####

# 'ssh_disk_4' command definition
define command{
        command_name    ssh_disk_4
        command_line    /usr/lib/nagios/plugins/check_by_ssh -H '$HOSTADDRESS$' -C "/usr/lib/nagios/plugins/check_disk -w '$ARG1$' -c '$ARG2$' -e -p '$ARG3$'" -4
        }
jabir@Nagios-lab:/etc/nagios-plugins/config$ cat /etc/nagios3/conf.d/nginx-loadbalancer.cfg 
# A simple configuration file for monitoring the local host
# This can serve as an example for configuring other servers;
# Custom services specific to this host are added here, but services
# defined in nagios2-common_services.cfg may also apply.
# 

define host{
        use                     generic-host            ; Name of host template to use
        host_name               lb-lab
        alias                   nginx loadbalancer
        address                 192.168.122.226
        }

# Define a service to check the disk space of the root partition
# on the local machine.  Warning if < 20% free, critical if
# < 10% free space on partition.

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       lb-lab
        service_description             Disk Space
        check_command                   check_all_disks!20%!10%
        }



# Define a service to check the number of currently logged in
# users on the local machine.  Warning if > 20 users, critical
# if > 50 users.

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       lb-lab
        service_description             Current Users
        check_command                   check_users!20!50
        }


# Define a service to check the number of currently running procs
# on the local machine.  Warning if > 250 processes, critical if
# > 400 processes.

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       lb-lab
        service_description             Total Processes
		check_command                   check_procs!250!400
        }



# Define a service to check the load on the local machine. 

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       lb-lab
        service_description             Current Load
		check_command                   check_load!5.0!4.0!3.0!10.0!6.0!4.0
        }

jabir@Nagios-lab:/etc/nagios-plugins/config$ 
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Query regarding Nagios monitoring

Post by cdienger »

So the disk space check you've set up for lb-lab tries to execute this command:

Code: Select all

/usr/bin/sudo /usr/lib/nagios/plugins/check_disk -w 'aaaa' -c 'bbbb' -e
A couple things are wrong but the most important is that this check must use NRPE or NCPA to execute on a remote host. I would recommend installing NCPA since it is the newer of the two and has some nice features over NRPE. See https://www.nagios.org/ncpa/getting-started.php#linux for installation steps.

Once that is done you can check out https://www.nagios.org/ncpa/getting-sta ... monitoring. It steps through a few examples of how to integrate it with Core. Roughly, the steps are:

1. Create a command like:

Code: Select all

define command {
    command_name    check_ncpa
    command_line    $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}
2. Create a service like:

Code: Select all

define service{
        use                             generic-service         ; Name of service template to use
        host_name                       lb-lab
        service_description             Disk Space
        check_command                   check_ncpa!-t 'mytoken' -P 5693 -M 'disk/logical/|' -u Gi
        }
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked