4 月 182013
 

创建主机组配置文件

define hostgroup{
 hostgroup_name  IDC
 alias           IDC Servers
 members         mail-server
 }

定义主机和服务

define host{
 use                     linux-server
 host_name               mail-server
 alias                   postfix mail server
 address                 101.78.×××.××
 }
define service{
 use                             generic-service
 host_name                       mail-server
 service_description             Webmail
 check_command                   check_http
 notifications_enabled           0
 }
define service{
 use                             generic-service
 host_name                       mail-server
 service_description             POP3 Service
 check_command                   check_pop!100.0,20%!500.0,60%
 notifications_enabled           0
 }
define service{
 use                             generic-service
 host_name                       mail-server
 service_description             SMTP Service
 check_command                   check_smtp!100.0,20%!500.0,60%
 notifications_enabled           0
 }

完整检测命令的实现

[root@monitor libexec]# ./check_pop -H 101.78.×××.×× -p 110 -w 100.0 -c 200.0
POP OK – 0.051 second response time on port 110 [+OK Dovecot ready.]|time=0.051335s;;500.000000;0.000000;10.000000
[root@monitor libexec]#

[root@monitor libexec]# ./check_smtp -H 101.78.×××.×× -p 25 -4 -w 100 -c 500
SMTP OK – 0.096 sec. response time|time=0.095827s;100.000000;500.000000;0.000000
[root@monitor libexec]#

在nagios web管理界面中看到的新增监控项目

nagios-config-02-01

查看新增的主机组

nagios-config-02-02

主机状态通告显示新增主机为Down状态
原因是目的主机前端防火墙禁止PING响应nagios-config-02-03

 

 

 

nagios-config-02-04

查看主机状态信息并关闭主机活动检测nagios-config-02-05

nagios-config-02-06

成功执行命令

nagios-config-02-07

确认主机活动检测已关闭nagios-config-02-08

nagios-config-02-09