From 38f3e17482479d61e1467335a402fd52b99de086 Mon Sep 17 00:00:00 2001 From: icybreaker Date: Sat, 21 Dec 2013 23:15:04 +0800 Subject: [PATCH] translated --- ...o install and configure Nagios on Linux.md | 370 ----------------- ...o install and configure Nagios on Linux.md | 371 ++++++++++++++++++ 2 files changed, 371 insertions(+), 370 deletions(-) delete mode 100644 sources/How to install and configure Nagios on Linux.md create mode 100644 translated/How to install and configure Nagios on Linux.md diff --git a/sources/How to install and configure Nagios on Linux.md b/sources/How to install and configure Nagios on Linux.md deleted file mode 100644 index 75546de2fe..0000000000 --- a/sources/How to install and configure Nagios on Linux.md +++ /dev/null @@ -1,370 +0,0 @@ -Translating by icybreaker -How to install and configure Nagios on Linux -================================================================================ -[Nagios][1] is one of the most powerful network monitoring systems, which is widely used in the industry. It can actively monitor any network, and generate audio/email warnings and alerts when any problem is detected. The check types and alert timers are fully customizable. - -Another incredible capability of Nagios is that it can monitor both hosts and services e.g., it can monitor IP addresses and TCP/UDP port numbers. To explain a little, let us assume that there is a web server that we want to monitor. Nagios can check whether the server is online by running ping on the IP/name of the server as well as it can be set up to provide warnings in case the round trip time (RTT) to the server increases. Further, Nagios can also check whether TCP port 80 (web server) is reachable e.g., the server is online but Apache/IIS is not responding. - -There are also 3rd party monitoring tools that are based on Nagios, such as [Centreon][2], [FAN][3] , [op5 Monitor][4], which supplement standalone Nagios engine in terms of interface, automation, and technical support. - -This tutorial explains **how to install and configure Nagios on Linux**. - -### Install Nagios on Debian or Ubuntu ### - -On a Debian-based system, the installation in itself is a very simple process thanks to apt-get. - - root@mrtg:~# apt-get install nagios3 - -The mail server setting can be done during Nagios installation. It can also be configured later when needed. - -Note: A valid SMTP configuration is needed for Nagios to be able send email notifications. - -[![](http://farm4.staticflickr.com/3809/11198373625_cdacef2275_z.jpg)][5] - -As it can be seen, Nagios supports multiple options for email delivery. The most common options would be Internet Site where the server sends email directly to the recipient. Another widely used option is using smarthost or relay server, in which the server sends the email to an intermediary mail server which in turn is responsible for delivering the mail to the recipient. - -Next, the domain name of the server has to be included in the next step. - -[![](http://farm8.staticflickr.com/7384/11198394746_f4d42300b5_z.jpg)][6] - -Finally, the password for the Nagios admin user ‘nagiosadmin’ is set. This value can also be changed later. - -[![](http://farm4.staticflickr.com/3759/11198378964_5d7f6638e8_z.jpg)][7] - -### Install Nagios on CentOS or RHEL ### - -yum is used for installation. After [setting up the repoforge repository][8], run yum as follows. - - [root@mrtg ~]# yum install nagios nagios-plugins - -### Requirements for Monitoring ### - -In this tutorial, we want to monitor the following. - -1. All Linux server will be checked every 3 minutes. -1. All Cisco Routers will be checked every 3 minutes. -1. All email alerts should go to the address sentinel@example.tst. -1. Nagios will verify 3 times before sending out any alerts just to be sure that the problem is real. -1. If the RTT to any device exceeds 100 ms and/or packet loss exceeds 20%, email alert will be generated. - -The rest of the tutorial will guide you to configure Nagios on Linux. - -### Nagios Configuration on Ubuntu ### - -It is important to know where Nagios configuration files are located. The following table shows the location of Nagios configuration files on Debian-based systems. - - /etc/nagios-plugins Customizable scripts used for monitoring - /etc/nagios3 Configuration files to add hosts, services, define checks and timers - /usr/lib/nagios/plugins Executable files used for monitoring - -The following steps are inter-related. Hosts, groups for hosts and adding services to host groups are defined. - -### Adding Host Template ### - -The templates defining what to do with a type host is defined. We use the files provided with the installation as sample. - -First, define a host template for Linux devices - - root@mrtg:~# cd /etc/nagios3/conf.d - root@mrtg:/etc/nagios3/conf.d/# cp generic-host_nagios2.cfg linux-server.cfg - -Edit linux-server.cfg as follows. The parts with bold font are modified. - - root@mrtg:/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 checking -> check_interval 3 ; the interval between consecutive checks -> max_check_attempts 3 ; number of rechecking before generating email alerts -> notification_interval 0 -> notification_period 24x7 -> notification_options d,u,r -> contact_groups admins ; the group where emails will be sent -> register0 -> } - -Next, define a host template for Cisco devices. - - root@mrtg:/etc/nagios3/conf.d/# cp linux-server.cfg cisco-device.cfg - -Modify cisco-device.cfg as follows. The bold-font parts are modified. - - root@mrtg:/etc/nagios3/conf.d/# vim cisco-device.cfg - -> # The highlighted parts are modified -> define host{ -> name cisco-device -> 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 checking -> check_interval 3 ; the interval between consecutive checks -> max_check_attempts 3 ; number of rechecking before generating email alerts -> notification_interval 0 -> notification_period 24x7 -> notification_options d,u,r -> contact_groups admins ; the group where emails will be sent -> register 0 -> } - -### Adding Host ### - -Now that the host template is defined, the actual host to be monitored is added. Again, the files provided by default are used as sample. - - root@mrtg:/etc/nagios3/conf.d/# cp localhost_nagios2.cfg example.cfg - root@mrtg:/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 172.17.1.23 ; The IP address of the host -> } -> -> # Host 2 -> define host{ -> use cisco-device ; Name of host template to use -> host_name our-router ; The hostname to be used by nagios -> alias our-router -> address 172.17.1.1 ; The IP address of the host -> } - -### Host Group Definition ### - -For ease of management when there are multiple hosts, it is advisable that hosts of similar types are grouped together. - - root@mrtg:/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 -> } -> -> definehostgroup { -> hostgroup_name cisco-device ; the name of the host group -> alias Cisco Devices -> members our-server ; comma separated list of members -> } - -### Service Definition ### - -First, the command example-host-check is defined with warning value of 100 ms for latency and 20% for packet loss. Critical values are 5000 ms for latency and 100% packet loss. One IPv4 ping request is transmitted. - - root@mrtg:~# vim /etc/nagios-plugins/config/ping.cfg - -> define command{ -> command_name example-host-check -> command_line /usr/lib/nagios/plugins/check_ping -H '$HOSTADDRESS$' -w 100,20% -c 5000,100% -p 1 -4 -> } - -Then, the command is associated with host groups. - - root@mrtg:/etc/nagios3/conf.d/# vim services_nagios2.cfg - -> define service { -> hostgroup_name linux-server -> service_description Linux Servers -> check_command example-host-check -> use generic-service -> notification_interval 0 ; set 0 if you want to be renotified -> } -> -> define service { -> hostgroup_name cisco-device -> service_description Cisco Devices -> check_command example-host-check -> use generic-service -> notification_interval 0 ; set 0 if you want to be renotified -> } - -### Contact Definition ### - -The required address for sending email added to Nagios. - -> define contact{ -> contact_name root -> alias Root -> service_notification_period 24x7 -> host_notification_period 24x7 -> service_notification_options w,u,c,r -> host_notification_options d,r -> service_notification_commands notify-service-by-email -> host_notification_commands notify-host-by-email -> email root@localhost, sentinel@example.tst -> } - -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. - - root@mrtg:~#nagios –v /etc/nagios3/nagios.cfg - root@mrtg:~# service nagios3 restart - -### Nagios Configuration on CentOS/RHEL ### - -The following shows the locations of Nagios configuration files on Redhat-based systems. - -> /etc/nagios/objects Configuration files to add hosts, services, define checks and timers -> /usr/lib/nagios/plugins Executable files used for monitoring - -### Adding Host Template ### - -A template is created to define what needs to be done for a specific type of host. The files provided with the installation is modified. - - [root@mrtg objects]# cd /etc/nagios/objects/ - [root@mrtg objects]# vim templates.cfg - -> define host{ -> name linux-server -> use generic-host -> check_period 24x7 -> check_interval 3 -> retry_interval 1 -> max_check_attempts 3 -> check_command example-host-check -> notification_period 24x7 -> notification_interval 0 -> notification_options d,u,r -> contact_groups admins -> register 0 -> } -> -> define host{ -> name cisco-router -> use generic-host -> check_period 24x7 -> check_interval 3 -> retry_interval 1 -> max_check_attempts 3 -> check_command example-host-check -> notification_period 24x7 -> notification_interval 0 -> notification_options d,u,r -> contact_groups admins -> register 0 -> } - -### Adding Hosts and Host Groups ### - -The configuration file provided with by default is used as a sample. The hosts and host groups are added in the same file. - - [root@mrtg objects]# cp localhost.cfg example.cfg - [root@mrtg objects]# vim example.cfg - -> #Adding Linux server -> define host{ -> use linux-server -> host_name our-server -> alias our-server -> address 172.17.1.23 -> } -> -> #Adding Cisco Router -> define host{ -> use cisco-router -> host_name our-router -> alias our-router -> address 172.17.1.1 -> } -> -> # HOST GROUP DEFINITION -> define hostgroup{ -> hostgroup_name linux-servers -> alias Linux Servers -> members our-server -> } -> -> define hostgroup{ -> hostgroup_name cisco-router -> alias cisco-router -> members our-router -> } - -### Service Definition ### - -A service called example-host-check is defined with warning values of 100 ms for latency and 20% for packet loss. The critical values are 5000 ms for latency and 100% for packet loss. Only one IPv4 ping request will be transmitted. - - [root@mrtg objects]# vim commands.cfg - -> define command{ -> command_name example-host-check -> command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 100.0,20% -c 5000.0,100% -p 1 -4 -> } - -### Contact Definition ### - -The email address where alerts will be sent is added into Nagios. - -> define command{ -> command_name example-host-check -> command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 100.0,20% -c 5000.0,100% -p 1 -4 -> } - -### Contact Definition ### - -The email address where alerts will be sent is added into Nagios. - - [root@objects objects]# vim contacts.cfg - -> define contact{ -> contact_name nagiosadmin -> use generic-contact -> alias Nagios Admin -> email nagios@localhost, sentinel@example.tst -> } - -Finally, we are ready to start the Nagios service. A dry run is recommended to find out errors in configuration. - - [root@mrtg ~]# nagios –v /etc/nagios/nagios.cfg - [root@mrtg ~]# service nagios restart - [root@mrtg ~]# chkconfig nagios on - -### 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 or http://IP/nagios in case of CentOS/RHEL e.g. http://172.17.1.23/nagios3. The user "nagiosadmin" needs to be authenticated to access the page. - -[![](http://farm4.staticflickr.com/3834/11198394806_4f4a753778_z.jpg)][9] - -When Nagios is not running the way it is supposed to, the first thing to do would be to initiate a dry run. - -On Debian or Ubuntu: - - # nagios3 -v /etc/nagios3/nagios.cfg - -On CentOS or RHEL: - - # nagios -v /etc/nagios/nagios.cfg - -The log file may also shed some important clue. The path to the log file is located at /var/log/nagios/nagios.log. - -Hope this helps. - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/2013/12/install-configure-nagios-linux.html - -译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://www.nagios.org/ -[2]:http://www.centreon.com/ -[3]:http://www.fullyautomatednagios.org/ -[4]:http://www.op5.com/ -[5]:http://www.flickr.com/photos/xmodulo/11198373625/ -[6]:http://www.flickr.com/photos/xmodulo/11198394746/ -[7]:http://www.flickr.com/photos/xmodulo/11198378964/ -[8]:http://xmodulo.com/2013/01/how-to-set-up-rpmforge-repoforge-repository-on-centos.html -[9]:http://www.flickr.com/photos/xmodulo/11198394806/ diff --git a/translated/How to install and configure Nagios on Linux.md b/translated/How to install and configure Nagios on Linux.md new file mode 100644 index 0000000000..4018bc112b --- /dev/null +++ b/translated/How to install and configure Nagios on Linux.md @@ -0,0 +1,371 @@ +Linux下Nagios的安装与配置 +================================================================================ +[Nagios][1]是企业普遍使用的最具影响力的网络信息监视系统之一,它可以动态监视指定的网络状态,并在状态异常时发出警告音或邮件报警通知运维人员。特定的检测形式和警报定时器专门完成此类工作。 + +Nagios的另一强大功能是它能同时监测主机和服务。例如,它可以同时监测到IP地址和TCP/UDP端口号。为进一步阐述此功能,我们假定有台需要监测的web服务器,Nagios可运用在服务器上基于IP/服务器名运行ping命令的方法检测服务器是否在线,同时当服务器的RTT(往返时延)增加时,Nagios会随时告警。另外,Nagios还能检测TCP的80端口(web服务器)是否可达,如可能出现服务器在线但Apache/IIS没有响应的情况。 + +而基于Nagios的第三方监测工具如[Centreon][2], [FAN][3] , [op5 Monitor][4] +在界面设计,自动化运行和技术支持方面为脱机的Nagios引擎功能提供了相应的补充。 + +本段教程将展示**Linux下Nagios的安装与配置**. + +### Debian或Ubuntu下Nagios的安装 ### + +Debian系统用户使用apt-get命令就可安装Nagios: + + root@mrtg:~# apt-get install nagios3 + +Nagios安装过程中邮件服务器自动完成设置,安装后也可以进行自定义设置。 + +提示:为使Nagios可正常发送邮件通知,需正确配置SMTP。 + +[![](http://farm4.staticflickr.com/3809/11198373625_cdacef2275_z.jpg)][5] + +可以看到Nagios支持多种邮件传送方式。最常见的莫过于服务器直接向接收者发送邮件,另一种常见的形式是用智能主机或中继服务器将邮件传送至中介邮件服务器,然后它负责将邮件传送给接收者。 + +进行下一步操作时服务器的域名需要包含进去。 + +[![](http://farm8.staticflickr.com/7384/11198394746_f4d42300b5_z.jpg)][6] + +最后,Nagios管理员‘nagiosadmin’的密码设置完成,用户可以自行修改密码。 + +[![](http://farm4.staticflickr.com/3759/11198378964_5d7f6638e8_z.jpg)][7] + +### CentOS或RHEL下Nagios的安装 ### + +yum命令是安装命令,[建立repoforge库][8]之后运行如下yum命令: + + [root@mrtg ~]# yum install nagios nagios-plugins + +### 监测需求 ### + +本段教程中,我们希望完成以下监测内容: + +1. 每三分钟监测一次所有Linux服务器。 +2. 每三分钟监测一次所有思科路由器。 +3. 所有的邮件告警集中存至sentinel@example.tst。 +4. 发出告警前Nagios都将进行3次验证以确保问题确有发生。 +5. 当设备的往返时延超过100ms并且/或包丢失量超过20%将发出邮件告警。 + +余下的教程将指导您如何在Linux系统中配置Nagios。 + +### Ubuntu下Nagios的配置 ### + +明确Nagios配置文件的地址至关重要,以下路径指明了Debian系统下Nagios的配置文件地址。 + + /etc/nagios-plugins 实现监测功能的专有脚本存放地址 + /etc/nagios3 添加主机、服务,定义检测和定时器的配置文件 + /usr/lib/nagios/plugins 用于监测的可执行文件 + +接下来的步骤相互关联,由此开始定义主机,主机组及向主机组添加服务操作。 + +### 添加主机模板 ### + +我们对同一类型的主机定义了对应的模板,这里使用安装文件作举例说明。 + +首先,为Linux设备定义主机模板。 + + root@mrtg:~# cd /etc/nagios3/conf.d + root@mrtg:/etc/nagios3/conf.d/# cp generic-host_nagios2.cfg linux-server.cfg + +如下编辑linux-server.cfg。黑体部分为修改部分。 + + root@mrtg:/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 ; 检查所用脚本 +> check_interval 3 ; 连续检查的间隔 +> max_check_attempts 3 ; 产生邮件告警前的自检次数 +> notification_interval 0 +> notification_period 24x7 +> notification_options d,u,r +> contact_groups admins ; 邮件将要发送至的组 +> register0 +> } + +接下来,为Cisco设备定义主机模板。 + + root@mrtg:/etc/nagios3/conf.d/# cp linux-server.cfg cisco-device.cfg + +如下修改cisco-device.cfg。黑体部分为修改部分。 + + root@mrtg:/etc/nagios3/conf.d/# vim cisco-device.cfg + +> # 修改部分高亮显示 +> define host{ +> name cisco-device +> 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 ; 检查时使用的脚本 +> check_interval 3 ; 连续检查间隔 +> max_check_attempts 3 ; 产生邮件告警前的自检次数 +> notification_interval 0 +> notification_period 24x7 +> notification_options d,u,r +> contact_groups admins ; 邮件将要发至的组 +> register 0 +> } + +### 添加主机 ### + +现在已定义主机模板,实际监测的主机也已添加。以默认的文件作例子展示如下内容。 + + root@mrtg:/etc/nagios3/conf.d/# cp localhost_nagios2.cfg example.cfg + root@mrtg:/etc/nagios3/conf.d/# vim example.cfg + +> # Host 1 +> define host{ +> use linux-server ; 使用的主机模板名 +> host_name our-server ; nagios使用的主机名 +> alias our-server +> address 172.17.1.23 ; 主机的IP地址 +> } +> +> # Host 2 +> define host{ +> use cisco-device ; 使用的主机模板名 +> host_name our-router ; nagios使用的主机名 +> alias our-router +> address 172.17.1.1 ; 主机的IP地址 +> } + +### 主机组定义 ### + +当有多个主机时,为方便管理,建议将相似的主机组成一组。 + + root@mrtg:/etc/nagios3/conf.d/# vim hostgroups_nagios2.cfg + +> definehostgroup { +> hostgroup_name linux-server ; 主机组名 +> alias Linux Servers +> members our-server ; 组员列表 +> } +> +> definehostgroup { +> hostgroup_name cisco-device ; 主机组名 +> alias Cisco Devices +> members our-server ; comma separated list of members +> } + +### 定义服务 ### + +首先,当往返时延达到100ms预警值并且有20%包丢失时规定执行主机监测,对应的关键值设置为5000ms且包丢失比率为100%,同时传送一个IPv4的ping请求。 + + root@mrtg:~# vim /etc/nagios-plugins/config/ping.cfg + +> define command{ +> command_name example-host-check +> command_line /usr/lib/nagios/plugins/check_ping -H '$HOSTADDRESS$' -w 100,20% -c 5000,100% -p 1 -4 +> } + +然后,将命令关联至主机组。 + + root@mrtg:/etc/nagios3/conf.d/# vim services_nagios2.cfg + +> define service { +> hostgroup_name linux-server +> service_description Linux Servers +> check_command example-host-check +> use generic-service +> notification_interval 0 ; 初始化设置为0 +> } +> +> define service { +> hostgroup_name cisco-device +> service_description Cisco Devices +> check_command example-host-check +> use generic-service +> notification_interval 0 ; 初始化设置为0 +> } + +### 通讯定义 ### + +进行如下定义将发送邮件需要的地址添加至Nagios。 + +> define contact{ +> contact_name root +> alias Root +> service_notification_period 24x7 +> host_notification_period 24x7 +> service_notification_options w,u,c,r +> host_notification_options d,r +> service_notification_commands notify-service-by-email +> host_notification_commands notify-host-by-email +> email root@localhost, sentinel@example.tst +> } + +最后,试运行初始化检测是否有配置错误。如果没有错误,Nagios开始安全运行。 + + root@mrtg:~#nagios –v /etc/nagios3/nagios.cfg + root@mrtg:~# service nagios3 restart + +### CentOS/RHEL上的Nagios配置 ### + +Redhat系统中Nagios的配置文件地址如下所示。 + +> /etc/nagios/objects 添加主机、服务,定义监测和定时器的配置文件 + +> /usr/lib/nagios/plugins 实现监测的可执行文件 + +### 添加主机模板 ### + +为特定类型的主机创建所需的模板,相应修改安装所需的文件。 + + [root@mrtg objects]# cd /etc/nagios/objects/ + [root@mrtg objects]# vim templates.cfg + +> define host{ +> name linux-server +> use generic-host +> check_period 24x7 +> check_interval 3 +> retry_interval 1 +> max_check_attempts 3 +> check_command example-host-check +> notification_period 24x7 +> notification_interval 0 +> notification_options d,u,r +> contact_groups admins +> register 0 +> } +> +> define host{ +> name cisco-router +> use generic-host +> check_period 24x7 +> check_interval 3 +> retry_interval 1 +> max_check_attempts 3 +> check_command example-host-check +> notification_period 24x7 +> notification_interval 0 +> notification_options d,u,r +> contact_groups admins +> register 0 +> } + +### 添加主机和主机组 ### + +这里以默认的配置文件为例,主机和主机组添加至配置文件中。 + + [root@mrtg objects]# cp localhost.cfg example.cfg + [root@mrtg objects]# vim example.cfg + +> #Adding Linux server +> define host{ +> use linux-server +> host_name our-server +> alias our-server +> address 172.17.1.23 +> } +> +> #Adding Cisco Router +> define host{ +> use cisco-router +> host_name our-router +> alias our-router +> address 172.17.1.1 +> } +> +> # HOST GROUP DEFINITION +> define hostgroup{ +> hostgroup_name linux-servers +> alias Linux Servers +> members our-server +> } +> +> define hostgroup{ +> hostgroup_name cisco-router +> alias cisco-router +> members our-router +> } + +### 服务定义 ### + +当往返时延达到100ms预警值并且有20%包丢失时规定执行服务。关键值设置为5000ms且包丢失比率为100%,同时将只传送一个IPv4的ping请求。 + + [root@mrtg objects]# vim commands.cfg + +> define command{ +> command_name example-host-check +> command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 100.0,20% -c 5000.0,100% -p 1 -4 +> } + +### 通讯定义 ### + +告警要发送的邮件地址添加至Nagios中。 + +> define command{ +> command_name example-host-check +> command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 100.0,20% -c 5000.0,100% -p 1 -4 +> } + +### 通讯定义 ### + +告警要发送的邮件地址添加至Nagios中。 + + [root@objects objects]# vim contacts.cfg + +> define contact{ +> contact_name nagiosadmin +> use generic-contact +> alias Nagios Admin +> email nagios@localhost, sentinel@example.tst +> } + +最后,准备启动Nagios服务,可先试运行检测配置是否出错。 + + [root@mrtg ~]# nagios –v /etc/nagios/nagios.cfg + [root@mrtg ~]# service nagios restart + [root@mrtg ~]# chkconfig nagios on + +### 配置后访问Nagios ### + +现在一切就绪,可以开始Nagios之旅了。Ubuntu/Debian用户可以通过打开http://IP/nagios3网页访问Nagios,CentOS/RHEL用户可以打开http://IP/nagios如http://172.17.1.23/nagios3来访问Nagios。“nagiosadmin”用户则需要认证来访问页面。 + +[![](http://farm4.staticflickr.com/3834/11198394806_4f4a753778_z.jpg)][9] + +若Nagios没有依原设定运行,首先要做的是建立一个dry run。 + +Debian或Ubuntu系统: + + # nagios3 -v /etc/nagios3/nagios.cfg + +CentOS或RHEL系统: + + # nagios -v /etc/nagios/nagios.cfg + +日志文件也会提供重要线索,若需查看可以转至路径/var/log/nagios/nagios.log。 + +希望本文有所帮助。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/2013/12/install-configure-nagios-linux.html + +译者:[icybreaker](https://github.com/icybreaker) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://www.nagios.org/ +[2]:http://www.centreon.com/ +[3]:http://www.fullyautomatednagios.org/ +[4]:http://www.op5.com/ +[5]:http://www.flickr.com/photos/xmodulo/11198373625/ +[6]:http://www.flickr.com/photos/xmodulo/11198394746/ +[7]:http://www.flickr.com/photos/xmodulo/11198378964/ +[8]:http://xmodulo.com/2013/01/how-to-set-up-rpmforge-repoforge-repository-on-centos.html +[9]:http://www.flickr.com/photos/xmodulo/11198394806/