Nagios Core serves as the basic event scheduler, event processor, and alert manager for elements that are monitored. It features several APIs that are used to extend its capabilities to perform additional tasks, is implemented as a daemon written in C for performance reasons, & is designed to run natively on Linux/*nix systems.

More information about nagios core and how it works can be found here. I will focus on setting in since if I you are reading this, you are probably know what it is, but have problems with setting in up and running. So here it is.

  1. Installing required packages
  2. Getting nagios-core installation files
  3. Necessary configuration
  4. Running install script
  5. After install tasks
  6. Enabling LDAP
  7. Finish!

Latest versions of nagios and plugins cane be found here:
nagios core:
nagios plugins:

1. Installing required packages

SSH to server, then su to root in order to avoid typing sudo all the time.


Like always on Debian, start with updating and upgrading package repositories:

Now, install required packages:

Next thing I often do is allowing specific user to act as root and to sudo without a password. I know it isn’t the most elegant way, but for installing and later, editing files with for example WinSCP – is quite comfortable. Later you can always revert the changes. Just add following line into: /etc/sudoers

After all, reboot system (yes, I know, after Windows habits;))
Now, lets continue with installing rest of required packages (apache, php etc.):

Keep in mind to save somewhere passwords for apache etc…

2. Getting nagios-core installation files

Now, pwd to temporary directory and download nagios-core files:

3. Necessary configuration

After downloading we need to add some users and groups:

exctract archives and cd into nagios folder:

4. Running install script

Time to run some install scripts:

Now, we need to copy some defaults in order to actually start nagios:

Now, add and allow nagios user to login to nagios:

Ok, now we DO NOT HAVE a running nagios core instance:)
We have managed to install it but we are still a few steps before actually running it.Let’s proceed to:

5. After install tasks

Copy event handlers to nagios directory

go up one folder, back to /tmp:

Now, download,untar and cd to nagios plugins directory:

and run install script:

Now, set permissions:

And check nagios config:

Output of above command should be as follows:

If something is wrong, check and correct errors

Now, enable apache modules and make sure nagios is started on each reboot:

Now we need to change a few lines in nagios.conf as we copied default config which includes environmental variable which we do not have. This “normal” behaviour but will not allow to start nagios deamon. Error you will get looks something like:

In order to correct this we need to change paths in nagios.conf from variables to absolute strings. Nano file /etc/apache2/sites-enabled/nagios.conf, and change:

[table id=2 /]

Ok, restart apache or even the whole server. After reboot you can check apache and nagios status

You should get output like (apache2):

and for nagios:

At this point nagios is working! You can login to the console by specifying login nagiosadmin and password for this account.

In the next part I will cover LDAP configuration and basic host and services creation/adding, so stay tuned![/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]