Nagios – Configuration (Email, Files, Structures)

Email Relay

Open Terminal (As root)

nano /etc/mail/sendmail.cf

# “Smart” relay host (may be null)

DS smtp.customer.com

Save the File.

service sendmail restart

Default Sender email address for Nagios

Open Terminal (As root)

nano /etc/nagios/objects/contacts.cfg

define contact{

contact_name                    nagiosadmin

use                             generic-contact

alias                           Nagios Admin

email                           support@cyberblogue.com

}

 

Directory structure and Monitoring Definition for Nagios

Under /etc/nagios  you have 2 important folders depends on the config inside nagios.cfg

/etc/nagios/servers/

Under the servers folder create 3 folders to organize the layout

  • linux
  • windows
  • www_sites

 

Modify the hostgroup file to reflect your configuration

define hostgroup{

hostgroup_name  windows-servers ; The name of the hostgroup

alias           Windows Servers  ; Long name of the group

members         srv1,srv2,srv3

}

The member section is the critical one. Each member MUST reflect a config file within the subdirectory.

Sample file : srv1.domain.local.cfg

define host{

use             windows-server  ; Inherit default values from a template

host_name       srv1      ; The name we’re giving to this host

alias           srv1.domain.local;   ; A longer name associated with$

address         10.0.0.4        ; IP address of the host

}

The Host_name MUST be in the Hostgroup under members, this the section where Nagios make the association with the HostGroup and the config file.

Always name a server config file with the FQDN of the server you want to monitor and add .cfg at the end (This is only for Standard): srv1.domain.local.cfg

To monitor the services, look at all the sample file to help you define the option of monitoring.

After making the changes to the config files, you need to check your nagios.cfg files for errors :

nagios -v /etc/nagios/nagios.cfg

On the Windows Box, Install the NSClient++ http://www.nsclient.org/nscp/downloads

 

Leave a Reply