How to install Nagios 4.0.1 (Monitoring Tool) in ubuntu 13.10 server (Saucy Salamander)

Sponsored Link
Nagios® Core™ is an Open Source system and network monitoring application. It watches hosts and services that you specify, alerting you when things go bad and when they get better.Nagios Core was originally designed to run under Linux, although it should work under most other unices as well.

Some of the many features of Nagios Core include:

Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.)
Monitoring of host resources (processor load, disk usage, etc.)
Simple plugin design that allows users to easily develop their own service checks
Parallelized service checks
Ability to define network host hierarchy using "parent" hosts, allowing detection of and distinction between hosts that are down and those that are unreachable
Contact notifications when service or host problems occur and get resolved (via email, pager, or user-defined method)
Ability to define event handlers to be run during service or host events for proactive problem resolution
Automatic log file rotation
Support for implementing redundant monitoring hosts
Optional web interface for viewing current network status, notification and problem history, log file, etc.

Preparing your system

We have already discussed how to install ubuntu 13.10 LAMP server and now you need to install the following extra packages

sudo apt-get install wget build-essential php5-gd wget libgd2-xpm libgd2-xpm-dev libapache2-mod-php5 apache2-utils daemon

Now you need to download nagios core and plugins from here

Adding the Nagios User and Group

Next add the appropriate user and group for the Nagios process to run

sudo useradd nagios

sudo groupadd nagcmd

sudo usermod -a -G nagcmd nagios

Now you need to install nagios core installation

You need to login as root and run the following commands

Extract the downloaded files (Nagios core and Plugins)

tar zxvf nagios-4.0.1.tar.gz

tar zxvf nagios-plugins-1.5.tar.gz

Change to the new Nagios directory and install the packages

cd nagios-4.0.1/

./configure --with-nagios-group=nagios --with-command-group=nagcmd -–with-mail=/usr/bin/sendmail

make all

make install

make install-init

make install-config

make install-commandmode

When you run the following command

make install-webconf

You might see the following error

/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/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

As per the error message it's clear that nagios is trying to create the nagios.conf file inside the /etc/httpd.conf file to fix the problem try the following

mkdir /etc/httpd

mkdir /etc/httpd/conf.d

mkdir /etc/httpd/conf.d/nagios.conf

and Finally run the following command

sudo make install-webconf

You should see similar to the following output

/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf

*** Nagios/Apache conf file installed ***

Now following the next steps for nagions installation

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

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

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

/etc/init.d/nagios start

When i try to start nagios i got the following error

root@ubuntu:/# /etc/init.d/nagios start

/etc/init.d/nagios: 20: .: Can't open /etc/rc.d/init.d/functions

To fix the above error try the following commands to fix the problem try the following solution



chmod a+x ./


Now your nagios should start without any problem

Create a Default User for Web Access.

Add a default user for Web Interface Access:

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

Nagios Plugin installation

cd nagios-plugins-1.5

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


make install

Nagios Service Setup

ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

Login Nagios Web Interface

After correctly following the procedures you should now be able to access your Nagios Core installation from a web browser.
Simply use the following:


And log in with the credentials you chose when adding the nagiosadmin user to the htpasswd.users file

Sponsored Link

You may also like...

33 Responses

  1. Fbreda says:


    I’m having trouble installing in the apache2.

    when I type “http://my ip/nagios” appears the login screen, however, presents an error log.

  2. Rusu Catalin says:

    root@NagiOS:/usr/local/etc/nagios-4.0.1# ./configure –with-nagios-group=nagios –with-command-group=nagcmd -–with-mail=/usr/bin/sendmail
    configure: error: unrecognized option: `-–with-mail=/usr/bin/sendmail’
    Try `./configure –help’ for more information

  3. Admin says:

    Followed these instructions to the T. Installed a brand new fresh copy of Ubuntu 13.10 Server and after running “sudo apt-get install wget build-essential php5-gd wget libgd2-xpm libgd2-xpm-dev libapache2-mod-php5 apache2-utils daemon” i get “unable to locate package libgd2-xpm”

  4. jock says:

    Try libgd2-xpm-dev

  5. Frank V says:

    When trying to run the hack script get the following error message.

    nagios@nagios-virtual-machine:~/Downloads/nagios-4.0.2$ sudo ./
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    daemon is already the newest version.
    0 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.
    sed: -e expression #1, char 73: Invalid content of \{\}
    * is not running
    /etc/init.d/nagios: 51: /etc/init.d/nagios: /usr/usr/usr/sbin/service: not found

    Fresh install of Ubuntu 13.04 and Nagios 4.0.2 Don’t know if theres a difference between 4.0.1 and 4.0.2 or not.

  6. Chris S says:

    Hi Frank.

    Did you find a solution to your problem? I’m experiencing the same issue.


  7. aleks says:

    I`m used
    ./configure –with-command-group=nagcmd –with-httpd-conf=/etc/apache2/conf-enabled

    to avoid “make install-webconf” error on apache2:
    /usr/bin/install: cannot create regular file /etc/httpd/conf.d/nagios.conf: No such file or directory

  8. Brian says:

    Thanks a ton for the tutorial. I was struggling with the Nagios Start until I found the Worked great and saved me from rewriting the /etc/init.d/nagios. Thanks!!

  9. Bryan says:

    Hi all,
    Thanks for the amazing guide.
    I can manage to install nagios successfully as per the guide.
    Everything smooth but except that whenever I click on the links in the nagios page, the cgi files are being downloaded.
    How can I configure/fix this?
    Sorry, I’m newbie to linux

    Thanks in advance

  10. Bryan says:

    I managed to solve it.
    Forgot to enable the cgi.

    sudo a2enmod cgi
    sudo service apache2 restart

  11. Isaac says:

    Hi all,
    Thanks for the amazing guide.
    After following the tutorial, when trying to access the nagios page, it does not load the main page of login.
    However, the apache server is running.
    No I’ve done wrong.
    Thanks in advance.

  12. bemano says:

    I have the same problem. Did you find the reason?

  13. Matt says:


    Could you try the following commands:

    cp /etc/httpd/conf.d/nagios.conf/httpd.conf /etc/apache2/conf-available/nagios.conf

    ln -s /etc/apache2/conf-available/nagios.conf /etc/apache2/conf-enabled/nagios.conf

    Then restart Apache and see if that resolves your issue?

  14. derdoktor667 says:

    …modified your command slightly to get it running:

    cp /etc/httpd/conf.d/nagios.conf /etc/apache2/conf-available/

    ln -s /etc/apache2/conf-available/nagios.conf /etc/apache2/conf-enabled/nagios.conf

    service apache2 restart

    best regards

  15. chris says:

    Very nice! Thank you so much! Installed Nagios 4.0.2 on fresh Ubuntu 13.10 without any Problems!
    only one step more after Nagios Service Setup was needed:

    Service apache2 restart

  16. Marcas Green says:

    I get the following error trying to start nagios

    /etc/init.d/nagios: 100: /etc/init.d/nagios: Syntax error: “}” unexpected (expecting “fi”)

  17. karmukis says:

    I have the same issue when I try to start Nagios:

    ~$ sudo /etc/init.d/nagios start
    /etc/init.d/nagios: 102: /etc/init.d/nagios: Syntax error: “}” unexpected (expecting “fi”)

    can you help me?
    Thank you so much.

  18. babasselegrand says:

    i have the same probleme.

    PLZ HELP !!

  19. Pier Gagné says:

    same error for me

    etc/init.d/nagios: Syntax error: “}” unexpected (expecting “fi”)

  20. Pier Gagné says:

    when i run ./
    i have the error

  21. ruchi says:

    which version of ubuntu you are using

  22. Julio says:

    I’ve got same issue after run ./

    etc/init.d/nagios: Syntax error: “}” unexpected (expecting “fi”)

    using Ubuntu 13.10 amd64. Nagios 4.0.3.

  23. Rafael says:

    I’ve got same issue:

    etc/init.d/nagios: Syntax error: “}” unexpected (expecting “fi”)

    I’m using Ubuntu 13.10 AMD64 Server.

  24. jepe says:

    I cannot open website for http://localhost/nagios

    “server not found”

  25. swetha says:

    I have followed all the above steps..

    root@swetha-virtual-machine:/home/swetha/Downloads/nagios-4.0.4# /etc/init.d/nagios start
    Starting nagios:No directory, logging in with HOME=/

    nagios console is not visible.Got the below error:

    The requested URL /nagios/ was not found on this server.
    Apache/2.2.22 (Ubuntu) Server at localhost Port 80

  26. awillis says:

    was anybody able to figure out the solution to this problem?

  27. Johan says:

    this is a problem with both files:

    firts execute;


    when the error print:

    etc/init.d/nagios: Syntax error: “}” unexpected (expecting “fi”)

    you edit this file /etc/init.d/nagios en line

    where apear this: “if [ ] ; then kill -9 ;
    fi$daemonpid ”

    replace fi$daemonpid to fi ; $daemonpid

    next save file and execute

    sudo service nagios start
    sudo service nagios stop

    and not execute again /
    this file is corrupted in the end line

    next continue the installation in this webpage

  28. w0p says:

    Had the same problem (Ubuntu 14.04)
    You just need to

    sudo ln -s /etc/httpd/conf.d/nagios.conf /etc/apache2/sites-enabled/000-nagios.conf


    sudo service apache2 restart

    It should be available on your http://host/nagios then.

  29. w0p says:

    I had the same issue on Ubuntu 14.04.

    All i needed to do was:

    sudo ln -s /etc/httpd/conf.d/nagios.conf /etc/apache2/sites-enabled/000-nagios.conf
    sudo a2enmod cgi
    sudo service apache2 restart

  30. mutungi joel says:

    Thanks for the help. I was stuck at the “make install -webconf part but you bailed me out. I thank God for your timely help.

Leave a Reply

Your email address will not be published.