Back to Top
WJunction

Register Now

Welcome Guest!  Register  
Go Back   WJunction - Webmaster Forum > Hosting > Server Management Help > Technical and Security Tutorials

Post Reply
 
Thread Tools Display Modes

Old 10th May 2012, 05:23 PM   #1
Member

onel0ve's Avatar
 
Website(s):
host4offshore.com
  • My Statistics
Send a message via Skype™ to onel0ve
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 05:46 PM.
onel0ve is offline   Quote
Liked by:
Old 10th May 2012, 05:27 PM   #2
Administrator

cvrle77's Avatar
 
  • My Statistics
http://docs.cslabs.clarkson.edu/wiki...os_on_CentOS_5
cvrle77 is offline   Quote
Old 10th May 2012, 05:31 PM   #3
Member

onel0ve's Avatar
 
Website(s):
host4offshore.com
  • My Statistics
Send a message via Skype™ to onel0ve
read my whole post i explain how to config it properly . Its not copy of that post .
onel0ve is offline   Reply
Post Reply

Thread Tools
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Install Minecraft on CentOS VPS VPS6NET Tutorials and Guides 0 30th Dec 2011 03:58 PM
how to install ftp on centos -={MINDFREAK}=- Technical Help Desk Support 3 12th Jun 2011 04:50 PM
How to install Email Client for my website Jason_weds_Freddy Technical Help Desk Support 4 23rd Apr 2011 05:53 PM
How To UnInstall No Maching Client from CentOs dxgamers Server Management Help 0 29th Aug 2010 11:59 AM


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