• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

Install nagios 4.0.2 in CentOS 6 using tarball

November 27, 2013 by Sharad Chhetri 10 Comments

In this tutorial we will learn about how to install nagios 4.0.2 in Linux using tarball.Nagios is one of the famous and very robust Monitoring Server.The installation has been done in minimal installed CentOS 6.4.Recently Nagios team has released its much awaited 4.x version.The installation steps is applicable to other Nagios version also.

Details of Server:

Operating System : CentOS 6.4
Arch : x86_64
Nagios Version: 4.0.2
My Server IP address: 192.168.1.6

IPtables is stopped /etc/init.d/iptables stop
SELINUX is disabled

Follow the given below steps to install Nagios 4.x

Login to your Server by using root user

Step 1 : Install wget package for downloading the Nagios package through command line.

yum install wget

Step 2: Download Nagios package. You will get the Nagios package in tar format.

wget http://nchc.dl.sourceforge.net/project/nagios/nagios-4.x/nagios-4.0.2/nagios-4.0.2.tar.gz

Step 3: Install the dependencies and apache server (httpd)

yum install   httpd php  gd gd-devel gcc glibc glibc-common openssl perl perl-devel make

Step 4: Now create the user and group for Nagios installation

useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios

Step 5: Now extract the downloaded file. Here I downloaded the file called nagios-4.0.2.tar.gz (see in Step 2)


tar -xvzf nagios-4.0.2.tar.gz

Step 6: After extracting the downloaded nagios package.It will extract out the Nagios directory. Here we downloaded the package nagios-4.0.2.tar.gz, after extraction I got directory called nagios-4.0.2 .

Now change to extracted out Nagios directory . On using ls -la command you will see many files inside nagios-4.0.2 directory,these all files and directory will be used in installation. So we are going to compile the Nagios package.

cd nagios-4.0.2

./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf

After running all above commands if you find no error now move to next step.

Now copy the eventhandlers directory into /usr/local/nagios/libexec/ as well as change ownership and group of this copied directory

cp -rvf contrib/eventhandlers/ /usr/local/nagios/libexec/

chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers

Step 7: Now we will check nagios.cfg file configuration. Use the given below command for it. It should not show any error otherwise nagios service can not be started. You can use this command whenever you do any configuration change in nagios.cfg file.

Syntax: /usr/local/nagios/bin/nagios -v


/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Step 8: Now we set the htpasswd apache authentication for user nagiosadmin. This same username and password will be used when you will try to open nagios dashboard.

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Step 9: Start the apache and nagios service

/etc/init.d/nagios start
/etc/init.d/httpd start

to bydefault service run in runlevel 3,4,5 use below given command

chkconfig nagios on
chkconfig httpd on

Step 10: Change the permission of file /usr/local/nagios/var/rw/nagios.cmd .(reference from this troubleshooting post)

chmod 666 /usr/local/nagios/var/rw/nagios.cmd

Install Nagios plugin from source

Now in this section we will install nagios plugin.Later you can also add some more nagios as per your requirement. I downloaded the plugin from this link

Follow the given below steps for nagios plugin installation

cd ~

wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz

tar -xvzf nagios-plugins-1.5.tar.gz

cd nagios-plugins-1.5

./configure --with-nagios-user=nagios --with-nagios-group=nagios

make

make install 

Step 11: Now time to go to Nagios dashboard. Open the web browser in address link type your server ip address appending /nagios.
Now give username nagiosadmin password which you have set in Step 9

My Nagios server ip address is 192.168.1.6 hence replace the ip address with your server ip

http://192.168.1.6/nagios

After login you will get your Nagios dashboard (See the screenshot)

nagios

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. Error: Could not open command file ‘/usr/local/nagios/var/rw/nagios.cmd’ for update!
  2. How to install Nagios on CentOS 7 / RHEL 7
  3. Installing Nagios-3.4 in CentOS 6.3
  4. Installing Nagios-3.5.0 in CentOS 6.4 using yum
  5. How to install and configure nagios nrpe in CentOS and Red Hat
  6. How to install nagios server in Ubuntu 12.04 LTS
  7. How to install and configure nagios nrpe client in Ubuntu with apt-get command
  8. Install and configure nagios core 4 on Ubuntu 12.04 LTS
  9. Install vshell frontend on Nagios Core 4 Ubuntu 12.04 LTS
  10. How to install Nagios 4 from source on Ubuntu 14.04 LTS

Filed Under: Linux, Monitoring Server Tagged With: Nagios

Reader Interactions

Comments

  1. Mícheál Ó Laoghaire says

    July 15, 2014 at 2:15 am

    Excellent Article still works well on 4.0.7 of Nagios

    Reply
    • sharadchhetri says

      July 15, 2014 at 2:13 pm

      Thankyou Micheal,

      Glad to know , the post helped you.
      I would also like to thank to you for mentioning Nagios Version. This information will help other reader

      With Regards
      Sharad

      Reply
  2. Rudra says

    April 5, 2014 at 7:53 am

    Hi Sharad, Nice tutorial. With Respect to Step 10, there is something i need to share. With Nagios 4.0.4, in order to sort out the rw permission issue i sorted it out by issuing “sudo chown -R nagios:apache /usr/local/nagios/var/rw/”. Because “chmod 666 /usr/local/nagios/var/rw/nagios.cmd” is not sorting the issue.

    Reply
    • sharad chhetri says

      April 5, 2014 at 8:02 am

      Thanks Rudra,

      Very helpful for user who are following this tutorial on Nagios 4.0.4.
      Keep reading our blog.
      Appreciate for your information.

      Regards
      Sharad

      Reply
  3. saroj says

    February 19, 2014 at 11:33 am

    Hi! Sharad,

    I could not open the nagios dashboard while trying to open http://localhost/nagios , it is asking for username and password.

    By entering username: nagiosadmin and password (according to the your step:8), again showing authentication required (username and passwd). I could not login.

    Can you please guide?

    Reply
    • sharad chhetri says

      February 19, 2014 at 1:15 pm

      Hello Saroj,

      Revalidate all steps and regenerate new password from step 8.
      Check selinux also.In this tutorial,I disabled the selinux. Follow this guide to disable selinux https://sharadchhetri.com/2013/02/27/how-to-disable-selinux-in-red-hat-or-centos/

      Reply
  4. Gourab P says

    February 12, 2014 at 6:36 am

    Nagios is running fine for the nagios server machine, but is not reflecting info of other servers which it needs to monitor. I’m not getting any errors. My SELinux and iptable have been disabled. Please help.

    Reply
    • sharad chhetri says

      February 12, 2014 at 8:15 am

      Hello Gourab,

      For monitoring remote machine ,you have to install nrpe client in remote machine. I have written a documentation .I hope it will help you , How to install and configure NRPE in CentOS .
      Because we have installed Nagios from tarball, use the Nagios base directory /usr/local/nagios instead of /etc/nagios/ (/etc/nagios/ path I have given in this previous tutorial)

      For Debian/Ubuntu machine, use this tutorial , https://sharadchhetri.com/2013/06/11/how-to-install-and-configure-nagios-nrpe-client-in-ubuntu-with-apt-get-command/

      Reply
  5. Bob D. says

    January 3, 2014 at 4:03 pm

    Hi Sharad
    I think something is missing as I get this error in Apache error_log :
    Directory index forbidden by Options directive: /usr/local/nagios/share/
    After looking in Google, I find that php was missing : yum install httpd mod_php, service nagios/httpd restart and everything work’s fine.
    Could you clarify this ?
    Thanx.
    Bob

    Reply
    • sharad chhetri says

      January 3, 2014 at 4:52 pm

      I think you might missed the step 3

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

How to change hostname in Ubuntu 12.04 and 12.10 without system restart

How to set JAVA environment variables in Linux

Print double hyphen sign simultaneously in post of Octopress

Edit the crontab without using crontab -e

Install libjpegtran by using yum command in CentOS 6.x

How to configure ethernet in CentOS 6 after installing in Virtual Box

How to install korn shell ksh in Linux

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ·
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy