• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Install Nagios Server on CentOS/RHEL 7/6

Written by Rahul, Updated on September 21, 2019
Nagios monitoring, nagios, nagiosql

Nagios is the most popular, open source, powerful monitoring system. It enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes. Nagios has the capability of monitoring application, services, entire IT infrastructure.

Install Nagios Core

This is Part-1 of complete article How to Setup Nagios Monitoring Server with NagiosQL on CentOS/RHEL 7/6, In this part, you will find the steps to setup Nagios Monitoring Server on CentOS, Redhat, and Fedora systems.

Step 1 – Install Required Packages

We assume that you have fresh installed CentOS, Red Hat or Fedora systems, So our first requirement is to install Apache and PHP first. Use the following commands to complete it. You can find detailed LAMP setup instruction here.

Install Packages:

yum install httpd php php-cli gcc unzip wget glibc glibc-common gd gd-devel net-snmp

Start Services:

service httpd start

Step 2 – Setup User Accounts

Now create a new nagios user account and setup a password to this account

useradd nagios
passwd nagios

Now create a groud for nagios setup “nagcmd” and add nagios user to this group. Also add nagios user in apache group.

groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache

Step 3 – Install Nagios Core Service

After installing the required dependencies and adding user accounts. Let’s start with the Nagios core installation. Download the latest Nagios core service from the official site.

cd /opt/
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz
tar xzf nagios-4.4.5.tar.gz
cd nagios-4.4.5
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-daemoninit
make install-config
make install-commandmode
 make install-exfoliation

Now use below command to setup Apache configuration for Nagios installation.

make install-webconf

Step 4 – Configure Apache Authentication

We need to setup apache authentication for user nagiosadmin. Do not change this username. else you would required more changes in configuration.

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

Now restart Apache service to make the new settings take effect.

service httpd restart

Step 5 – Install Nagios Plugins

After installing and configuring Nagios core service, Download latest nagios-plugins source and install using the following commands.

cd /opt
wget http://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
tar xzf nagios-plugins-2.2.1.tar.gz
cd nagios-plugins-2.2.1

Now compile and install nagios plugins

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

Step 6 – Verify and Start Nagios

First, verify the Nagios configuration file using the following command.

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

If there is no error, let’s start the Nagios serivce

service nagios start

Step 7 – Access Nagios in Web Browser

Nagios creates its own apache configuration file /etc/httpd/conf.d/nagios.conf. There are no need to make any changes to it. Simply open below url in browser.
[change domain name with your domain or ip]

 http://nagios.tecadmin.net/nagios/

Prompting for Apache Authentication Password –

Nagios After login screen –

Finally, you have successfully installed and configured Nagios core service in your system. Now go to article install NagiosQL3 web interface for managing Nagios.

Share it!
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

Related Posts

  • How to Monitor Linux System Performance with Sysstat

    January 21, 2018
  • How to Monitor Memory, CPU and Disk on Linux using NRPE and Nagios

    January 3, 2018
  • How to Create Own Nagios Plugin using Bash Shell Script

    November 1, 2017
  • How to Install Zabbix Agent on Windows System

    April 30, 2016
  • How To Install Zabbix Agent on Ubuntu 18.04 & 16.04 LTS

    April 27, 2016

52 Comments

  1. Avatar Stephony Reply to Stephony
    December 12, 2019 at 10:22 am

    Great information shared. Adding a few lines about Nagios, ” Nagios provides complete monitoring of Linux operating systems and distributions – including operating system metrics, service state, process state, file system usage, and more.”

  2. Avatar David Reply to David
    October 16, 2019 at 3:12 pm

    Awesome!. Perfect guide.

  3. Avatar Noman Reply to Noman
    July 10, 2019 at 6:30 pm

    Your first step successfully done[How to Install Nagios 4 (Monitoring Server) on CentOS/RHEL 7/6] & its very helpful to understand. Would u plz tell me process, how to add host? & what another services are need to installed ? Plz Note I am using centos7 .

    Reagards

    • Avatar David Reply to David
      October 16, 2019 at 3:32 pm

      This is just a simple guide, but check some examples.

      –Open this file
      nano /usr/local/nagios/etc/nagios.cfg

      —search and uncoment
      #cfg_file=/usr/local/nagios/etc/objects/switch.cfg

      —to

      cfg_file=/usr/local/nagios/etc/objects/switch.cfg

      —close file

      —Open and add these command below (host and 2 services to monitoring)
      nano /usr/local/nagios/etc/objects/switch.cfg

      define host{
      use generic-switch
      host_name switchcore01
      alias swtich main num 1
      address 10.10.10.3
      hostgroups switches
      }

      define service{
      use generic-service
      host_name switchcore01
      service_description PING
      check_command check_ping!200.0,20%!600.0,60%
      normal_check_interval 5
      retry_check_interval 1
      }

      define service {
      use generic-service
      host_name switchcore01
      service_description Uptime
      check_command check_snmp!-C MYCOMMUNITYHERE -o sysUpTime.0
      }

      —-close the file

      —–checck the config
      sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

      — now reload the service

      sudo service nagios reload

      —-You can see on the web browser.

      Regards

  4. Avatar gopal Reply to gopal
    April 3, 2019 at 5:45 am

    am getting some warning while installing Nagios in centos through putty

  5. Avatar ravi kumar Reply to ravi
    February 26, 2019 at 8:11 am

    Hi Rahul, may I know what is port number RRD database uses in Nagios.

  6. Avatar Nirbhay Reply to Nirbhay
    September 4, 2018 at 5:24 am

    Hi I followed all lines.
    While i was writing command make make all
    got error “make: *** No rule to make target `all’. Stop.”
    make utility allready installed.
    Please help in this.

  7. Avatar serge Reply to serge
    July 12, 2017 at 9:55 am

    hi i am serge
    i have install nagios properly when i run nagios.service i have this message “job for nagios.service failed because the control process exited with error code” thanks for your help

  8. Avatar Yuga Reply to Yuga
    June 8, 2016 at 8:54 am

    i am getting Authorization Required problem

  9. Avatar srinivas Reply to srinivas
    May 19, 2016 at 12:06 pm

    Hi Team,

    I installed Nagios on Linux, with all the steps as mentioned above. but while logging I am not able to login. getting error like
    ” Authorization Required

    This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn’t understand how to supply the credentials required.

    Apache/2.2.15 (Red Hat) Server at 172.29.218.194 Port 80″

    Can some one help on this please.

« Previous 1 2 3

Leave a Reply

Cancel reply

Popular Posts

  • How to Install Python 3.8 on Ubuntu, Debian and LinuxMint
  • How to Restart Network Service on CentOS 8 or RHEL 8
  • How to Check IP Address on CentOS 8
  • How to Install Java 11/8 on Amazon Linux
  • How to Configure Static IP on CentOS 8 (CLI)
Copyright © 2013-2019 TecAdmin.net. All Rights Reserved. This site uses cookies. By using this website you agree with our term and services
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkNo
Revoke cookies