设为首页 收藏本站
查看: 3369|回复: 0

Nagios部署

[复制链接]

尚未签到

发表于 2019-1-15 13:48:43 | 显示全部楼层 |阅读模式
       Nagios配置详解

一、nagios简介
1、nagios基本介绍
官方网站:http://www.nagios.org/
     Nagios是一款用于系统和网络监控的应用程序。它可以在你设定的条件下对主机和服务进行监控,在状态变差和变好的时候给出告警信息。

2、Nagios更进一步的特征
1.监控网络服务(SMTP、POP3、HTTP、NNTP、PING等);
2.监控主机资源(处理器负荷、磁盘利用率等);
3.简单地插件设计使得用户可以方便地扩展自己服务的检测方法;
4.并行服务检查机制;
5.具备定义网络分层结构的能力,用"parent"主机定义来表达网络主机间的关系,这种关系可被用来发现和明晰
6.当服务或主机问题产生与解决时将告警发送给联系人(通过EMail、短信、用户定义方式);
7.具备定义事件句柄功能,它可以在主机或服务的事件发生时获取更
8.自动的日志回滚;
9.可以支持并实现对主机的冗余监控;  
10.可选的WEB界面用于查看当前的网络状态、通知和故障历史、日志文件等;
Nagios通常由一个主程序(Nagios)、一个插件程序(Nagios-plugins)和四个可选的ADDON(NRPE、NSCA、
NSClient++和NDOUtils)组成。Nagios的监控工作都是通过插件实现的,因此,Nagios和Nagios-plugins是服务
二、nagios监控部署
1、下载所需软件包
Nagios主程序
1.nagios.3.2.0.tar.gz Nagios的主程序
[root@localhost~]#wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios.3.2.0.tar.gz
Nagios 的插件
[root@localhost~]#wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz
Nagios代理检测程序
[root@localhost~]#wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
[root@UnixHot src]# ls
[root@UnixHot src]# ls
nagios-3.2.0.tar.gz nagios-plugins-1.4.13.tar.gz nrpe-2.12.tar.gz
安装依赖包
[root@localhost~]#yum -y install httpd php gcc glibc glibc-common gd gd-devel

2、创建Nagios账户和组
[root@localhost~]# useradd -m nagios
[root@localhost~]#groupadd nagcmd
[root@localhost~]#usermod -a -G nagcmd nagios
[root@localhost~]#usermod -a -G nagcmd apache

3、编译安装Nagios
[root@localhost ~]# tar xvf nagios-3.2.0.tar.gz -C /usr/local/src/
[root@localhost ~]# cd /usr/local/src/nagios-3.2.0/
[root@localhost nagios-3.2.0]# ./configure --with-command-group=nagcmd --with-nagios-user=nagios --with-nagios-group=nagios
[root@localhost nagios-3.2.0]# make all
[root@localhost nagios-3.2.0]# make install
[root@localhost nagios-3.2.0]# make install-init (生成init启动脚本)
[root@localhost nagios-3.2.0]# make install-config     (生成init启动脚本)
[root@localhost nagios-3.2.0]# make install-commandmode (设置相应的权限)
[root@localhost nagios-3.2.0]# make install-webconf (生成Apache配置文件nagios.conf)

4、为Nagios设置web验证密码
[root@localhost nagios-3.2.0]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
注:第一次添加用时要使用“-c”参数,以后再添加用户就不需在使用“-c”。

5、设置Nagios开机启动
[root@localhost nagios-3.2.0]# chkconfig --add nagios
[root@localhost nagios-3.2.0]# chkconfig nagios on

6、修改selinux设置
两种方法:
(1) 直接关闭selinux
[root@localhost nagios-3.2.0]# cat /etc/sysconfig/selinux
SELINUX=disabled
[root@localhost nagios-3.2.0]# setenforce 0
(2)根据selinux提示的结果设置selinux
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/
chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/

三、安装Nagios插件Nagios-plugin
Nagios-plugin插件提供了很多监控的模版,也可以自己手写。
[root@localhost ~]# tar xvf nagios-plugins-1.4.14.tar.gz -C /usr/local/src/
[root@localhost ~]# cd /usr/local/src/nagios-plugins-1.4.14/
[root@localhost nagios-plugins-1.4.14]# ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios  --with-nagios-group=nagios
[root@localhost nagios-plugins-1.4.14]# make && make install

四、安装nrpe
1、Nagios监控的方式
    第一部分是主机外监控,比如:主机是否存活,WEB服务是否正常,MySQL服务是否正常等内容,再主机外通过访问
其端口即可得知。这些监控命令再安装 nagios-plugins-1.4.13.tar.gz时已经生成了,再/usr/local/nagios/libexec
目录下。
    第二部分是主机内监控,比如:要监控服务器的进程、磁盘使用等功能。这些功能的实现要依靠nrpe了,nrpe的工
作模式是C/S模式,在被监控主机中,开启nrpe监听,当听到监控服务器上所发出的命令,让它检查该服务器上的硬盘
使用信息时,它就会执行,并把信息传回,监控服务器。

2、安装nrpe
[root@localhost ~]# tar xvf nrpe-2.12.tar.gz -C /usr/local/src/
[root@localhost ~]# cd /usr/local/src/nrpe-2.12/
[root@localhost nrpe-2.12]# ./configure
[root@localhost nrpe-2.12]# make all
[root@localhost nrpe-2.12]# make install-plugin
[root@localhost nrpe-2.12]# make install-daemon
[root@localhost nrpe-2.12]# make install-daemon-config
[root@localhost nrpe-2.12]# make install-xinetd

3、配置nrpe
[root@localhost nrpe-2.12]# vim /etc/xinetd.d/nrpe
# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
        flags           = REUSE
        socket_type     = stream
        port            = 5666
        wait            = no
        user            = nagios
        group           = nagios
        server          = /usr/local/nagios/bin/nrpe
        server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
        log_on_failure  += USERID
        disable         = no
        only_from       = 127.0.0.1 192.168.0.10 192.168.0.9
}
在only_from 添加要监控的主机的IP地址,中间以空格隔开。

4、添加端口
[root@localhost nrpe-2.12]# vim /etc/services  最后
nrpe 5666/tcp #nrpe

5、重新启动xinetd服务
[root@localhost nrpe-2.12]# service xinetd restart
[root@localhost nrpe-2.12]# netstat -anplt | grep 5666 | grep -v grep
tcp        0      0 0.0.0.0:5666                0.0.0.0:*                   LISTEN      23187/xinetd     

6、修改配置文件commands.cfg加入对nrpe的支持
[root@UnixHot ~]# vi /usr/local/nagios/etc/objects/commands.cfg
#nrpe set
define command{
command_name check_nrpe
command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
还可自行添加例如:
#ntp set
define command{
command_name check_ntp
command_line /usr/local/nagios/libexec/check_ntp -H $HOSTADDRESS
}

7、nrpe监控的模版
[root@localhost ~]# vim /usr/local/nagios/etc/nrpe.cfg
(默认有下面四个命令)
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
可以添加,例如:
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
command[check_mem]=/usr/local/nagios/libexec/check_mem -w 80% -c 90%
command[check_gwapp_cm]=/usr/local/nagios/libexec/check_gwapp_cm
command[check_gwapp_cu]=/usr/local/nagios/libexec/check_gwapp_cu
command[check_gwapp_cnn]=/usr/local/nagios/libexec/check_gwapp_cnn

8、如何使用nrpe监控
在services.cfg里面添加服务“check_command check_nrpe!check_load
”即可,例:
define service {
host_name Nagios-Server
service_description check_load
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_load
}

五、检测主机是否存活
1、配置文件概述
如果安装上面的步骤,安装完成后,配置文件在安装时放在了/usr/local/nagios/etc/目录下
[root@localhost ~]# cd /usr/local/nagios/
[root@localhost nagios]#l1
-rw-rw-r-- 1 nagios nagios 11408 08-30 11:55 cgi.cfg (CGI配置文件)
-rw-r--r-- 1 root root 26 08-30 11:56 htpasswd.users (Apache的验证密码文件)
-rw-rw-r-- 1 nagios nagios 43776 08-30 11:55 nagios.cfg (主配置文件)
drwxrwxr-x 2 nagios nagios 4096 08-30 11:55 objects (对象定义文件目录)
-rw-rw---- 1 nagios nagios 1340 08-30 11:55 resource.cfg (资源配置文件)
我们修要修改的的是nagios.cfg 和 objects 目录下的文件,来检测主机是否存活。

2、主配置文件nagios.cfg的配置
主配置文件的内容很多,对于这个版本,我们需要修改和添加的主要是对象配置文件,即:cfg_file=
cfg_file=/usr/local/nagios/etc/objects/commands.cfg (命令定义文件)
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg (联系人信息定义文件)
cfg_file=/usr/local/nagios/etc/objects/contactgroups.cfg (添加此行 联系人组定义文件)
cfg_file=/usr/local/nagios/etc/objects/hosts.cfg (添加此行 主机定义文件)
cfg_file=/usr/local/nagios/etc/objects/hostgroups.cfg (添加此行 主机组定义文件)
cfg_file=/usr/local/nagios/etc/objects/services.cfg (添加此行 服务定义文件)
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg (时间周期定义文件)
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
# Definitions for monitoring the local (Linux) host
#cfg_file=/usr/local/nagios/etc/objects/localhost.cfg (注释掉此行)

3、主机定义文件的配置
[root@localhost etc]# vi objects/hosts.cfg
define host{
            host_name Nagios-Server
            alias Nagios Server
            address 192.168.0.11
            check_command check-host-alive
            check_interval 5
            retry_interval 1
            max_check_attempts 5
            check_period 24x7
            process_perf_data 0
            retain_nonstatus_information 0
            contact_groups sagroup
            notification_interval 30
            notification_period 24x7
            notification_options d,u,r
          }
define host{
            host_name Linux-Server
            alias Test Server
            address 192.168.0.10
            check_command check-host-alive
            check_interval 5
            retry_interval 1
            max_check_attempts 5
            check_period 24x7
            process_perf_data 0
            retain_nonstatus_information 0
            contact_groups sagroup
            notification_interval 30
            notification_period 24x7
            notification_options d,u,r
          }
define host{
            host_name Win-Server
            alias Test Server
            address 192.168.0.9
            check_command check-host-alive
            check_interval 5
            retry_interval 1
            max_check_attempts 5
            check_period 24x7
            process_perf_data 0
            retain_nonstatus_information 0
            contact_groups sagroup
            notification_interval 30
            notification_period 24x7
            notification_options d,u,r
          }

4、主机组定义文件的配置
[root@localhost etc]# vi objects/hostgroups.cfg
define hostgroup {
hostgroup_name System-Admin
alias system Admin
members Nagios-Server,Linux-Server,Win-Server
}
在“members”后面添加以逗号分割。

5、服务定义文件的配置
[root@localhost etc]# vi objects/services.cfg
#--------------------------Nagios-Server----------------------------------#
define service {
host_name Nagios-Server
service_description check-host-alive
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check-host-alive
}
define service {
host_name Nagios-Server
service_description check-ssh
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_ssh
}
define service {
host_name Nagios-Server
service_description check_load
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_load
}
define service {
host_name Nagios-Server
service_description check_mem
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_mem
}
define service {
host_name Nagios-Server
service_description check_users
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_users
}
define service {
host_name Nagios-Server
service_description check_total_procs
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_total_procs
}
define service {
host_name Nagios-Server
service_description check_zombie_procs
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_zombie_procs
}
#--------------------------Linux-Server----------------------------------#
define service {
host_name Linux-Server
service_description check-host-alive
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check-host-alive
}
define service {
host_name Linux-Server
service_description check-ssh
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_ssh
}
define service {
host_name Linux-Server
service_description check_load
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_load
}
define service {
host_name Linux-Server
service_description check_mem
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_mem
}
define service {
host_name Linux-Server
service_description check_users
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_users
}
define service {
host_name Linux-Server
service_description check_total_procs
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_total_procs
}
define service {
host_name Linux-Server
service_description check_zombie_procs
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nrpe!check_zombie_procs
}

6、联系人定义文件配置
define contact{
contact_name nagiosadmin
use generic-contact
alias Nagios Admin
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-email  这个命令在command.cfg中定义
host_notification_commands notify-host-by-email        这个命令在command.cfg中定义
email 187101*****@139.com
}

7、联系组定义文件配置
[root@localhost etc]# vi objects/contactgroups.cfg
define contactgroup {

contactgroup_name sagroup
alias system administrator group
members nagiosadmin
}

8、修改目录的所有者
[root@localhost etc]# chown -R nagios:nagios objects/

9、检测配置文件是否正确
[root@localhost etc]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Total Warnings: 0
Total Errors: 0  
如果都是0说明配置成功了,如果有错误,可根据提示信息查找相关错误。

10、启动Nagios服务
[root@localhost etc]# service httpd start
[root@localhost etc]# service nagios start
在浏览器输入网址:http://192.168.0.11/nagios/

六、Nagios监控Linux客户端的配置
1、添加Nagios用户
[root@localhost ~]# useradd -s /sbin/nologin nagios

2、安装Nagios插件nagios-plugin
Nagios-plugin插件提供了很多监控的模版,也可以自己手写。
[root@localhost ~]# tar xvf nagios-plugins-1.4.14.tar.gz -C /usr/local/src/
[root@localhost ~]# cd /usr/local/src/nagios-plugins-1.4.14/
[root@localhost nagios-plugins-1.4.14]# ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios  --with-nagios-group=nagios
[root@localhost nagios-plugins-1.4.14]# make && make install

3、安装nrpe
[root@localhost ~]# tar xvf nrpe-2.12.tar.gz -C /usr/local/src/
[root@localhost ~]# cd /usr/local/src/nrpe-2.12/
[root@localhost nrpe-2.12]# ./configure
[root@localhost nrpe-2.12]# make all
[root@localhost nrpe-2.12]# make install-plugin
[root@localhost nrpe-2.12]# make install-daemon
[root@localhost nrpe-2.12]# make install-daemon-config
[root@localhost nrpe-2.12]# make install-xinetd

4、配置npre
[root@localhost nrpe-2.12]# vim /etc/xinetd.d/nrpe
# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
        flags           = REUSE
        socket_type     = stream
        port            = 5666
        wait            = no
        user            = nagios
        group           = nagios
        server          = /usr/local/nagios/bin/nrpe
        server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
        log_on_failure  += USERID
        disable         = no
        only_from       = 127.0.0.1 192.168.0.10 192.168.0.9
}
在only_from 添加监控服务器主机的IP地址。

5、添加端口
[root@localhost nrpe-2.12]# vim /etc/services  最后
nrpe 5666/tcp #nrpe

6、重新启动xinetd服务
[root@localhost nrpe-2.12]# service xinetd restart
[root@localhost nrpe-2.12]# netstat -anplt | grep 5666 | grep -v grep
tcp        0      0 0.0.0.0:5666                0.0.0.0:*                   LISTEN      23187/xinetd     

7、修改文件的所有者
[root@localhost ~]# chown -R nagios:nagios /usr/local/nagios
[root@localhost ~]# /etc/init.d/xinetd restart

七、Nagios监控Windows客户端
1、监控服务器的配置
对与Nagios监控服务器不需要什么其它的配置,添加services.cfg即可。
监控Windows 2003 Server的配置 例:
#-------------------------Win-Server----------------------------------------#
define service {
host_name Win-Server
service_description System Load
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nt!CPULOAD!-l 5,80,90
}
define service {
host_name Win-Server
service_description Memory Usage
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nt!MEMUSE!-w 80 -c 90
}
define service {
host_name Win-Server
service_description Disk-C Usage
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
define service {
host_name Win-Server
service_description Disk-D Usage
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups sagroup
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check_nt!USEDDISKSPACE!-l d -w 80 -c 90
}

2、监控客户端的配置
安装NSClient++
http://sourceforge.net/projects/nscplus/
下载后,双击运行即可,安装时会提示输入Nagios服务器的IP地址,安装完成后选中启动服务即可。
file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/ksohtml/wps_clip_image-20862.png
注:红色方块内填写Nagios监控服务器的IP地址。

3、效果图
file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/ksohtml/wps_clip_image-8418.png
file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/ksohtml/wps_clip_image-32331.png
八、nagios配置信息讲解
1、Nagios主机配置
  1.主机的配置:故名思议把需要监控的主机放在该文件里,在Nagios的监控界面上就会存在这些主机,当然,还有一
些其它的设置:
  
define host{
             host_name Nagios-Server #设置主机的名字,该名字会出现在hostgroups.cfg和services.cfg中。
             alias Nagios Server     #一个别名而已
             address 192.168.0.11   #被监控主机的IP地址
             check_command check-host-alive  #检查的命令
             check_interval 1        #检查的时间间隔
             retry_interval 1
             max_check_attempts 5
             check_period 24x7       #检查的时间段,一般的服务器都是7x24
             process_perf_data 0
             retain_nonstatus_information 0
             contact_groups sagroup  #设置联系人组,当该主机出现了报警信息,就发信息给这个组
             notification_interval 10  #提醒的时间间隔,这个单位是分钟哦,看过一些文档写是秒,用够就知道了。
             notification_period 24x7   #提醒的时间段
             notification_options d,u,r
}

2、主机组的配置
   分组是很有必要的,可以根据操作系统类型,功能、区域等等很多进行有效的分组,才能达到预期的目的。
define hostgroup {
                      hostgroup_name System-Admin  #组名字,可以根据应用调整
                      alias system Admin
                      members Nagios-Server,Linux-Server,Win-Server

#组成员用逗号隔开,这里的组成员是hosts.cfg定义的“host_name”这个的值。

3、服务的配置
服务的配置是很重要的,也是配置最多的地方,对与每个主机要监控的服务,都在这个文件中列出,
还好的是并不复杂,只需修改“host_name”、“service_description、check_command”等一些字段。
  
define service {
               host_name         Nagios-Server         #主机名字,hosts.cfg中定义的
               service_description check-host-alive    #所监控服务的描述,至于怎么描述合理,就只有发挥你的主   
                                                        观能动性了。
               check_period 24x7     #检查的时间段
               max_check_attempts 4
               normal_check_interval 3
               retry_check_interval 2
               contact_groups sagroup
               notification_interval 10
               notification_period 24x7     #提醒的时间段
               notification_options w,u,c,r  #在这四种情况下,通知联系人。
               check_command check-host-alive   #检查的命令,在command.cfg中定义
                }
    w—报警(warning)
    u—未知(unkown)
    c—严重(critical)
    r—从异常情况恢复正常

4、联系人的配置
  联系人,顾名思义就是管理员了,根据值班的时间定义了。
  
    define contact{
                   contact_name nagiosadmin  #联系人的名字
                   alias Nagios Admin   #别名
                   service_notification_period 24x7  #服务报警的时间段
                   host_notification_period 24x7     #主机报警的时间段
                   service_notification_options w,u,c,r #同上,就是在这四种情况下报警。
                   host_notification_options d,u,r  #同上。
                   service_notification_commands notify-service-by-email  #服务报警发消息的命令,在command.cfg中定义。
                   host_notification_commands notify-host-by-email  #主机报警发消息的命令,在command.cfg中定义。
                   email 187101*****@139.com  #给谁发email呢。
            }

5、联系人组配置
  联系组,定义哪些联系人分为一个组。
  
define contactgroup {   
                    contactgroup_name sagroup    #组名称
                    alias system administrator group  #组别名
                    members nagiosadmin  #组成员
        }





运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-663647-1-1.html 上篇帖子: nagios监控错误 (Return code of 127 is out of bounds ...) 下篇帖子: nagios_server和client(nagios监控)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表