Support:Nagios: Difference between revisions

From Arianne
Jump to navigation Jump to search
imported>Kymara
Created page with "Nagios3 monitoring server running on <servername>. ==Nagios Interface== Runs on an apache2 server. * http://.../nagios3 *Plugins in use: check_nrpe ([http://nagios.sourceforg..."
 
imported>Kymara
Created page with "Nagios3 monitoring server running on <servername>. ==Nagios Interface== Runs on an apache2 server. * http://.../nagios3 *Plugins in use: check_nrpe ([http://nagios.sourceforg..."
 
(4 intermediate revisions by the same user not shown)
(No difference)

Latest revision as of 08:07, 7 June 2011

Nagios3 monitoring server running on <servername>.

Nagios Interface

Runs on an apache2 server.

Documentation

Installation

apt-get install nagios3

Installs nagios3 and required packages (Apache2, postfix, mailx)

Nagios installation at /etc/nagios3/
Nagios plugins at /usr/lib/nagios/plugins/ (/etc/nagios-plugins/config/ for configuration files)

Nagios configuration file is at /etc/nagios3/nagios.cfg

Adding a host

Created /etc/nagios3/objects/ directory to hold configuration files for the different servers.

If the new host type isn't included in an existing template (windows, linux), edit the templates.cfg and add the new template. The templates are configured exactly the same at the moment, but it is worth adding a new template in case we need to configure the different host types.

  • example template file
define host{
	name	windows-server ; name of this template
	use	generic-host;	inherit default values
	check_period	24x7
	check_interval	5
	retry_interval 	1
	max_check_attempts	10
	check_command	check-host-alive
	notification_period	24x7
	notification_interval	30
	notification_options	d,r
	contact_groups	admins
	register	0 ;	DON'T REGISTER THIS, IT'S A TEMPLATE
}

define host{
	name	linux-server
	use	generic-host
	check_period 	24x7
	check_interval 5
	retry_interval	1
	max_check_attempts	10
	check_command	check-host-alive
	notification_period	24x7
	notification_interval	30
	notification_options	d,r
	contact_groups	admins
	register	0;
}	

The hosts are defined in either the linux or windows .cfg files corresponding to their host type. To add a new host, edit one of these .cfg files or create a new file for a new host type. Remember to edit the nagios.cfg to use any new .cfg files (add line cfg_file=/etc/nagios3/objects/<filename>).

  • example host definition
define host{
        use    linux-server    #inherit the settings from the template defined in templates.cfg
        host_name    XXX    #name that the host will be referred to as
        alias    XXX     #alias name for descriptive purposes
        address    xxx.xx.xx.xx    #address of host
}

Recommended that you then add this host to a hostgroup. These are defined at /etc/nagios3/objects/hostgroups.cfg. Hostgroups allow services to be issued to multiple hosts with only one definition.

  • example hostgroup definition
define hostgroup{
        hostgroup_name    debian-servers
                alias    Debian GNU/Linux Servers
                members    localhost,..........
        } 

A host can be added to more than one hostgroup.

Adding a service

Services perform the checks on the hosts. Some services are defined in the windows and linux .cfg files (checks on the general well being of the host e.g. disk space checks, processes running) where as some are defined in their own files (e.g. the sql service definitions are in sql.cfg).

  • example service definition
define service{
        use    generic-service    #inherit settings from the generic-service template
        host_name    XXX    #host to run the service on, to run the service on a hostgroup use hostgroup_name <hostgroup name>
        service_description     Current Load    #name that will show up on the nagios interface
        check_command    check_nrpe_1arg!connect    #command to be run by the service, defined in commands.cfg. <command name>!<argument1>!<argument2>!... This example uses the command to run the check_nrpe plugin with one argument,
                                                                                                                                                           the connect check.

Adding commands

The commands to be run by the services can be found at /etc/nagios3/objects/commands.cfg. Some commands for plugins (e.g. the check_nrpe plugin used above) are defined at /etc/nagios-plugins/config/.

  • example command
define command{
        command_name     check_mysql_all     #name that the command will be referred to as
        command_line     /usr/lib/nagios/plugins/check_mysql_all -K $ARG1$ -H $HOSTNAME$ --port 3306 -u <username> -p <password>    #the command to be run when the command name is used. The $ARG1$ in this example will be replaced by 
                                                                                                                                     the first argument provided in the service calling the command. $ARG2$ would be the second and so forth.
        }

To use a new plugin for Nagios, the command_line path must lead to the plugin. Refer to the plug-in's documentation for what checks can be run and edit the command line to match.