Comments on How to Install Nagios Server Monitoring on Ubuntu 16.04

Nagios is an open source software for system and network monitoring. Nagios can monitor the activity of a host and its services, and provides a warning/alert if something bad happens on the server. Nagios can run on Linux operating systems. At this time I will use Ubuntu 16.04 for the installation.

37 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Alberto

Buenos días, he intentado configurar nagios en ubuntu 16.04 y no consigo que me muestre nada bien.. a ver si me puedes ayudar.

Gracias.

Te adjunto capturas de pantalla..

By: Vagner

When I'm running the following command, on Step 3 - Start Apache and Nagios, in the section Configuring Apache:

service nagios start, it returns:

Failed to start nagios.service: Unit nagios.service not found.

By: Tim

2 things:

Couldn't start nagios as a service. I didn't have a skeleton file./etc/init.d/nagios startworks.

I had to addln -s /usr/local/nagios/share /var/www/html/nagiosin order to surf to it.

By: johannes patti

same issue what did you change??

By: Tony

Thanks for this guide.

I think your configuration for monitoring the remote host is wrong though.

Under step 5, you talk about configuring the remote host with this config file

vim /usr/local/nagios/etc/servers/ubuntu_host.cfg

However, all the check commands in your example are 'local' ones, meaning they are going to be checking the fog server rather than the client.

From my understanding, in most cases removing the word 'local' from the various check_commands should fix this, for example check_local_disk!20%!10%!/ becomes check_disk!20%!10%!/

By: Douglas7861

Hi Tony, i have problems to configure the remote host, can u help me?

By: Karl

I have used Nagios for years, I always look for an install guide for setup as I don't add enough setups to commit it to memory. At least I thought so, this is so clearly and concisely laid out that I will likely remember how. Great tutorial, thank you for writing it.

By: Michael Micthell

before doing a make all for Nagios, make sure unzip is installed. Error 127 occurs for angular-1.3.9.

sudo apt-get install unzip

By: DarthKegRaider

Hey buddy, great tutorial!

I found a typo in your script however.  Just before the "Testing nagios server" you have:chmod +x /etc/init.d/nagiosservice apache2 restartservuce nagios start^^  Service ..  I was copy / pasting and Ubuntu chucked a wobbly at me :)  Anyway, I'll keep poking down the page, thanks!

By: DarthKegRaider

Sorry to pester again,

But I was unable to get the Daemon running, and the "service nagios restart" issued an error.  I googled around first, like a good little nerd, and came back with a solution to make it work.  Can you add this to your page of awesome please!?  I found it at this site.("http://serverfault.com/questions/774498/failed-to-start-nagios-service-unit-nagios-service-failed-to-load-no-such-file")

sudo vi /etc/systemd/system/nagios.service

and added the following to the file:

[Unit] Description=Nagios BindTo=network.target [Install] WantedBy=multi-user.target [Service] User=nagios Group=nagios Type=simple ExecStart=/usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg

Save, then type the following:

 

sudo systemctl enable /etc/systemd/system/nagios.service sudo systemctl start nagios sudo systemctl restart nagios

By: Carles

Great tutorial,

You need to add snmp package for Nagios Plugins to avoid

(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_snmp, ...) failed. errno is 2: No such file or directory

sudo apt-get install snmp snmp-mibs-downloadersudo download-mibssudo service nagios restart

 

By: Dirk

I think you need to add libssl-dev to your prerequisites. Without it, you can compile the plugins, but you'll see "--with-openssl: no" and the options requiring SSL will not work.

By: Srikant

thank you very much...it worked fine for me

can u post steps for monitoring mysql server on host

By: ricardo

Hello, 

could you explain me, how i can add a plugging and executed or add to command_check.

By: Deepak1501

Thank you for a great tutorial. Only thing is the service Nagios did not start. /etc/init.d/nagios start does work. Everything else is perfect

By: sebastian

Thank you very much for this great and good working tutorial. I found the following issues and it's solution. Maybe you can add them to this tutorial.

1) on Step 3 - Install the Nagios Plugins the last command is missing an "s" on "cd nagios-plugins-2.1.2/"

2) on configuring apache on executing "service nagios start" I get the error message "Failed to start nagios.service: Unit nagios.service not found.". The solution is described here : http://serverfault.com/questions/774498/failed-to-start-nagios-service-unit-nagios-service-failed-to-load-no-such-file

By: LHammonds

According to the Nagios Install Manual, you need to run the command "update-rc.d nagios defaults" to make the service work properly on Ubuntu.  Do it right after these steps which were also documented in the manual:

cp /etc/init.d/skeleton /etc/init.d/nagiosvi /etc/init.d/nagios (add the following lines)DESC="Nagios"NAME=nagiosDAEMON=/usr/local/nagios/bin/$NAMEDAEMON_ARGS="-d /etc/nagios/nagios.cfg"PIDFILE=/usr/local/nagios/var/$NAME.lock

By: thomas

Thanks a lot

By: Amer

Great tutorial.

To avoid an error on restarting nagios service, please add a line under Configuring Apache.

chmod +x /etc/init.d/nagiosservice apache2 restart

systemctl daemon-reloadservice nagios start

By: Bill Ward

awesome post!  got my nagios server up and running quick.  Thanks for posting this

By: Justin

Hi,

 

While this guide was about 90% helpful, I came across the error that nagios.service wasn't found.  I found another post on google that helps with that problem.  

 

https://serverfault.com/questions/774498/failed-to-start-nagios-service-unit-nagios-service-failed-to-load-no-such-file

 

Doing the extra steps in the answer on that page allowed me to get Nagios up and running.

By: Ruben

Thanks for this article, it's very usefull!

 

I have some suggestions for this manual:

* In line 'cd nagios-plugin-2.1.2/' the real value in my computer was 'cd nagios-plugins-2.1.2/'

* When you said 'When Nagios starts, you may see the following error :' I had this error instead:

'Failed to start nagios.service: Unit nagios.service not found.', I fixed it with this:

  https://serverfault.com/questions/774498/failed-to-start-nagios-service-unit-nagios-service-failed-to-load-no-such-file

* Last one is a mistake in line 'servuce nagios start', obviously it's 'service'

 

Regards.

By: gagan

Thanks, very helpfull.

By: Timothy Tucker

The "Creating an Ubuntu Host" section doesn't actually monitor the disks, users, or procs of the remote system. All your config does is create another host definition, ping it, then Very misleadingly monitors its own disk, users, and procs but labels them as the properties of the remote server.

 

check_local_disk, check_local_procs, check_local_users

By: Henry A. Castro

Great Tutorial.   I had my nagios online within an hour or so following the tutorial.   only issue I had was the nagios service would not restart and I ended up using the comments to figure out resolution to the error.   

By: shashi kant

Thanks a lot friend . i have successfully installed nagios through this guide.

Need one changes in serction " 

Configuring Apache Step 3 - Start Apache and Nagios

Add below comment:-

sudo vi /etc/systemd/system/nagios.service

 

[Unit]

Description=Nagios

BindTo=network.target

 

 

[Install]

WantedBy=multi-user.target

 

[Service]

User=nagios

Group=nagios

Type=simple

 

ExecStart=/usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg

 or follow below link:-

http://serverfault.com/questions/774498/failed-to-start-nagios-service-unit-nagios-service-failed-to-load-no-such-file

 

By: shashi kant

HI Team,

 

Thanks for guidence, its working fine. now i want to monitor Linux and windows host from Ubuntu-Nagios server. 

So please help me.

 

By: Culip

This tutorial works. Now I can see the Nagois Web UI on my browser. I am using Ubuntu 16.04.4 native, standalone. 

"Installing Nagois: Step 4" and "Configuring Apache: Step 1 & 2", which don't present in Nagois' official installation guide, seem to be a key. Thanks!!

By: ravi

u r awesome 

By: Thevarx

#!/bin/shapt updateapt-get install wget build-essential apache2 php apache2 php apache2-mod-php7.0 php-gd libgd-dev sendmail unzipuseradd nagiosgroupadd nagcmdusermod -a -G nagcmd nagiosusermod -a -G nagios, nagcmd www-datacd ~wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.2.0.tar.gztar -zxvf nagios-4.2.0.tar.gzcd nagios-4.2.0./configure --with-nagios-group=nagios --with-command-group=nagcmdmake allmake installmake install-commandmodemake install-initmake install-config/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/site-available/nagios.confcp -R contrib//eventhandlers/ /usr/local/nagios/libexewchown -R nagios:nagios /usr/local/nagios/libexec/eventhandlerscd ~wget https://nagios-plugins.org/download/nagios-plugins-2.1.2.tar.gztar -zxvf nagios-plugins-2.1.2.tar.gzcd nagios-plugins-2.1.2./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-opensslmakemake install

By: Cosmin

Everything worked . Great tutorial :)

By: jackson

Bind to port 5666 on 192.168.2.28 failed: Cannot assign requested address

 

By: Cody

step three should be:

cd nagios-plugins-2.1.2/There is an s that needs to be added onto plugin(s)

By: Henry

I have a problem running the apache service it say`s (unit nagios.service not found) I wish someone can help me thanks!

By: Pink

Thanks so much!

By: Beginner to be per

i cant created a symbolic link in sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/ could u help ?

By: redd9

Thank you, worked great!