-->

DEVOPSZONES

  • Recent blogs

    How to Monitor a Linux host With nagios

    How to Monitor a Linux host With nagios


    We will demonstrate how a add a new host to Nagios, so it will be monitored. 

    If you want to review your nagios Installation, Please Click here .

    Install the EPEL repository:

    [root@nagiosclient ~]# yum install epel-release -y

    Now install Nagios Plugins and NRPE:

    [root@nagiosclient ~]# yum install nrpe nagios-plugins-all -y
    fig

    Now, let’s update the NRPE configuration file.

    [root@nagiosclient ~]# vi /etc/nagios/nrpe.cfg

    Add the  IP address of your "Nagios server" to the comma-delimited list in allowed_hosts directive.

    allowed_hosts=127.0.0.1,192.168.1.142

    Restart NRPE :

    [root@nagiosclient ~]# systemctl start nrpe.service
    [root@nagiosclient ~]# systemctl enable nrpe.service


    On your Nagios server, create a new configuration file for each of the remote hosts that you want to monitor in /usr/local/nagios/etc/servers/.

    [root@nagiosstandby ~]# vi /usr/local/nagios/etc/servers/nagiosclient.cfg

    Add the host definition

    [root@nagiosstandby ~]# cat /usr/local/nagios/etc/servers/nagiosclient.cfg
    define host {
            use                             linux-server
            host_name                       nagiosclient
            alias                           My Nagios Client Server
            address                         192.168.1.145
            max_check_attempts              5
            check_period                    24x7
            notification_interval           30
            notification_period             24x7
    }
    [root@nagiosstandby ~]#


    With the configuration file above, Nagios will only monitor if the host is up or down. Then save and exit then restart Nagios. 

    Nagios Client


    If you want to monitor more  services, please follow the article : 

    Add a service block for services you want to monitor. Note that the value of check_command determines what will be monitored, including status threshold values. You can add the service definition to your host’s configuration file:

    Ping:

    [root@nagiosstandby ~]# vi /usr/local/nagios/etc/servers/nagiosclient.cfg
    [root@nagiosstandby ~]# cat /usr/local/nagios/etc/servers/nagiosclient.cfg
    define host {
            use                             linux-server
            host_name                       nagiosclient
            alias                           My Nagios Client Server
            address                         192.168.1.145
            max_check_attempts              5
            check_period                    24x7
            notification_interval           30
            notification_period             24x7
    }
    define service {
            use                             generic-service
            host_name                       nagiosclient
            service_description             PING
            check_command                   check_ping!100.0,20%!500.0,60%
    }
    [root@nagiosstandby ~]#

    Now save and quit. Reload your Nagios configuration to put any changes into effect:

    [root@nagiosstandby ~]# systemctl reload nagios.service

    Check the Services option in Nagios Website of your monitored hosts and services:
    Nagios Service


    How To Install Nagios 4.4.2  on CentOS 7 or RHEL 7

    No comments