How To Install and Configure Nagios in Debian

Linux System Administrator

Nagios server is a monitoring solution for complex IT infrastructures, Nagios server is easy to implement and can be extended by custom-modules, called plugins. In this tutorial we explain how to install Nagios on a DebianOS host and make the configuration for it.

Installing Package

root@atik:~# apt-get install nagios3

Nagios Server

Confirmation password for user “nagiosadmin”

Nagios Server

Adding Host Template

root@atik:~# cd /etc/nagios3/conf.d/
root@atik:/etc/nagios3/conf.d# cp generic-host_nagios2.cfg linux-server.cfg

Edit linux-server.cfg below

root@atik:/etc/nagios3/conf.d# vim linux-server.cfg

define host{
name linux-server
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
failure_prediction_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
check_command example-host-check ; the script to be used while checkingcheck_interval 3 ; the interval between consecutive checksmax_check_attempts 3 ; number of rechecking before generating email alertsnotification_interval 0
notification_period 24×7
notification_options d,u,r
contact_groups admins ; the group where emails will be sentregister 0

Adding Host below

root@atik:/etc/nagios3/conf.d# cp localhost_nagios2.cfg example.cfg
root@atik:/etc/nagios3/conf.d# vim example.cfg

# Host 1
define host{
use linux-server ; Name of host template to use
host_name our-server ; The hostname to be used by nagios
alias our-server
address ; The IP address of the host

Host Group Definition

root@atik:/etc/nagios3/conf.d# vim hostgroups_nagios2.cfg

definehostgroup {
hostgroup_name linux-server ; the name of the host group
alias Linux Servers
members our-server ; comma separated list of members

Finally, a dry run is initiated to check whether there are any configuration errors. If there are no errors, Nagios can be (re)started safely.

oot@atik:~# nagios –v /etc/nagios3/nagios.cfg
root@atik:~# service nagios3 restart

Access Nagios after Configuration

Now you are ready to use Nagios.
Nagios can be accessed by opening the URL http://IP/nagios3 in case of Ubuntu/Debian.
The user “nagiosadmin” needs to be authenticated to access the page.

Nagios Server

1 thought on “How To Install and Configure Nagios in Debian

Leave a Reply

Your email address will not be published. Required fields are marked *