1. Adding user nagios
[root@localhost ~]# useradd -s /bin/false -d /opt/nagios nagios
[root@localhost ~]# groupadd nagioup
[root@localhost ~]# usermod -G nagioup nagios
[root@localhost ~]# usermod -G nagioup apache
2. Download nagios di http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.3.tar.gz
[root@localhost ~]# mkdir /download
[root@localhost ~]# cd /downloads
3. Tarball nagios package.
[root@localhost downloads]# tar xzvf nagios-3.0.3.tar.gz
[root@localhost downloads]# cd nagios-3.0.3
4. Install nagios
[root@localhost nagios-3.0.3]# ./configure --prefix=/opt/nagios --with-command-group=nagioup
[root@localhost nagios-3.0.3]# make all
5. Install library
[root@localhost nagios-3.0.3]# make install
[root@localhost nagios-3.0.3]# make install-init
[root@localhost nagios-3.0.3]# make install-config
[root@localhost nagios-3.0.3]# make install-commandmode
6. Edit contact file for sending warning by mail
[root@localhost nagios-3.0.3]# vi /opt/nagios/etc/objects/contacts.cfg
define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
email
rhesamahendra@gmail.com
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagiosadmin
}
7. Install nagios in to httpd file
[root@localhost nagios-3.0.3]# make install-webconf
8. Setting password for login nagios
[root@localhost nagios-3.0.3]# htpasswd -c /opt/nagios/etc/htpasswd.users nagiosadmin
Download Plugin di sini http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz
9. After nagios have been installed, we can install nagios plugin
[root@localhost downloads]# tar xzvf nagios-plugins-1.4.11.tar.gz
[root@localhost downloads]# cd nagios-plugins-1.4.11
10. Install nagios plugin
[root@localhost nagios-plugins-1.4.11]# ./configure --prefix=/opt/nagios --with-nagios-user=nagios --with-nagios-group=nagioup
[root@localhost nagios-plugins-1.4.11]# make
[root@localhost nagios-plugins-1.4.11]# make install
11. Adding service for booting
[root@localhost nagios-plugins-1.4.11]# chkconfig --add nagios
[root@localhost nagios-plugins-1.4.11]# chkconfig nagios on
12. For looking our configuration running
[root@localhost nagios-plugins-1.4.11]# /opt/nagios/bin/nagios -v /opt/nagios/etc/nagios.cfg
13. Running nagios service
[root@localhost nagios-plugins-1.4.11]# service nagios start
14. Change your permission for nagios folder
[root@localhost nagios-plugins-1.4.11]# chmod 755 /opt/nagios
we can checked from this url http://localhost/nagios atau http://ip_number/nagios
will found like this picture, for user nagiosadmin and password like has been maked.
1
After we can login we can look this picture
home
In left sidebar you can looking fiture -fiture nagios.
And now we will try for adding other server for monitored.
15. Copy file localhost file for setting a new server we give name satu
[root@localhost ~]# cp /opt/nagios/etc/objects/localhost.cfg /opt/nagios/etc/objects/satu.cfg
16. Edit file satu.cfg
[root@localhost ~]# nano /opt/nagios/etc/objects/satu.cfg
# Define a host for the local machine
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 satu
alias satu
address 208.99.198.183
}
# Define a service to “ping” the local machine
define service{
use local-service ; Name of service template to use
host_name satu
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 satu
service_description HTTP
check_command check_http
notifications_enabled 0
}
17. Adding file satu.cfg in to nagios.cfg
[root@localhost ~]# nano /opt/nagios/etc/nagios.cfg
# Definitions for monitoring the local (Linux) host
cfg_file=/opt/nagios/etc/objects/localhost.cfg
cfg_file=/opt/nagios/etc/objects/satu.cfg
18. Cek again your configuration
[root@localhost ~]# /opt/nagios/bin/nagios –v /opt/nagios/etc/nagios.cfg
19 Running nagios service
[root@localhost ~]# service nagios restart
service
this result we can look picture in this top, have 2 servers the first localhost and satu server.