How to add a host on nagios monitoring server

Dated :12/10/2018

Hello, In this post we are going to see how to add the host in nagios monitoring server. To do this you already have to install the nagios on your server

Pre-requisites: nagios-plugins, nagios-nrpe-server

If you dont have the pre-requisites install those by using the reference mentioned below.

To install nagios refer this :

https://blog.pheonixsolutions.com/nagios-remote-host-monitoring/

To add the host in nagios monitoring server follow the given steps:

Step 1: Login to the server using ssh.

Step 2: Go to location of  /usr/local/nagios/etc/servers/

Step 3: If you want to add some service on the existing one choose the existing host configuration file or create the new config file here i create the new one in the name of sample.conf.

touch sample.conf

Step 4: Use vi editor or nano editor as you wish here we are using vi editor to edit the config file.

vi sample.conf

Define the host name and the service in the config file. Here i have add the host name example and add three services Load, Disk & processes.

define host {
use              linux-server
host_name        example
alias            example
address              101.101.101.101
max_check_attempts     5
check_period                    24x7
notification_interval       30
notification_period         24x7
}

define service{
use                        generic-service,nagiosgraph
host_name         101.101.101.101
service_description     Load
check_command          check_nrpe!check_load
}
define service{
use                        generic-service,nagiosgraph
host_name         101.101.101.101
service_description      Disk
check_command           check_nrpe!check_disk
}

define service{
use                       generic-service,nagiosgraph
host_name        101.101.101.101
service_description     Processes
check_command          check_nrpe!check_procs
}

copy paste the code in config file change the hostname & alias as your hostname and address as your domain ipaddress.

Step 5: Save the file and close the editor.

Step 6: Do the syntax check using this command.

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

 

If the syntax check is ok. Then restart the nagios service.

Leave a Reply