Nagios plugins location

khakishoiab picture khakishoiab · Sep 16, 2016 · Viewed 12.4k times · Source

I have ubuntu ec2 instance I want to monitor.I havent installed plugins on NRPE server which is using xinetd but instead I have configured and installed plugins on Nagios server.However except check_ssh nothing gets executed when I test from libexec directory from Nagios server.I have elasticsearch ,cassandra and tomcat plugins and my Boss doesnt want anything on ec2 instance except nrpe.I have already configured all these processes to accept any connections.

Answer

Stanislav Ivanov picture Stanislav Ivanov · Sep 30, 2016

We can have two different types of host check:

  1. direct check (nagios -> command check_ping(HOSTADDRESS) -> local plugin check_ping(HOSTADDRESS));

In this case no plugins or NRPE or something else required on Second machine. Nagios calls local plugin check_ping, it's make a check, Nagios gets the result. You can use this type of check for PING, HTTP GET, SNMP Checks, SQL Query, etc. everything which available over the network.

  1. NRPE check (nagios -> command check_nrpe(HOSTADDRESS,COMMAND) -> local plugin check_nrpe(HOSTADDRESS,COMMAND) -> (network) -> NRPE Server command COMMAND -> local (for NRPE) plugin check_load )

In this case Nagios calls local plugin check_nrpe, this plugin calls NRPE server, NRPE server calls its own local plugin check_load and return the result over the network. At Second machine should be installed NRPE and Nagios Plugins, also nrpe.cfg should contain necessary commands. You can use this type for CPU Load, Memory usage and Disks space monitoring, or create custom plugins.

Configuration example:

First machine (Nagios Server):

command section:

define command{
        command_name    check_ping
        command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
        }

define command{
        command_name    check_nrpe
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

service section:

define service{
        use                 network-service
        hostgroup_name      common-linux-servers
        service_description PING
        check_command       check_ping!100.0,20%!500.0,60%
        }

define service{
        use                     network-service
        hostgroup_name          common-linux-servers
        service_description     Current Load
        check_command           check_nrpe!check_load
        }

Second machine in /etc/nagios/nrpe.cfg:

command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20