Nagios configuration File Brief Introduction

Source: Internet
Author: User

After Nagios is installed, the default configuration file is in the/USR/LOCAL/NAGIOS/ETC directory:

1,cgi.cfg: For Define a configuration file for CGI authentication properties

[[email protected]_ etc]# grep  ^[^#[:space:]] cgi.cfgmain_config_file=/usr/ local/nagios/etc/nagios.cfg  #告诉CGI主配置文件位置physical_html_path =/usr/local/nagios/share   # This is the physical path where the html files for nagios  are kept on your workstation or serverurl_html_path=/nagios  # Accessed by urishow_context_help=0use_pending_states=1use_authentication=1   #是否启用认证授权功能use_ssl_authentication =0   #authorized_for_system_information =nagiosadminauthorized_for_configuration_information= Nagiosadminauthorized_for_system_commands=nagiosadminauthorized_for_all_services=nagiosadminauthorized_for_all _hosts=nagiosadminauthorized_for_all_service_commands=nagiosadminauthorized_for_all_host_commands= Nagiosadmindefault_statusmap_layout=5default_statuswrl_layout=4ping_syntax=/bin/ping -n -u -c  5  $HOSTADDRESS $refresh_rate=90resuLt_limit=100escape_html_tags=1action_url_target=_blanknotes_url_target=_blanklock_author_names=1 

2,htpasswd.users: Authentication User Password Store file

3,resource.cfg : A variable definition file that defines variables in this file, referenced by other profiles, such as the default $user1$

4, Nagios.cfg:nagios master configuration file

Log_file=/usr/local/nagios/var/nagios.log: Define log file path

cfg_file= ... : Referencing the object configuration file needs to add a path here (this directive are used to specify a directory which contains object Configurati On files )

Object_cache_file=/usr/local/nagios/var/objects.cache: (this directive was used to specify a file in which a cached copy of object definitions should be stored: Cache backup files for all objects)

Status_file=/usr/local/nagios/var/status.dat: State file (This is the file, Nagios uses to store the current status, comment, and downtime information)

5,objects/commands.cfg: File is present by default and does not need to be modified, the new command is added in this file

Define Command{

Command_name check-host-alive

Command_line $USER 1$/check_ping-h $HOSTADDRESS $ w 3000.0,80%-C 5000.0,100%-P 5

}

Check-host-alive: Command name

$USER 1$: defined in Resource.cfg

Check_ping-h $HOSTADDRESS $ w 3000.0,80%-C 5000.0,100%-P 5: Enables libexec/check_ping scripts and defines the parameters that follow. (Note: 3000 default unit is MS)

# "-W" in "-W 3000.0,80%" indicates that a pair of values follows the "WARNING" state, and "80%" is its critical value.

# "-C" in the "-C 5000.0,100%" description of the following pair of values corresponding to "CRITICAL", "100%" is its critical value.

# "-P 5" indicates that each probe sends 5 packets.

Here is a new Check_nrpe in this file

# ' Check_nrpe ' command definition

Define Command{

Command_name Check_nrpe # defines the command name as Check_nrpe, which is to be used in the new Services.cfg file.

Command_line $USER 1$/check_nrpe-h $HOSTADDRESS $-C $ARG 1$ #这是定义实际运行的插件程序. This command-line usage is viewed using the command check_nrpe–h.

}

6,OBJECTS/SERVICES.CFG: Default does not exist, need to create new, define the resources of the host to be monitored in this file

Define Service{

Use Local-service # Reference Local-service defines the value of the property, which is defined in Templates.cfg

HOST_NAME nagios-conan3 #定义被监控的主机名

Service_description check-host-alive

Check_command check-host-alive #定义了使用监控的命令, defined in Commands.cfg

}


Define Service{

Use Local-service

HOST_NAME nagios-conan3

Service_description Current Load

Check_command Check_nrpe!check_load

}

Note: check_nrpe!check_load--previously created the Check_nrpe command definition in Commands.cfg, which defines the monitoring commands that need to be performed on the monitored host nagios-conan3.

7,objects/hosts.cfg: Need to create, specify the address and name of the monitored host and other attribute information

Define Host{

Use Linux-server

HOST_NAME nagios-conan3

Address 192.168.1.129

}

Define Hostgroup{

Hostgroup_name Linux Servers the same name as defined in #此处注意不能和localhost. cfg

Alias Linux Servers1

Members NAGIOS-CONAN3

}

8,objects/templates.cfg:nagios is primarily used to monitor host resources and services, called objects in the Nagios configuration, and in order to avoid having to repeatedly define some monitoring objects, Nagios introduces a template configuration file that defines some common attributes as templates. facilitates multiple references. This file has a comment after each parameter.

9,OBJECTS/LOCALHOST.CFG: Defines the services that are monitored on this computer

10,objects/contacts.cfg: Define contacts and contact groups

Define Contact{

Contact_Name nagiosadmin; Short name of user

Use Generic-contact; Inherit default values from Generic-contact template (defined above)

Alias Nagios Admin; Full name of user

email [email protected]; <<***** change YOUR EMAIL ADDRESS ******

}

Define Contactgroup{

Contactgroup_name Admins

Alias Nagios Administrators

Members Nagiosadmin

}

11,objects/timeperiods.cfg: Define the time periods in this file that need to be monitored



















Nagios configuration File Brief Introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.