November 18, 2013 · Monitoring, Server · Email This Post

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

Solution

wget https://raw.github.com/nicolargo/nagiosautoinstall/master/hack4nagiosstart.sh

chmod a+x ./hack4nagiosstart.sh

./hack4nagiosstart.sh

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

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:

http:///nagios

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

Sponsored Link

Incoming search terms:

Related posts

25 Comments to “How to install Nagios 4.0.1 (Monitoring Tool) in ubuntu 13.10 server (Saucy Salamander)”

  1. Fbreda says:

    Hi.

    I’m having trouble installing in the apache2.

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

    [Reply]

  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

    [Reply]

  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”

    [Reply]

    jock Reply:

    Try libgd2-xpm-dev

    [Reply]

  4. 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 ./hack4nagiosstart.sh
    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.
    Thanks

    [Reply]

    Chris S Reply:

    Hi Frank.

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

    Regards
    Chris

    [Reply]

  5. 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

    [Reply]

  6. Brian says:

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

    [Reply]

  7. 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

    [Reply]

    Bryan Reply:

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

    sudo a2enmod cgi
    sudo service apache2 restart

    [Reply]

  8. 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.

    [Reply]

    bemano Reply:

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

    [Reply]

  9. Matt says:

    Hi,

    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?

    [Reply]

  10. 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

    [Reply]

  11. 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

    [Reply]

  12. 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”)

    [Reply]

  13. 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.

    [Reply]

    babasselegrand Reply:

    i have the same probleme.

    PLZ HELP !!

    [Reply]

  14. Pier Gagné says:

    same error for me

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

    [Reply]

  15. Pier Gagné says:

    when i run ./hack4nagiosstart.sh
    i have the error

    [Reply]

  16. ruchi says:

    which version of ubuntu you are using

    [Reply]

  17. Julio says:

    I’ve got same issue after run ./hack4nagiosstart.sh:

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

    using Ubuntu 13.10 amd64. Nagios 4.0.3.

    [Reply]

  18. Rafael says:

    I’ve got same issue:

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

    I’m using Ubuntu 13.10 AMD64 Server.

    [Reply]

  19. jepe says:

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

    “server not found”

    [Reply]

  20. 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=/
    done.

    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

    [Reply]

Leave a Reply