You are on page 1of 11

12/5/11 Nagios 3.

0 Jumpstart Guide For Linux Overview, Installation and Configura


1/11 thegeekstuff.com//nagios-30-jumpstart-guide-for-red-hat-overview-installa
0 19
10 Lie
Home
About
Free eBook
Archives
Best oI the Blog
Contact

Nagios 3.0 Jumpstart Guide For Linux Overview, Installation and
Configuration
by Ramesh Natarajan on May 29, 2008
StumbleUpon
Let us discuss the overview, installation and conIiguration oI Nagios, a powerIul open source monitoring solution Ior host and services.

I. Overview oI nagios
II. 8 steps Ior installing nagios on Linux:
1. Download the nagios and plugins
2. Take care oI the prerequisites
3. Create user and group Ior nagios
4. Install nagios
5. ConIigure the web interIace
6. Compile and install nagios plugins
7. Start Nagios
8. Login to web interIace
III. ConIiguration Iiles overview
I. Overview of Nagios
.
Nagios is a host and service monitor tool. Following are some oI the Ieatures oI nagios.

Monitor equipments such as servers, switches, routers, Iirewalls, power supply etc.
Monitor services such as disk space, cpu usage, memory usage, temperature oI the equipment, HTTP, Mail, SSH etc.
Nagios can monitor pretty much anything. Ior e.g. host, services, databases, applications etc.
Nagios has an extensible plugin interIace Ior monitoring user deIined services. There are lot oI plugins available Ior Nagios. Visit NagiosPlugins and NagiosExchange Ior review
the available user developed plugins.
It can send out various notiIications ( email, pager etc.) when the problem occurs and get resolved.
Web interIace to view current status, notiIications, problem history, log Iiles etc.
Following is a partial screenshot oI the nagios web dashboard:

Ads b Google Uni to Linu Debian Linu Server Nagios Tool RedHat Linu
12/5/11 Nagios 3.0 Jumpstart Guide For Linux Overview, Installation and Configura
2/11 thegeekstuff.com//nagios-30-jumpstart-guide-for-red-hat-overview-installa
Fig: Nagios Web UI (click on the image to enlarge)
II. 8 steps for installing nagios on Linu:
1. Donload the nagios and plugins
Download following files from Nagios.org and move to /home/downloads
nagios-3.0.1.tar.g
nagios-plugins-1.4.11.tar.g
2. Take care of the prerequisites
Make sure apache is working on the server b verifing from browser: http://localhost
Verif whether gcc is installed
[@cah]#rpm -qa grep gcc
gcc-3.4.6-8
ca-gcc-32-3.2.3-47.3
ibgcc-3.4.6-8
ca-ibgcc-296-2.96-132.7.2
ca-gcc-32-c++-3.2.3-47.3
gcc-c++-3.4.6-8
Verif whether GD is installed
[@cah]# -a gd
gd-2.0.28-5.4E
3. Create user and group for nagios
[@cah]# eadd agi
[@cah]# ad agi
[@cah]# gadd agcd
[@cah]# ed -G agcd agi
[@cah]# ed -G agcd aache
4. Install nagios
[@cah]# a f agi-3.0.1.a.g
[@cah]# cd agi-3.0.1
[@cah]# ./cfige --ih-cad-g=agcd
[@cah]# ae a
[@cah]# ae ia
[@cah]# ae ia-cfig
[@cah]# ae ia-cadde
Following are some additional parameters that ou can pass to ./configure to customie our installation. I used onl --with-command-group as shown above.
--efi //agi Whee he Nagi fie
--ih-cgi /agi/cgi-bi Web ee hee he cgi' i be aaiabe
--ih-h /agi Web ee hee agi i be aaiabe
--ih-agi-e agi e acc de hich Nagi i
--ih-agi-g agi g acc de hich Nagi i
--ih-cad-g agcd g acc hich i a he aache e bi
cad Nagi
At the end of the configure output, it will displa a summar as shown below:
*** Cfigai a f agi 3.0.1 05-28-2008 ***:
Geea Oi:
Netork Monitoring .ni mof.com/neok-moni oi ng
Diagnoe & Reole Neok Ie. Donload
Fee Tial!
12/5/11 Nagios 3.0 Jumpstart Guide For Linux Overview, Installation and Configura
3/11 thegeekstuff.com//nagios-30-jumpstart-guide-for-red-hat-overview-installa
General Options:
-------------------------
Nagios executable: nagios
Nagios user/group: nagios,nagios
Command user/group: nagios,nagcmd
Embedded Perl: no
Event Broker: yes
Install ${prefix: /usr/local/nagios
Lock file: ${prefix/var/nagios.lock
Check result directory: ${prefix/var/spool/checkresults
Init directory: /etc/rc.d/init.d
Apache conf.d directory: /etc/httpd/conf.d
Mail program: /bin/mail
Host OS: linux-gnu
Web Interface Options:
------------------------
HTML URL: http://localhost/nagios/
CGI URL: http://localhost/nagios/cgi-bin/
Traceroute (used by WAP): /bin/traceroute
5. Configure the web interface.
[root@localhost]# make install-webconf
[root@localhost# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin
6. Compile and install nagios plugins
[root@localhost]# tar xvf nagios-plugins-1.4.11.tar.gz
[root@localhost]# cd nagios-plugins-1.4.11
[root@localhost]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
[root@localhost]# make
[root@localhost]# make install
Note: On Red Hat, the ./configure command mentioned above did not work and was hanging at the when it was displaying the message: checking for redhat spopen problem
Add enable-redhat-pthread-workaround to the ./configure command as a work-around for the above problem as shown below.
[root@localhost]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-redhat-pthread-workaround
7. Start Nagios
Add the nagios to the startup routine:
[root@localhost]# chkconfig --add nagios
[root@localhost]# chkconfig nagios on
Verify to make sure there are no errors in the nagios configuration file:
[root@localhost]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
Start the nagios
[root@localhost]# service nagios start
Starting nagios: done.
8. Login to web interface
Nagios Web URL: http://localhost/nagios/
Use the userid, password that was created from step#5 above.
III. Configuration files overview
.
The first configuration to modify is to change the default value of email address in /usr/local/nagios/etc/objects/contacts.cfg file to your email address.
Following are the three major configuration files located under /usr/local/nagios/etc

1. nagios.cfg This is the primary Nagios configuration file where lot of global parameters that controls the nagios can be defined.
2. cgi.cfg - This files has configuration information for nagios web interface.
3. resource.cfg If you have to pass some sensitive information (username, password etc.) to a plugin to monitor a specific service, you can define them here. This file is
readable only by nagios user and group.
Following are the other configuration files under /usr/local/nagios/etc/objects directory:

contacts.cfg: All the contacts who needs to be notified should be defined here. You can specify name, email address, what type of notifications they need to receive and what
12/5/11 Nagios 3.0 Jumpstart Guide For Linux Overview, Installation and Configura
4/11 thegeekstuff.com//nagios-30-jumpstart-guide-for-red-hat-overview-installa
1
StumbleUpon
Share
10 Lie
contacts.cfg: All the contacts who needs to be notified should be defined here. You can specify name, email address, what type of notifications they need to receive and what
is the time period this particular contact should be receiving notifications etc.
commands.cfg All the commands to check services are defined here. You can use $HOSTNAME$ and $HOSTADDRESS$ macro on the command execution that will
substitute the corresponding hostname or host ip-address automatically.
timeperiods.cfg Define the timeperiods. for e.g. if you want a service to be monitored only during the business hours, define a time period called businesshours and specify
the hours that you would like to monitor.
templates.cfg Multiple host or service definition that has similar characteristics can use a template, where all the common characteristics can be defined. Use template is a
time saver.
localhost.cfg Defines the monitoring for the local host. This is a sample configuration file that comes with nagios installation that you can use as a baseline to define other
hosts that you would like to monitor.
printer.cfg Sample config file for printer
switch.cfg Sample config file for switch
windows.cfg Sample config file for a windows machine
I will discuss about the steps to configure a remote Linux Host and Windows Host for monitoring through nagios in upcoming posts.

Best Nagios Book


Nagios Core 3 eBook Ive been using Nagios for several years, and I can sleep peacefully at night knowing that Nagios is monitoring all my systems and
will warn me about any potential issue, before it becomes critical. I strongly recommend that you read Nagios Core 3 ebook to gain detailed understanding on Nagios. Since Nagios
is free software, spending few dollars on the book can be the best investment you can make.
Awesome Nagios Articles
Following are few awesome Nagios articles that you might find helpful.
How To Monitor Remote Windows Machine Using Nagios on Linux
How To Monitor Remote Linux Host using Nagios 3
How To Monitor Network Switch and Ports Using Nagios
Comment
If you enjoyed this article, you might also like..
1. 50 Linux Sysadmin Tutorials
2. 50 Most Frequently Used Linux Commands (With Examples)
3. Mommy, I found it! 15 Practical Linux Find Command Examples
4. Turbocharge PuTTY with 12 Powerful Add-Ons
5. Linux 101 Hacks 2nd Edition eBook
Awk Introduction 7 Awk Print Examples
Advanced Sed Substitution Examples
8 Essential Vim Editor Navigation Fundamentals
25 Most Frequently Used Linux IPTables Rules Examples
Advanced Regular Expressions in Grep Command with 10 Examples
12/5/11 Nagios 3.0 Jumpstart Guide For Linux Overview, Installation and Configura
5/11 thegeekstuff.com//nagios-30-jumpstart-guide-for-red-hat-overview-installa
Tags: Linux Monitoring Solution, nagios, nagios 3.0, nagios add-on, Nagios Configuration, Nagios for RedHat, Nagios Installation, Nagios Plugin, Nagios Web UI, open source
monitoring
{ 33 comments read them below or add one }
1 jackie July 23, 2008 at 9:10 am
I cant find any documentation about how to add further hosts. i have nagios running, monitoring the local host and another pc, using the localhost.cfg and windows.cfg file. How
to add more hosts? I tried to create another file and declared it in the nagios.cfg file but doesnt work. any ideas?
2 Neal September 24, 2008 at 9:07 am
I think you missed a command. Step 4 should also include make install-init otherwise step 7 will fail. Otherwise perfect post, thank you! Saved me a bit of hair pulling.
3 Ian October 23, 2008 at 2:47 am
There are also very useful quick start guides for Fedora, openSUSE and Ubuntu in the Nagios documentation
4 Siva December 4, 2008 at 6:43 pm
Hi, I had configured the windows.cfg file for one server. How do I configure for multiple servers?
5 Balakumar December 25, 2008 at 10:43 am
Thank u so much for nice article.It is very understandable.
6 kailas kadam June 29, 2009 at 10:55 pm
i configured nagios . when i was starting the NAGIOS service it is showing the error like unrecgnised service can u help me what is the service for nagios
waiting for reply
7 Ian June 29, 2009 at 11:29 pm
What does chkconfig list | grep nagios show? If it shows nothing you need to go through the install guide again and check all the steps.
8 gopi August 25, 2009 at 8:35 am
Thanks I have successfully configured nagios by reading the above. but before trying this i installed through rpm which failed.
9 Arunkeerthan October 7, 2009 at 2:18 am
I configured Nagios no errors and warnings.But when i tried to start the Nagios service its saying unrecognized service Nagios .Please help me out in this issue..
10 Arunkeerthan October 7, 2009 at 11:13 am
make install-init chould be added to step 4 in RHEL.Otherwise its not working step 7 fails.I dont know about the other distros.
Thanks for the wonderful post.
11 Ezudin December 18, 2009 at 4:21 am
For installation on Ubuntu server see: https://help.ubuntu.com/9.10/serverguide/C/nagios.html
12 Anonymous March 5, 2010 at 7:15 am
Thanks I have successfully configured nagios but i got some error
(( (13)Permission denied: exec of /usr/local/nagios/sbin/statusmap.cgi failed, referer: http://10.35.29.100/nagios/side.php
[Fri Mar 05 15:46:44 2010] [error] [client 10.35.45.116] Premature end of script headers: statusmap.cgi, referer: http://10.35.29.100/nagios/side.php))
I got a solution for this error here is the udpate. pelase run this command.
#chcon -R system_u:object_r:httpd_sys_script_exec_t /usr/local/nagios/sbin
it will solve the problem.
Once again thanks.
13 chin March 24, 2010 at 9:19 am
Hi i got 403 forbidden error for nagios like::::
You dont have permission to access /nagios/ on this server.
Apache/2.2.3 (Red Hat) Server at localhost Port 80
can any one help me please?
14 Chris J May 6, 2010 at 6:58 pm
12/5/11 Nagios 3.0 Jumpstart Guide For Linux Overview, Installation and Configura
6/11 thegeekstuff.com//nagios-30-jumpstart-guide-for-red-hat-overview-installa
14 Chris J May 6, 2010 at 6:58 pm
Thanks for the great post!!!
Just would like to add you will need to restart httpd before you start nagios
15 anurag sharma May 24, 2010 at 7:55 am
Dear Sir
I am daily visitor of your your great site and also i am getting your daily newsletters on my mail.i am a big fan of yours.
Please sir include some other post in nagios like monitoring MySql
for
connection-time
keycache-hitrate
qcache-hitrate
tablecache-hitrate
threadcache-hitrate
tmp-disk-tables
your configuration steps for all topics are very clear.
I hape you will consider my request.
Thanks
16 Srini June 17, 2010 at 12:33 am
Hi,
I am getting the below error. Anyone help me to sort it out.
*************************************************************************************
Forbidden
You dont have permission to access /nagios/cgi-bin/ on this server.
Apache/2.2.3 (Oracle) Server at 10.12.68.57 Port 80
*************************************************************************************
Appreciate your response asap.
Thanks in advance,
17 KP June 23, 2010 at 3:42 am
Hi, its not working.
i did as per your instruction, but still http://localhost/nagios/ not opening in ocal syste.
please help on this.
18 waqar azeem July 16, 2010 at 12:42 pm
Please note that php is also the prerequisite for nagios to work.
Verify you have PHP installed and enabled. Verify index.php is listed
as a DirectoryIndex within httpd.conf or conf.d/php.conf (depending on
your OS/distribution)
19 Muhammad Salman October 10, 2010 at 3:16 pm
Its great, i dont have words for you, you explain every step v.well.
20 srini November 17, 2010 at 2:55 pm
Dear Sir
Could you help me out with steps of notification of email and sms and for plotting graps
21 Navin March 4, 2011 at 6:19 am
How do i setup Nagios to monitor websites on the Internet and alert if they are not reachable, Please assist with the steps to setup this as i have tried them but not successfully
with it.
22 hima April 7, 2011 at 3:56 am
sir,
Thank you very much,
the installation steps are very clear,
i did as u wrote,
service nagios start also working
but in the browser
12/5/11 Nagios 3.0 Jumpstart Guide For Linux Overview, Installation and Configura
7/11 thegeekstuff.com//nagios-30-jumpstart-guide-for-red-hat-overview-installa
but in the browser
http://localhost/nagios/
showing
The requested URL /nagios was not found on this server.
Apache/2.2.3 (Red Hat) Server at localhost Port 80
,
please help me,
thanks in advance,
23 Sridevi April 16, 2011 at 2:06 am
Hi,
I am getting the error 500 Internal Server Error after login.
Can you please help me out.
Thanks in Advance.
24 Sridevi April 16, 2011 at 11:44 pm
Hi,
How to add multiple hosts in the nagios server.
25 srini May 11, 2011 at 5:12 am
Hi
Can you help me out, how to install nagios on windows.where can i get this software.
26 soportesisstemas June 10, 2011 at 2:26 pm
Hello I`d like to know if nagios has some type of documentation, guide or installation manual in spanish?
27 banibrat June 27, 2011 at 9:03 am
Sir,
thank u very mach,
Can you provide me the installation step in RHEL5.5
YOU can provide me the step-by-step installation guide of nagios
28 Udaya Sankar July 7, 2011 at 12:39 am
To establish the Nagios Service
first we have to use this command make install-init before chkconfig add nagios
29 Romal July 28, 2011 at 5:47 am
Thanks it works
30 Ishara Fernando August 3, 2011 at 12:00 am
Ramesh,
I tried to install nagios in centos 5.6 but i get access denied message when i enter :
http://localhost/nagios/
so what i did was i installed php :
then entered the following command as root user:
yum install php
/usr/sbin/setenforce 0
chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/
/sbin/service httpd restart
/sbin/service nagios restart
SUccessful !!!
THANKS
then the problem was solved
31 Ishara Fernando August 3, 2011 at 12:26 am
If you guys are using centos 5.6
then follow the steps below:
su root:
yum install httpd php
yum install gcc-3.4.6-8 compat-gcc* libgcc* compat-libgcc* compat-gcc-32* gcc-c++* glibc* glibc-common*
yum install gd gd-devel
12/5/11 Nagios 3.0 Jumpstart Guide For Linux Overview, Installation and Configura
8/11 thegeekstuff.com//nagios-30-jumpstart-guide-for-red-hat-overview-installa
yum install gd gd-devel
/usr/sbin/useradd -m nagios
passwd nagios
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache
Download nagios and nagios-plugins as follows:
wget http://nchc.dl.sourceforge.net/project/nagios/nagios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz
wget http://space.dl.sourceforge.net/project/nagiosplug/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz
eg: if you are downloading as a user called, ishara: then enter the command:
cd /home/ishara/Downloads
Extract and Install nagios as follows:
tar xvf nagios-3.3.1.tar.gz
cd nagios*
./configure with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
Now provide a password for the username called nagiosadmin: run the following command:
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
/sbin/service httpd restart
Now lets install the nagios-plugins as follows: Enter
tar xvf nagios-plugins-1.4.15.tar.gz
cd nagios-plugins*
./configure with-nagios-user=nagios with-nagios-group=nagios
make
make install
Add nagios service to the startup as follows: Enter:
chkconfig add nagios
chkconfig nagios on
To disable SELinux to permissive mode: Enter:
/usr/sbin/setenforce 0
chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/
All work done in the terminal now in and now in firefox or any web-browser, type
http://localhost/nagios/
Enter username : nagiosadmin and the relevant password you entered above:
DONE!!! ENJOY NAGIOS
ISHARA FERNANDO ( FROM: SRI LANKA )
<<<<>>>>
12/5/11 Nagios 3.0 Jumpstart Guide For Linux Overview, Installation and Configura
9/11 thegeekstuff.com//nagios-30-jumpstart-guide-for-red-hat-overview-installa
<<<<>>>>
32 Janardhan September 26, 2011 at 11:06 pm
Its nice tutorial and understandable i succeded in installation and configuration.
Thanks
33 Sachin Salunke November 23, 2011 at 6:34 am
content is really good & usefull , request you to review and improve documentation regarding of Nagios .
Leave a Comment
Name
E-mail
Website
Notify me of followup comments via e-mail
Submit
Previous post: 5 Basic Linux SSH Client Commands
Next post: How To Monitor Remote Linux Host using Nagios 3.0
Sign up for our free email newsletter ou@address.com Sign U
RSS Twitter Facebook
Search
EBOOK



12/5/11 Nagios 3.0 Jumpstart Guide For Linux Overview, Installation and Configura
10/11 thegeekstuff.com//nagios-30-jumpstart-guide-for-red-hat-overview-installa


POPLA PO
12 Amazing and Essential Linux Books To Enrich Your Brain and Library
50 UNIX / Linux Sysadmin Tutorials
50 Most Frequently Used UNIX / Linux Commands (With Examples)
How To Be Productive and Get Things Done Using GTD
30 Things To Do When you are Bored and have a Computer
Linux Directory Structure (File System Structure) Explained with Examples
Linux Crontab: 15 Awesome Cron Job Examples
Get a Grip on the Grep! 15 Practical Grep Command Examples
Unix LS Command: 15 Practical Examples
15 Examples To Master Linux Command Line History
Top 10 Open Source Bug Tracking System
Vi and Vim Macro Tutorial: How To Record and Play
Mommy, I found it! -- 15 Practical Linux Find Command Examples
15 Awesome Gmail Tips and Tricks
15 Awesome Google Search Tips and Tricks
RAID 0, RAID 1, RAID 5, RAID 10 Explained with Diagrams
Can You Top This? 15 Practical Linux Top Command Examples
Top 5 Best System Monitoring Tools
Top 5 Best Linux OS Distributions
How To Monitor Remote Linux Host using Nagios 3.0
Awk Introduction Tutorial 7 Awk Print Examples
How to Backup Linux? 15 rsync Command Examples
The Ultimate Wget Download Guide With 15 Awesome Examples
Top 5 Best Linux Text Editors
Packet Analyzer: 15 TCPDUMP Command Examples
The Ultimate Bash Array Tutorial with 15 Examples
3 Steps to Perform SSH Login Without Password Using ssh-keygen & ssh-copy-id
Unix Sed Tutorial: Advanced Sed Substitution Examples
UNIX / Linux: 10 Netstat Command Examples
The Ultimate Guide for Creating Strong Passwords
6 Steps to Secure Your Home Wireless Network
Turbocharge PuTTY with 12 Powerful Add-Ons
12/5/11 Nagios 3.0 Jumpstart Guide For Linux Overview, Installation and Configura
11/11 thegeekstuff.com//nagios-30-jumpstart-guide-for-red-hat-overview-installa
Abo The Geek Sff
My name is Rameh Naaajan. I will be posting instruction guides, how-to, troubleshooting tips and tricks on Linux, database, hardware, security and web.
My focus is to write articles that will either teach you or help you resolve a problem. Read more about Ramesh Natarajan and the blog.
Sppo U
Support this blog by purchasing one of my ebooks.
Bash 101 Hacks eBook
Sed and Awk 101 Hacks eBook
Vim 101 Hacks eBook
Nagios Core 3 eBook
Conac U
Email Me : Use this Contact Form to get in touch me with your comments, questions or suggestions about this site. You can also simply drop me a line to say hello!.
Follow us on Twitter
Become a fan on Facebook
Copyright 20082011 Ramesh Natarajan. All rights reserved | Terms of Service | Advertise

You might also like