欢迎阅读!

潇湘夜雨

当前位置: 主页 > 系统 >

nagios监控部署(一)(8)

时间:2016-09-11 19:44来源:未知 作者:liangzh 点击:
command[check_users]=/usr/local/nagios/libexec/check_users -w 10 -c 20 command[check_load]=/usr/local/nagios/libexec/check_load -w 10,8,5 -c 20,18,15 command[check_zombies]=/usr/local/nagios/libexec/c
command[check_users]=/usr/local/nagios/libexec/check_users -w 10 -c 20
command[check_load]=/usr/local/nagios/libexec/check_load -w 10,8,5 -c 20,18,15
command[check_zombies]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_all_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
 
3、配置监控端
 
1)安装NRPE
 
# tar -zxvf nrpe-2.12.tar.gz
# cd nrpe-2.12.tar.gz
# ./configure --with-nrpe-user=nagios \
     --with-nrpe-group=nagios \
     --with-nagios-user=nagios \
     --with-nagios-group=nagios \
     --enable-command-args \
     --enable-ssl
# make all
# make install-plugin
 ls /usr/local/nagios/libexec/ #查看该目录下是否有check_nrpe插件
 [root@localhost libexec]# ./check_nrpe -H 192.168.47.131 #测试是否可以监控远程主机
NRPE v2.15
 
 
2)定义如何监控远程主机及服务:
 
通过NRPE监控远程Linux主机要使用chech_nrpe插件进行,其语法格式如下:
check_nrpe -H <host> [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]
 
使用示例1:
 
定义监控远程Linux主机swap资源的命令:
define command
{
command_name check_swap_nrpe
command_line $USER1$/check_nrpe –H "$HOSTADDRESS$" -c "check_swap"
}
 
定义远程Linux主机的swap资源:
define service
{
use generic-service
host_name linuxserver1,linuxserver2
hostgroup_name linux-servers
service_description SWAP
check_command check_swap_nrpe
normal_check_interval 30
}
 
使用示例2:
 
如果希望上面的command定义更具有通用性,那么上面的定义也可以修改为如下:
 
定义监控远程Linux主机的命令:
# 'check_nrpe' command definition
define command{
        command_name     check_nrpe
        command_line     $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
        }
定义主机:
define host{
        use             linux-server ; Inherit default values from a template
        host_name       generic-Linux   ; The name we're giving to this host
        alias           generic-Linux    ; A longer name associated with the host
        address         172.18.109.233  ; IP address of the host
}
注意:定义主机是 use和host_name要与template的主机模板相同,没有就在template.cfg中自定义
定义服务:
define service{
        use                      generic-service #服务要与template里定义的名称相同,没有就重新定义服务。
        host_name               generic-Linux
        service_description     Current Load
        check_command           check_nrpe!check_load
        }
定义远程Linux主机的swap资源:
define service
{
use generic-service
host_name linuxserver1,linuxserver2
hostgroup_name linux-servers
service_description SWAP
check_command check_nrpe!check_swap
normal_check_interval 30
}
 
使用示例3:
  (责任编辑:liangzh)
织梦二维码生成器
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------