Forum Articles
WJunction


  1. #1
    Member onel0ve's Avatar

    Website(s):
    host4offshore.com
    • My Statistics

    Default Installation & Configuration of Nagios & Nagios Client (NRPE) on CentOS 5

    Installation

    Add RPMForge Yum Repository

    It is recommended that you configure yum-priorities prior to following this tutorial to avoid having base CentOS packages being overwritten by the RPMForge repository. Instructions to do so can be found on the CentOS Wiki.



    Install & Configure Prerequisites


    • Install Apache
      • yum install httpd php gcc glibc glibc-common gd gd-devel



    • Configure Apache to start on boot
      • chkconfig httpd on



    • Configure iptables to allow Apache traffic
      • /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
      • /etc/init.d/iptables save
      • /etc/init.d/iptables restart


    Install Nagios & Nrpe


    • Install Nagios (Server Side)

      [mylogin@hostname nagios]# yum install nagios nagios-plugins nagios-plugins-nrpe nagios-devel
    • Install Nagios (Client Side)

    [mylogin@hostname nagios]# yum install nagios nagios-plugins nagios-plugins-nrpe nagios-devel nagios-nrpe

    • Create the default Nagios web access user & set a password
      • htpasswd -c /etc/nagios/htpasswd.users nagiosadmin



    • Verify default config files
      • nagios -v /etc/nagios/nagios.cfg



    • Start Nagios
      • /etc/init.d/nagios start



    • Start Apache
      • /etc/init.d/httpd start


    Verify Install


    • Try logging into your new Nagios installation by going to http://YourIpAddress/nagios/ and logging in with nagiosadmin and the password you set.

    Nagios Server Configuration

    Before starting any configuration make it a habit to backup all configuration files. This will save us a lot of time in troubleshooting. Having a backup will also allow us to restore the most recent configuration to the system. We can also make the backup configuration as a future reference in case we need something :
    [mylogin@hostname nagios]# cd /etc
    [mylogin@hostname nagios]# cp -frp nagios nagios.backup-<date>
    [mylogin@hostname nagios]# cp -rf /etc/nagios/objects/localhost.cfg /etc/nagios/objects/server1.cfg
    [mylogin@hostname nagios]# chown -R nagios:nagios server1.cfg
    [mylogin@hostname nagios]# nano /etc/nagios/objects/server1.cfg
    Code:
    define host{
    use                     linux-server            ; Name of host template to use
    ; This host definition will inherit all variables that are defined
    ; in (or inherited by) the linux-server host template definition.
    host_name               server1
    alias                   server1
    address                 your client server ip
    }
    define hostgroup{
    hostgroup_name  server1-servers ; The name of the hostgroup
    alias           server1 Servers ; Long name of the group
    members         server1     ; Comma separated list of hosts that belong to this group
    }
    define service{
    use                             local-service         ; Name of service template to use
    host_name                       server1
    service_description             PING
    check_command            check_ping!100.0,20%!500.0,60%
    }
     define service{
    use                             local-service         ; Name of service template to use
    host_name                       server1
    service_description             Root Partition
    check_command            check_local_disk!20%!10%!/
    }
     define service{
    use                             local-service         ; Name of service template to use
    host_name                       server1
    service_description             Current Users
    check_command            check_local_users!20!50
    }
     define service{
    use                             local-service         ; Name of service template to use
    host_name                       server1
    service_description             Total Processes
    check_command            check_local_procs!250!400!RSZDT
    }
     # Define a service to check the load on the local machine.
     define service{
    use                             local-service         ; Name of service template to use
    host_name                       server1
    service_description             Current Load
    check_command            check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
    }
     define service{
    use                             local-service         ; Name of service template to use
    host_name                       server1
    service_description             Swap Usage
    check_command            check_local_swap!20!10
    }
     define service{
    use                             local-service         ; Name of service template to use
    host_name                       server1
    service_description             SSH
    check_command            check_ssh
    notifications_enabled        0
    }
     define service{
    use                             local-service         ; Name of service template to use
    host_name                       server1
    service_description             HTTP
    check_command            check_http
    notifications_enabled        0
    }
    Your Configuration will be like this . Now save that config.
    [mylogin@hostname nagios]#service nagios restart
    [mylogin@hostname nagios]# chkconfig nagios on
    [mylogin@hostname nagios]# service nrpe restart
    [mylogin@hostname nagios]# chkconfig nrpe on
    [mylogin@hostname nagios]# nagios -v /etc/nagios/nagios.cfg
    Nagios Client Configuration

    [mylogin@hostname nagios]# nano /etc/nagios/nrpe.cfg
    change server_address=127.0.0.1 to your nagios server ip
    [mylogin@hostname nagios]# service nagios restart
    [mylogin@hostname nagios]# chkconfig nagios on
    [mylogin@hostname nagios]# service nrpe restart
    [mylogin@hostname nagios]# chkconfig nrpe on
    Last edited by onel0ve; 10th May 2012 at 06:46 PM.
    || Host4Offshore :: Reliable, Quality, Fast Offshore VPS & Dedicated Hosting Solution (USA/Netherlands/Turkey/Russia/Romania)
    || Shared , Reseller Hosting Sales Thread
    || XEN/OPENVZ VPS server Sales Thread
    || Current Promotion


  2. #2
    Respected Member cvrle77's Avatar

    • My Statistics

  3. #3
    Member onel0ve's Avatar

    Website(s):
    host4offshore.com
    • My Statistics

    Default

    read my whole post i explain how to config it properly . Its not copy of that post .
    || Host4Offshore :: Reliable, Quality, Fast Offshore VPS & Dedicated Hosting Solution (USA/Netherlands/Turkey/Russia/Romania)
    || Shared , Reseller Hosting Sales Thread
    || XEN/OPENVZ VPS server Sales Thread
    || Current Promotion

Results 1 to 3 of 3

Similar Threads

  1. How to Install Minecraft on CentOS VPS
    By VPS6NET in forum Tutorials and Guides
    Replies: 1
    Last Post: 25th Sep 2013, 09:06 PM
  2. how to install ftp on centos
    By -={MINDFREAK}=- in forum Technical Help Desk Support
    Replies: 3
    Last Post: 12th Jun 2011, 05:50 PM
  3. How to install Email Client for my website
    By Jason_weds_Freddy in forum Technical Help Desk Support
    Replies: 4
    Last Post: 23rd Apr 2011, 06:53 PM
  4. How To UnInstall No Maching Client from CentOs
    By dxgamers in forum Server Management Help
    Replies: 0
    Last Post: 29th Aug 2010, 12:59 PM