Hosting Talk | Web Hosting talk India

Web Hosting   Add Host and Hosting News 

 

Go Back   Hosting Talk | Web Hosting talk India > Web Hosting Main Forums > Hosting Software and Control Panels > Hosting Software and Control Panels Tutorials

Ads

Reply
 
Thread Tools Display Modes
  #1  
Old 06-04-2012, 08:17 PM
Rox Rox is offline
Moderator
 
Join Date: May 2012
Posts: 18
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
Reply With Quote
  #2  
Old 06-05-2012, 04:10 AM
jitender jitender is offline
Administrator
 
Join Date: May 2012
Posts: 104
Default

hi Rox,

Very informative post,

You make almost very simple to Installation & Configuration of Nagios & Nagios Client (NRPE) on CentOS 5.

Well written too.

jitender
Reply With Quote
Reply

Tags
centos 5, nagios client, nrpe

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 04:35 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2018, SEO by YABBSEO 1.0 2012, YABSoft.com.