nrpe

1.客户端命令

check_nrpe -H <host> [ -b <bindaddr> ] [-4] [-6] [-n] [-u] [-p <port>]
[-t <timeout>] [-c <command>] [-a <arglist...>]

-n 不使用 SSL
-u 当检测超时时,返回 UNKNOWN 状态,而不是 CRITICAL 状态;
<host> NRPE 客户端IP
<bindaddr> check_nrpe 检测时使用的本地IP
-4 只使用 ipv4
-6 只使用 ipv6

[port] 客户端NRPE进程的端口,默认为 5666
[timeout] 连接超时时间,默认为 10s;
[command] 远程需要执行的命令;
[arglist] 对远程命令额外增补的选项,会加在远程命令已有参数的后面;

2.服务端配置

log_facility=daemon
# 日志设备

pid_file=/var/run/nrpe/nrpe.pid
# PID 文件位置
# 仅当以root运行且是独立服务模式下有效;

# server_address=127.0.0.1
server_port=5666
# bind到本机的IP和端口
# 在 xinetd 模式下无效

nrpe_user=nrpe
nrpe_group=nrpe
# EUID 和 EGID
# 在 xinetd 模式下无效

allowed_hosts=127.0.0.1
# check_nrpe 服务端的主机名、IP或者网段
# 多个主机之间以","分隔;
# 也可以在 /etc/hosts.allow 中实现同样的效果;

dont_blame_nrpe=0
# 是否允许 check_nrpe 传输参数给远端命令;
# 0 表示关闭,1 表示允许;

allow_bash_command_substitution=0
# 是否将命令传递给 bash 来进行参数扩展、解析和运行;
# 0 表示关闭,1 表示开启;

# command_prefix=/usr/bin/sudo
# 命令前缀;

debug=0
# 是否启用 debug 模式;
# 0 表示关闭,1 表示开启;

command_timeout=60
# 每个命令运行的最长时间长度,之后就会被 nrpe 杀掉;

connection_timeout=300
# 与 check_nrpe 每条连接的最长超时时间;
# 之后就会强制断开;

#allow_weak_random_seed=1
# 随机数来源,主要用于 SSL 链接;
# 0 表示 /dev/[u]random
# 1 表示自己生成,随机性较弱;

#include=<somefile.cfg>
# 包含额外的配置文件;

command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 150 -c 200
# 定义命令
# 格式为 command[<command_name>]=<command_line>
# command[check_users]=/usr/lib64/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
# command[check_load]=/usr/lib64/nagios/plugins/check_load -w $ARG1$ -c $ARG2$
# command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
# command[check_procs]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$

include_dir=/etc/nrpe.d/
# 递归性的导入给定目录下的所有 .cfg 配置文件。

猜你喜欢

转载自www.cnblogs.com/ilinunix/p/12171766.html