How to Install Nagios Monitoring in RHEL, Rocky, and AlmaLinux

Nagios is an awesome Open Source monitoring tool, that provides a more comprehensive monitoring environment to always keep an eye on your all machines/networks whether you are in your data center or just your small labs.

With Nagios, you can monitor your remote hosts and their services remotely on a single window. It shows warnings and indicates if something goes wrong in your servers which eventually helps us to detect some problems before they occur. It helps us to reduce downtime and business losses.

Recently, Nagios released its latest version Nagios Core 4.4.9, and its latest stable release of Nagios plugins 2.3.3 on October 4, 2022.

This article is intended to guide you with easy instructions on how to install and configure the latest version of Nagios Core from source (tarball) on RHEL and RHEL-based distributions such as CentOS Stream, Rocky Linux, AlmaLinux, and Fedora.

Within 30 minutes you will be monitoring your local machine, no advanced installation procedure only basic installation that will work 100% on most of today’s Linux servers.

Please Note: The installation instructions shown here are written based on the RHEL 9.0 Linux distribution.

Installing Nagios Core and Nagios Plugin in Linux

If you follow these instructions correctly, you will end up with the following information.

  • Nagios and its plugins will be installed under the /usr/local/nagios directory.
  • Nagios will be configured to monitor a few services of your local machine (Disk Usage, CPU Load, Current Users, Total Processes, etc.)
  • Nagios web interface will be available at http://localhost/nagios

Step 1: Install Apache and PHP Packages

We need to install Apache, PHP, and some libraries like gcc, glibc, glibc-common, and GD libraries and their development libraries before installing Nagios with the source. And to do so, we can use the yum package installer.

# yum install -y httpd httpd-tools php gcc glibc glibc-common gd gd-devel make net-snmp
Install Apache and PHP
Install Apache and PHP

Step 2: Create Nagios User and Group

Create a new nagios user using the useradd command and nagcmd group account and set a password.

[root@tecmint]# useradd nagios
[root@tecmint]# groupadd nagcmd

Next, add both the nagios user and the apache user to the nagcmd group using the usermod command.

[root@tecmint]# usermod -G nagcmd nagios
[root@tecmint]# usermod -G nagcmd apache
Add Nagios User and Group
Add Nagios User and Group

Step 3: Download Nagios Core and Nagios Plugin

Create a directory for your Nagios installation and all its future downloads.

[root@tecmint]# mkdir /root/nagios
[root@tecmint]# cd /root/nagios

Now download the latest Nagios Core and Nagios Plugins packages with the wget command.

# wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.9.tar.gz
# wget https://nagios-plugins.org/download/nagios-plugins-2.3.3.tar.gz
Download Nagios Core and Nagios Plugins
Download Nagios Core and Nagios Plugins

Step 4: Extract Nagios Core and Nagios Plugins

We need to extract downloaded packages with the tar command as follows.

# tar -xf nagios-4.4.9.tar.gz
# tar -xf nagios-plugins-2.3.3.tar.gz

When you extract these tarballs, two new folders will appear in that directory.

# ls -l

total 13804
drwxrwxr-x 21 root root     4096 Nov 17 02:22 nagios-4.4.9
-rw-r--r--  1 root root 11339450 Nov 17 03:08 nagios-4.4.9.tar.gz
drwxr-xr-x 15 root root     4096 Mar 11  2020 nagios-plugins-2.3.3
-rw-r--r--  1 root root  2782610 Mar 11  2020 nagios-plugins-2.3.3.tar.gz

Step 5: Installing and Configuring Nagios Core

Now, first, we will configure Nagios Core and to do so we need to go to the Nagios directory and run configure file if everything goes fine, it will show the output in the end as sample output.

# cd nagios-4.4.9/
# ./configure --with-command-group=nagcmd
Configure Nagios Core
Configure Nagios Core
Configuration Summary for Nagios Core
Creating sample config files in sample-config/ ...


*** Configuration summary for nagios 4.4.9 2022-11-16 ***:

 General Options:
 -------------------------
        Nagios executable:  nagios
        Nagios user/group:  nagios,nagios
       Command user/group:  nagios,nagcmd
             Event Broker:  yes
        Install ${prefix}:  /usr/local/nagios
    Install ${includedir}:  /usr/local/nagios/include/nagios
                Lock file:  /run/nagios.lock
   Check the result directory:  /usr/local/nagios/var/spool/checkresults
           Init directory:  /lib/systemd/system
  Apache conf.d directory:  /etc/httpd/conf.d
             Mail program:  /usr/bin/mail
                  Host OS:  linux-gnu
          IOBroker Method:  epoll

 Web Interface Options:
 ------------------------
                 HTML URL:  http://localhost/nagios/
                  CGI URL:  http://localhost/nagios/cgi-bin/
 Traceroute (used by WAP):  


Review the options above for accuracy.  If they look okay,
type 'make all' to compile the main program and CGIs.

After configuring, we need to compile and install all the binaries with the make all and make install commands, it will install all the needed libraries in your machine and we can proceed further.

# make all
# make install
Nagios Compilation Summary
*** Main program, CGIs and HTML files installed ***

You can continue with installing Nagios as follows (type 'make'
without any arguments for a list of all possible options):

  make install-init
     - This installs the init script in /lib/systemd/system

  make install-commandmode
     - This installs and configures permissions on the
       directory for holding the external command file

  make install-config
     - This installs sample config files in /usr/local/nagios/etc

make[1]: Leaving directory '/root/nagios/nagios-4.4.9'

The following command will install the init scripts for Nagios.

# make install-init

To make Nagios work from the command line we need to install command-mode.

# make install-commandmode

Next, install sample Nagios files, please run the following command.

# make install-config
Nagios Configuration Files Installed
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc/objects
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/nagios.cfg /usr/local/nagios/etc/nagios.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/cgi.cfg /usr/local/nagios/etc/cgi.cfg
/usr/bin/install -c -b -m 660 -o nagios -g nagios sample-config/resource.cfg /usr/local/nagios/etc/resource.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/templates.cfg /usr/local/nagios/etc/objects/templates.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/commands.cfg /usr/local/nagios/etc/objects/commands.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/contacts.cfg /usr/local/nagios/etc/objects/contacts.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/timeperiods.cfg /usr/local/nagios/etc/objects/timeperiods.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/localhost.cfg /usr/local/nagios/etc/objects/localhost.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/windows.cfg /usr/local/nagios/etc/objects/windows.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/printer.cfg /usr/local/nagios/etc/objects/printer.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/switch.cfg /usr/local/nagios/etc/objects/switch.cfg

*** Config files installed ***

Remember, these are *SAMPLE* config files.  You'll need to read
the documentation for more information on how to actually define
services, hosts, etc. to fit your particular needs.

Step 6: Customizing Nagios Configuration

Open the “contacts.cfg” file with your choice of editor and set the email address associated with the nagiosadmin contact definition to receiving email alerts.

# vi /usr/local/nagios/etc/objects/contacts.cfg
Nagios Email Alerts
###############################################################################
#
# CONTACTS
#
###############################################################################

# Just one contact defined by default - the Nagios admin (that's you)
# This contact definition inherits a lot of default values from the
# 'generic-contact' template which is defined elsewhere.

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                   [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}

Step 7: Install and Configure the Web Interface for Nagios

We are done with all configurations in the backend, now we will configure the Web Interface For Nagios with the following command. The below command will Configure the Web interface for Nagios and a web admin user will be created “nagiosadmin”.

# make install-webconf
Configure Nagios Web
Configure Nagios Web

In this step, we will be creating a password for “nagiosadmin”. After executing this command, please provide a password twice and keep it remember because this password will be used when you login into the Nagios Web interface.

# htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin

Restart Apache to make the new settings take effect.

# systemctl restart httpd

Step 8: Compile and Install Nagios Plugin

go there and configure and install it as directed below.

# cd /root/nagios
# cd nagios-plugins-2.3.3
# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# make
# make install

Step 9: Verify Nagios Configuration Files

Now we are all done with the Nagios configuration and it’s time to verify it to do so please insert the following command. If everything goes smoothly it will show up similar to the below output.

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios Configuration Summary
Nagios Core 4.4.9
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2022-11-16
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
	Checked 8 services.
	Checked 1 hosts.
	Checked 1 host groups.
	Checked 0 service groups.
	Checked 1 contacts.
	Checked 1 contact groups.
	Checked 24 commands.
	Checked 5 time periods.
	Checked 0 host escalations.
	Checked 0 service escalations.
Checking for circular paths...
	Checked 1 hosts
	Checked 0 service dependencies
	Checked 0 host dependencies
	Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check

Step 10: Add Nagios Services to System Startup

To make Nagios work across reboots, we need to enable nagios and httpd at the system startup using the systemctl command.

# systemctl enable nagios
# systemctl enable httpd

Next, restart Nagios to make the new settings take effect.

# systemctl restart nagios

Step 11: Allow Nagios Web in Firewall

To access the Nagios web interface, you need to open the Apache ports by running the following commands:

# firewall-cmd --permanent --zone=public --add-service=http
# firewall-cmd --permanent --zone=public --add-service=https
# firewall-cmd --reload

Step 12: Log in to the Nagios Web Interface

Your Nagios is ready to work, please open it in your browser with “http://Your-server-IP-address/nagios” or “http://FQDN/nagios” and Provide the username “nagiosadmin” and password.

Nagios Web Dashboard
Nagios Dashboard
Nagios Dashboard
Host View
Nagios Host View
Nagios Host View
Nagios Overview
Nagios Overview
Nagios Overview
Services View
Nagios Host Services
Nagios Host Services
Process View
Nagios Process View
Nagios Process View

Congratulations! You’ve successfully installed and configured Nagios and its Plugins. You’ve just started your journey into monitoring.

Upgrading Nagios 3.x to Nagios Core 4.x

If you are already running an older version of Nagios, you can upgrade it anytime. To do so, you just need to download the latest nagios source tar archive and configure it as shown below.

# systemctl stop nagios
# wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.9.tar.gz
# tar -zxvf nagios-4.4.9.tar.gz
# cd nagios-4.4.9
# ./configure
# make all
# make install
# systemctl start nagios
Conclusion

That’s it for now, in my upcoming articles, I will show you how to add Linux, Windows, Printers, Switches, and Devices to Nagios monitoring Server.

If you’re having any trouble while installing, please do contact us via comments. Till then stay tuned and connected to Tecmint and don’t forget to Like and Share us to spread around.

Read Also:

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

418 Comments

Leave a Reply
  1. hi Ravi

    i just end to install nagios 4.0.8, and i don’t know the way to configure my first host! please can you help me to do that! i need to finish all this installation, it for my degree! sorry for my english, am a french-girl!
    tkx

    Reply
    • Dear Kyra,

      I’ve already included instructions on how to add first host to Nagios in this article, please follow the guide properly. Still any help you can contact me directly using our contact us page.

      Reply
  2. When I get to the compilatio and input “make all” I get this error: “make[1]: *** No rule to make target `../include/locations.h’, needed by ‘nagios.o’. Stop.” I have followed these instructions to the letter but I cannot go further. Please help.

    Reply
  3. i unable browse the nagios page

    Forbidden

    You don’t have permission to access /nagios/ on this server.
    Apache/2.2.15 (Red Hat) Server at localhost Port 80

    Reply
  4. Hi Ravi,

    Thank for share the articlel of nagios installation. I have installed the nagios 4.0.1 and configure the sendmail for receive the email alart. i am not using any firewall. I am getting the following error message:-

    notify-host-by-email;(No output on stdout) stderr:

    Thanks
    Jitender

    Reply
  5. Dear Ravi,

    I follow the same step by step after that nagios is open with the browser but when I try to access other features like..host, services showing the that error is below.

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.
    Apache/2.2.15 (CentOS) Server at 192.168.1.100 Port 80

    Reply
  6. HI Ravi,

    Excellent procedure. I installed on CentOS6.5, no issue found except firewall.

    your procedure is for Nagios 4.0.1 with Nagios Plugin 1.5. current version is nagios 4.0.8.
    Can I use the same procedure to install nagios 4.0.8 ?
    how about the Nagios Plugin?

    Kind regards.
    Sara

    Reply
    • Yes Sara, you can use same instructions for latest version too, only diffrent is, make sure you replace versions accordingly, while following. :)

      Reply
  7. Coaching people to install from source? In 2014, that’s what we call a ‘day two’ problem, and it can be seen as irresponsible.

    Even those who’ve been using EL for a while prefer a packaged install because builds are repeatable, reliable and verifiable. This makes updates trivial and, most of all, something you can automate.

    A config;make;make-install is something that ends up on the “I’ll do it tomorrow/saturday” list, where an RPM update is done via cron while you sleep, and the army of RH testors all but guarantees it’ll go smoothly.

    The difference in reliability alone is like comparing a concept car against a daily driver.

    Reply
    • Yes, there are lots of advantage installing from source, like you will configure required or selected moduels for Nagios, from source you can install latest version of Nagios, etc..

      Reply
  8. Excellent article thank you, I am a CentOS beginner and I am having a problem after following your well written instructions… I was wondering if you can help please?

    [root@nagios-cs libexec]# ./check_ping -H 8.8.8.8 -w 200,20% -c 600,60% -p4
    ping
    CRITICAL – Could not interpret output from ping command

    However, I can ping using:

    [root@nagios-cs libexec]# ping -n -U -w 10 -c 5 8.8.8.8
    PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
    64 bytes from 8.8.8.8: icmp_seq=1 ttl=50 time=11.6 ms
    64 bytes from 8.8.8.8: icmp_seq=2 ttl=50 time=11.5 ms

    The permissions look ok as far as I can tell:

    -rwsr-x— 1 root nagios 174K Aug 21 15:40 check_ping

    And SELinux is disabled.

    Any ideas would be most welcome.

    Kind regards

    Adam

    I am stuck

    Reply
    • Nagios user don’t have permission to execute ping command, to fix this issue use the following command and then try again.

      # chmod u+s /bin/ping 
      
      Reply
  9. Hi Dear , I have install Nagios, Nagios-pluging and nrpe with all lib, note also 127.0.0.1 is figured in nrpe conf,
    but i still receive error below:

    CHECK_NRPE: Error – Could not complete SSL handshake.

    would you advice pls?

    Reply
  10. I am getting the below error while downloading core nagios

    unable to resolve host address prdownloads.sourceforge.net

    Reply
  11. When i restart the nagious service i am getting this Error, will you plz sort it out….

    Job for nagios.service failed. See ‘systemctl status nagios.service’ and ‘journalctl -xn’ for details.

    Reply
  12. Hi,
    Thanks Ravi. Already de-bugged the issue as mentioned below.
    #vi /usr/local/nagios/etc/cgi.cfg
    # READ-ONLY USERS
    # A comma-delimited list of usernames that have read-only rights in
    # the CGIs. This will block any service or host commands normally shown
    # on the extinfo CGI pages. It will also block comments from being shown
    # to read-only users.
    authorized_for_read_only=node1,node2,node3
    By adding the above comments in the file, the issue got resolved.
    REPLY

    Reply
  13. Hi,

    Encountered the below message when trying to plan for system downtime through nagios portal

    “Sorry, but you are not authorized to commit the specified command”

    Any pre-configuration is required to do this.

    Reply
    • Is your nagios configuration files are writeable by Apache user? and also check all the files have correct web server owner and group.

      Reply
  14. Hi Sir,

    I Connect two host with my server & its showing all three is up but host does’nt show in services list, its show only server host & when i down to any client effect does’nt show on the gui pannel

    Reply
  15. nagaios has been installed and send mail also installed, i have checked in mail logs logs are there but its not coming out form the pc.

    i had mail my srv details pls check and support me sir

    Reply
  16. Thank you for sharing such an excellent and appropriate step by step doc.

    I really appreciate for the time you spent and your knowledge and understanding of the complete subject.

    Reply
    • Thanks Chandi, for such kind of words which encourage us to write more such in-depth articles for our fellow readers like you. And don’t forget to share our updates.

      Reply
  17. I installed Nagios following the procedure, seem fine as I’m able to lunch the server web address.

    the issue is when I click on host or any other part withing the web MOnitoring I get the following error.

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.
    Apache/2.2.15 (CentOS) Server at localhost Port 80

    this is what I get on he log:

    [Mon Jun 30 07:12:57 2014] [notice] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
    [Mon Jun 30 07:12:57 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
    [Mon Jun 30 07:12:57 2014] [notice] Digest: generating secret for digest authentication …
    [Mon Jun 30 07:12:57 2014] [notice] Digest: done
    [Mon Jun 30 07:12:57 2014] [warn] ./mod_dnssd.c: No services found to register
    [Mon Jun 30 07:12:57 2014] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 configured — resuming normal operations
    [Mon Jun 30 07:14:49 2014] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/
    [Mon Jun 30 07:19:49 2014] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/
    [Mon Jun 30 07:24:49 2014] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/
    [Mon Jun 30 07:29:49 2014] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/
    [Mon Jun 30 07:34:49 2014] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/
    [root@localhost html]# cd /var/www

    Reply
  18. sir

    i am trying install nagios but i am getting bellow error

    “[root@master nagios-plugins-2.0.3]# service nagios start

    Executable file /usr/local/nagios/bin/nagios not found. Exiting.

    [root@master nagios-plugins-2.0.3]#

    what is the problem sir?

    Reply
    • Your installation is unsuccessful, might you have missed to run ‘make install’ command. Follow instructions correctly, don’t miss any single command.

      Reply
  19. hi I ahve installed nagios4.0.1 on centos6.3, i can browse the site but whenever i am trying open any other link its not openning… trying to save status.cgi file
    whats the issue?

    Reply
    • It seems CGI was not properly installed or configured. Please check your httpd configuration and include correct nagios configuration.

      Reply
  20. Hi,

    I am faced with an issue as I cannot installed the nagios-plugin. I am using a RHEL3 which I am installing the latest nagios and its plugins. However when installing the plugins its giving me the error as follows

    check_pgsql.c:245: (Each undeclared identifier is reported only once
    check_pgsql.c:245: for each function it appears in.)
    make[2]: *** [check_pgsql.o] Error 1
    make[2]: Leaving directory `/root/nagios-plugins-2.0.2/plugins’
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/root/nagios-plugins-2.0.2′
    make: *** [all] Error 2

    Any help on this would be appreciated.

    Thank you
    Phing,

    Reply
    • You’re trying to install the latest Nagios version on too old RHEL distro, I think it will won’t work out for you, you must upgrade your system to latest version to install latest Nagios version.

      Reply
  21. i have installed nagios 4.0.1 in centos and it works fine…but when i try to create availability report it shows me following error…

    the gateway did not receive a timely response from the upstream server or application

    Please Help

    Regards

    Jyotiranjan

    Reply
  22. Hi, wonderful information in these posts. I have read through them and have not found anything about an issue I am seeing.

    I am installing V. 4.0.4 on CentOS 6.5 64 bit. I have a basic installation and many host item configured. They are successfully being tested with PINGs, but none of the services are working. I get a “Gateway Time-out” error when I attempt to enable services check on a host.

    Also when I go to the “Configuration” option in the left side menu on the Nagios home page and select the “Host” option from the pull down menu I get this error,

    “It appears as though you do not have permission to view the configuration information you requested…

    If you believe this is an error, check the HTTP server authentication requirements for accessing this CGI and check the authorization options in your CGI configuration file.”

    I have not seen anything on an error like this. Do you have any suggestions on a fix?

    Thanks

    Jeff

    Reply
  23. Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.
    Apache/2.2.15 (CentOS) Server at localhost Port 80

    i dont know what’s this ?
    help me plzz

    Reply
    • It means your Nagios installation was unsuccessful, please follow the instructions carefully and try again.

      Reply
  24. Hello Sir

    installation and configuration done. but mails are not going to recipient.

    Pls help on this issue .

    Thank you
    chandoo

    Reply
    • Please check the mail logs and find out the reason why its not being delivered to recipient. And also make sure you have correct MX, SPF records are added on your mail domain.

      Reply
  25. install php package and dependencies before so that you can avoid all the errors.

    if you are getting conflicting errors while installing php with yum disable multiple repositories and try.

    Reply
  26. Another example:

    sudo tail -50 /var/log/messages
    [sudo] password for nagios:
    nagios is not in the sudoers file. This incident will be reported.

    Reply
  27. Hi,

    I have few questions related to the post.

    1. Why you choose “/root ” to do the installation?
    2. Do I have to give any special permissions to nagios user because it cant do soem tasks for example if I want to restart nagios service I get below error:
    ****sudo service nagios restart
    [sudo] password for nagios:
    —- nagios is not in the sudoers file. This incident will be reported.***
    3. So do I have to provide user nagios some special permissions?

    I am asking this because somehow I think my nagios stopped working because I installed it in root/or I am not able to use use nagios..

    problem with Nagios – the web interface has stopped responding. It is not updating – no communication with nagios.

    Thanks
    Kim

    Reply
      • It is CentOS but now I have reinstalled it again using Nagios official installation guide,I am not sure if the problem was installaing it in root or something else but I just thought to ask you.

        Also, I am trying to setup notification in nagios so that I could get an email but I dont. DO I have to enable something special on CentOS as well. Like postfix? I have changed the name in Contacts.cfg and everything else seems to be fine.

        Any idea?

        Reply
        • Yes, you correct you need to install special mail services like postfix or sendmail to send out mails from the box.

          Reply
  28. Excuse the English, I’m using a translator. I installed everything right in my cpanel server, but it does not have access by ip / nagios. Know how to help?

    Reply
  29. Hi Sir Ravi

    In addition when I try to restart the httpd I got this start when httpd starting

    [root@TestLinux nagios-plugins-1.5]# service httpd restart
    Stopping httpd: [ OK ]
    Starting httpd: httpd: apr_sockaddr_info_get() failed for TestLinux
    httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName

    Thank you!
    James

    Reply
    • Although this warning message doesn’t interfere with your Apache starting, you can simply ignore it, or you can add your server hostname to /etc/hosts file to get rid of this error messsage.

      Reply
  30. Hi Sir I follow all the steps it seems I get all it correct but when I access the GUI I got the home page correct but when I go to services, host, tactical overview etc… I got this on my page please advise thank you!

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.
    Apache/2.2.15 (CentOS) Server at 10.10.1.202 Port 80

    Reply
  31. Hello ,
    Followed the tutorial but i can’t seem to make the notification work with postfix or sendmail . I have Centos 6.5 on my machine and just installed Nagios 4.0.5.

    Output from /var/log/messages

    ” wproc: stderr line 01: /bin/sh: -c: line 0: unexpected EOF while looking for matching “’
    wproc: stderr line 02: /bin/sh: -c: line 1: syntax error: unexpected end of file
    Output from contacts cfg:

    define command{
    command_name notify-host-by-email
    command_line /usr/bin/printf “%b” “***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n” | /bin/mail -s “** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **” $CONTACTEMAIL$
    }

    # ‘notify-host-by-email’ command definition
    define command{
    command_name notify-host-by-email
    command_line /usr/bin/printf “%b” “***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n” | /bin/mail -s “** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **” $CONTACTEMAIL$
    }
    Any ideea where to look?

    Reply
  32. while i try to add comment it gives error message

    Error: Could not stat() command file ‘/usr/local/nagios/var/rw/nagios.cmd’!

    Reply
    • Please set the correct permissions by running following commands.

      # chown nagios.nagcmd /usr/local/nagios/var/rw 
      # chmod g+rwx /usr/local/nagios/var/rw 
      # chmod g+s /usr/local/nagios/var/rw
      

      This should work properly without errors.

      Reply
      • Hello sir,

        I follow the steps but it gives same error.I think i have miss to create some file.i still cannot add comment.

        Reply
  33. which is suitable for mail generation postfix or sendmail in nagios

    nagios is default installtion postfix but why to install sendmail

    Reply
  34. Hey,

    got solution already. Command “sudo setenforce 0” resolved the problem.
    Thanks again for awesome article.

    Best Wishes
    Kim

    Reply
  35. Hello Sir,

    Great Article, everything worked perfectly. BUT when I click on host or on any other link I get error below error. Any idea?
    “””Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.”””

    Thanks
    Kim

    Reply
  36. hi
    i try to install i unable to install nagios. i downloaded two packages as above mentioned when i enter the below command i am getting this error plz reply me
    command : ./configure –with-command-group=nagcmd
    checking for a BSD-compatible install… /usr/bin/install -c
    checking build system type… i686-pc-linux-gnu
    checking host system type… i686-pc-linux-gnu
    checking for gcc… no
    checking for cc… no
    checking for cl.exe… no
    configure: error: in `/root/nagios/nagios-4.0.1′:
    configure: error: no acceptable C compiler found in $PATH
    See `config.log’ for more details

    Reply
      • hi
        finally i got it …the problem was not installed gcc and gcc-lib and dependency packages due to yum repository problem ,i fixed the that problem ,and i installed dependency packages .after it worked fine ….by the way thank you very mush replying ….thank u again

        Reply
  37. Hello Ravi,

    I have install nagios core 3.0 in my centos machine, ever thing installed properly with our error but once i am login nagios from web interface and accessing link host on left hand side getting error message Internal Server Problem.

    Please advice me the solution?

    Reply
  38. Hello ravi..

    I did all steps to install nagios and nagios plugin, but i installed the last versions, 4.0.4 and plugins 2.0.

    So when i tried to start the nagios on browser, cannot find the page.

    Reply
    • Is there any error you getting while accessing the page? If yes! please look at the comment section for solutions. I hope you will fix it.

      Reply
  39. hI Brother, thanks for your tutorial is very easy and clear. So i followed every single step in your example, and every was ok. I’m facing this error:

    http://myipaddres/nagios

    Not Found

    The requested URL /nagios-4.0.1/ was not found on this server.

    i’m running on Centos 6.5

    Please can you help me?

    Tanks for your time.

    Reply
  40. Hello, again please do not consider my previous reply, because i solved it.
    but now facing another with step number 10.
    I am unable to see webinterface using the ip address/nagios..
    please help me

    Reply
      • Hi Ravi,
        thanks for the support , but fortunetly i solved the problem by turning off the firewall, initially i tried to solve the problem by opening the http port 80 but was unable to due to some reason so i turned it off.
        but the NEW PROBLEM I am facing is when entering the webinterface -> credentials->Homepage->Clicking Host Group (from left Menu) gives me “It appears as though you do not have permission to view information for any of the hosts you requested…”..i have no idea where it went wrong..

        Reply
          • Dear Sir,

            I am also facing same issue.. But Some time I am able to get output and some time nagios show error ” It appears as though you do not have permission to view information for any of the services you requested…”

            My SELinux is also disabled.

  41. Hello ,
    i am stuck in doing 2nd wget (which is for plugins) it gives me error “unable to resolve host address”
    any idea?
    i am proxy server to go on internet but i already set it and its working .
    I using centos 6.5

    Reply
  42. Hi, i had also installed the nagios plugins from the tarball and installation goes fine without any error.

    But i cannot find the location as where those plugins installed.

    i had checked /usr/local/nagios but cannot found it.

    Please help

    Reply
  43. hai

    iam installing nagios on centos 6.4 i did not get any email alerts

    i am adding my mail address in commands and contacts.cfg file but i did not get any mails

    if there ant answer pls tell me

    Reply
  44. hello sir ,

    yea i got it that …and mail notifications are not coming ,, today i shut down the server due to maintenance.i was expecting the e-mail ..but there is no use ..

    i have configured the e mail id my personal ..please have a look

    ###############################################################################
    ###############################################################################
    #
    # CONTACTS
    #
    ###############################################################################
    ###############################################################################

    # Just one contact defined by default – the Nagios admin (that’s you)
    # This contact definition inherits a lot of default values from the ‘generic-contact’
    # template which is defined elsewhere.

    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 [email protected] ; *** CHANGE THIS TO YOUR EMAIL ADDRESS ****

    Reply
          • yes i have installed the sendmail, but there no luck ??

            i given test mail output is the same ..no erros but mails are not coming to inbox.

            mutt -s “Test Email” [email protected] < /dev/null
            @@@@@@@@@@@@@@@@@@@@@@@@@@@@
            and i have checked in nagios please find the below info

            Host Service Type Time Contact Notification Command Information
            localhost HTTP WARNING 03-24-2014 10:36:36 nagiosadmin notify-service-by-email HTTP WARNING: HTTP/1.1 403 Forbidden – 4807 bytes in 0.006 second response time
            localhost HTTP WARNING 03-24-2014 09:36:36 nagiosadmin notify-service-by-email HTTP WARNING: HTTP/1.1 403 Forbidden – 4807 bytes in 0.002 second response time
            localhost HTTP WARNING 03-24-2014 08:36:36 nagiosadmin notify-service-by-email HTTP WARNING: HTTP/1.1 403 Forbidden – 4807 bytes in 0.002 second response time

  45. Hello sir

    Greetings !!

    i have installed the nagios successfully as per you given steps ,, once i login to server ..its throwing the error message given by below.

    Please help me about this

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Apache/2.2.17 (Fedora) Server at 192.168.50.4 Port 80

    Reply
    • The error basically about SELinux context file execution issue, which can be fixed by setting the permission on nagios installtion core directories, like shown below.

      # chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
      # chcon -R -t httpd_sys_content_t /usr/local/nagios/share/
      
      Reply
  46. Hi i have installed the nagios as you given steps ..but finally when loged in its giving the Forbidden error ! please find the below .

    Forbidden

    You don’t have permission to access /nagios/ on this server.

    Apache/2.2.17 (Fedora) Server at 192.168.50.4 Port 80

    Reply
  47. I found the missing bit for the external commands.
    It was a sneaky thing of SELINUX.

    You need to add this 3rd SELINUX exceptions as well:

    chcon -R -t httpd_sys_script_rw_t /usr/local/nagios/var/rw

    Reply
  48. This is ackward. I can’t seem to get rid of :
    Error: Could not stat() command file ‘/usr/local/nagios/var/rw/nagios.cmd’!
    The external command file may be missing, Nagios may not be running, and/or Nagios may not be checking external commands.
    An error occurred while attempting to commit your command for processing.

    I doublechecked permission, and all of that. Worked my way to a dozen or so of troubleshooting pages referring to this issue but I can’t seem to find the cause and fix it.

    # ls -l rw
    prw-rw—-. 1 nagios nagcmd 0 Mar 5 17:11 nagios.cmd
    srw-rw—-. 1 nagios nagcmd 0 Mar 7 11:30 nagios.qh
    # ls -ld rw
    drwxrwsr-x. 2 nagios nagcmd 4096 Mar 7 11:30 rw
    # grep nagios /etc/group
    nagios:x:501:nagios,apache
    nagcmd:x:502:nagios,apache

    – httpd runs as user apache

    So at the moment I can’t think of anything more to check.

    Reply
  49. I am new to Linux. When I run “root@ubuntuServer:/root/nagios/nagios-4.0.1# make install-webconfig” I get this:

    /usr/bin/install -c -m 644 sample-config/httpd.conf .d/nagios.conf
    /usr/bin/install: cannot create regular file ‘/etc/httpd/conf .d/nagios.conf’ : No such file or directory
    make: *** [install-webconf] Error 1

    Reply
  50. Hi,

    Can anyone tell me the procedure to install mysql plugin in nagios-plugin-1.5 so that i can monitor mysql services.

    Thanks in advance..!!!!

    Reply
  51. I got this error, Please give a solution

    Not Found

    The requested URL /nagios/ was not found on this server.
    Apache/2.2.15 (CentOS) Server at 23.226.70.8 Port 80

    Reply
  52. Hie Ravi

    I configured my nagios long time ago and now i do not remember where i configured notifications to come from my gmail account, i have tried in contacts.cfg but i only see the destination mail box please help

    Reply
  53. i was install nagios in linux el6 64 bit. nagios is working fine. after opening in browser when i click on left panel it ask me to save status.cgi file always. for eg: when i click hosts or maps or services anything in left panel its not opening other than that it ask to save status.cgi file. Thanks in Advance :)

    Reply
  54. Hi, except Nagios, I search that Pandora FMS is also a good monitor tool but I’m not know well how to configuration it. Could you write a topic for Pandora :D Thanks.

    Reply
  55. Hi all,

    I have completed installing nagios 4.0.1 but i faced a problem “(No output on stdout) stderr: ” in status information. How to fix the issue, thank.

    Reply
  56. Thanks a lot for that tutorial, all have worked fine at once, clear explanation and examples.
    Awesome job!

    Best wishes to you and thanks again!

    Reply
  57. thanks
    Ravi
    now its working and this is really helpful link for linux and the most important thing is you replay to the peoples questions that is really best thing about you

    again thanks alot

    Reply
  58. hallo ravi,
    can you please help me out . i am having really a little problem,
    your explanations is so great and the way how you explain the thing is owesome,
    may be i have missed something while configuration.
    when i want to get nagios in web browwser then it shows that web is not availble.
    can you please help me out for this problem
    thanks

    Reply
      • “Error: Connection interrupted

        The connection to the server was reset while the page was loading.

        The site could be temporarily unavailable, please try again later.
        If you can not access any other website, please check your computer’s network connection.
        If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Internet.”

        hallo ravi ,
        i am getting this error.
        when i was doing the configuration. i never get any error but i can’t access it via web browwser.

        Reply
      • apacche is running in the linux machine and status of httpd is ok .

        but when we try to access via IP of server then it doesn’T load and say web page is not availbale.

        Reply
          • Pretty disappointing. This guide seems to be pretty comprehensive, but it is lacking some fundamental things.

            I went through it EXACTLY and had no error messages, no problems, nothing. Both nagios and httpd started up perfectly.
            (Okay, I installed nagios-4.0.6 and plugins-2.0.2, otherwise the same)

            No connection to httpd on tcp/80, unable to connect.
            I opened the port, and then disabled iptables. No changes, still cannot access.

            I’ve been through all the comments, looked into problems with SELinux, permissions in /var/www/html and other possible causes. Nothing helped.

            I have gotten nothing but disappointment from TECMINT overall. This is the third or fourth howto I’ve looked at here, the first one I actually tried, and I have found varying flaws in all of them that are pretty obvious. You consistently fail to mention basic, fundamental things that a new user should at least be aware of. You don’t warn when some things might be a big problem.

            I appreciate this may be a volunteer effort for may of you, but bad information is still bad information. I won’t be coming back.

  59. hallo ravi ,

    after configure all the step , when i try to get it in web server then it doesn’t work ,
    it say that web page is not availbale.

    Reply
  60. Hi ,

    Nice Guide for the new users who wants to learn Nagios.

    But i want to know why there is a need of “nagcmd group” cant we use the default “nagios” group which will be automatically created while creating the “nagios” user.

    Regards
    Abyakta

    Reply
  61. Hi Mr. Ravi Saive,

    I installed nagios version 4.0 on fedora 19
    when i check the status:
    systemctl status nagios.service

    i get the error:

    Loaded: loaded (/etc/rc.d/init.d/nagios)
    Active: failed (Result:timeout) since Mon 2013-11-18 19:04:22 Est; 44s ago
    Process: 2104 ExecStart=/etc/rc.d/init.d/nagios start (code=exited, status=0/SUCCESS)
    CGroup: name=systemd:/system/nagios.service

    Then i get:
    [1]: Starting LSB: start and stop Nagios monitoring server…
    Failed to start LSB: start and stop Nagios monitoring server.
    Unit nagios.service entered failed state

    although i am able to use the service i can login to nagios and see my local host and my other lamp servers and i can see the services ssh, ping, etc… but i can’t get any email notifications ( is that the reason why by the way)
    can you please help me fix this error thank

    i tried reinstalling nagios, restarting nagios, restarting httpd,

    tried the steps from this page:
    http://nagios.sourceforge.net/docs/3_0/startstop.html

    please help thanks,

    Reply
  62. I am new to this, But I did as here mentioned……. I am able to log in but it showing – But when i click on any option mentioned there it shows internal server error

    Reply
  63. Hello Sir,

    I want to monitoring Cisco sg300 switch by nagios, check switch load, traffic, and load. i have try to configure snmp but i was not success. so please help me for this..

    Thanks
    Rahul Patadiya

    Reply
    • Most likely the error occurs due to missing SNMP packages. Make sure you have the following packages installed on your system, if not install them.

      # yum net-snmp-libs net-snmp net-snmp-utils
      

      Lastly, you need to re-compile the Nagios Plugins. Go to the nagios plugin directory and run the following commands.

      [root@tecmint nagios]# cd /root/nagios
      [root@tecmint nagios]# cd nagios-plugins-1.5
      [root@tecmint nagios]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
      [root@tecmint nagios]# make
      [root@tecmint nagios]# make install
      

      After installing, make sure to restart nagios.

      # service nagios start
      

      rpm -qa | grep net-snmp

      Reply
      • ThnX, It started working after installing above packages.

        But nagios will not start in enforcing mode, to start it run this commands:

        chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/

        chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

        Now my nagios os is working smoothly and i am waiting for next article of this series :)

        Reply
  64. Now how to add the client machine to monitor from the nagios server. Please give complete article on how to install and configure nagios server and client for monitoring and the mail alerts as well

    Reply
    • The second part of this article on how to add Linux Hosts to Nagios server in progress, will soon publish it. Stay tuned for that. Thanks

      Reply
      • Hi Ravi,

        Would like to know about the communication between nagios server and nagios clients, how it works step by step.

        Reg,
        Mastan

        Reply
      • Hi Ravi,

        I have configured Nagios server and I could monitor remote machines as well using the information given below. I would like to setup email notification. Could you please help me out in this. One of my friend has configured email setup using sendEmail and it’s working fine. I was unable to setup. Can you please help me out in this.

        Regards,
        Rashmi

        Reply
      • I have installed Nagios Core 4.0.1 and works fine… thanks for your help..

        But when i want to create availability report it shows me the following error..

        the gateway did not receive a timely response from the upstream server or application

        please help

        Reply
      • Thank you for this great article! I managed to install it well . I work simultaneously on high availability, except that I do not know the command to allow nagios to spend at the cluster level. I am running cluster, but I can not bring out Nagios

        Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.