gpt4 book ai didi

linux - Nagios:NRPE:无法读取输出

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:26:32 27 4
gpt4 key购买 nike

我在同一台服务器(CentOs 7)上安装了 Nagios 和 NRPE 插件。

check_disk 等预装服务工作正常,但我手动安装的插件总是出现以下错误:

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_cpu -a 20 10
NRPE: Unable to read output

/usr/local/nagios/etc/objects/localhost.cfg:

define service{
use local-service
host_name localhost
service_description CPU
check_command check_cpu!20!10
notifications_enabled 0
}

/usr/local/nagios/etc/objects/commands.cfg

define command {
command_name check_cpu
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_cpu -t 30 -a $ARG1$ $ARG2$
}

/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_disk]=/usr/local/nagios/libexec/check_disk -w 20 -c 10
command[check_procs]=/usr/local/nagios/libexec/check_procs -w 30 -c 200
command[check_cpu]=/usr/local/nagios/libexec/check_cpu_perf.sh -w $ARG1$ -c $ARG2$
command[check_procs_cron]=/usr/local/nagios/libexec/check_procs -a cron
command[check_mem]=/usr/local/nagios/libexec/check_mem_ng.sh -w $ARG1$ -c $ARG2$

输出消息.log

Nov 29 19:52:03 localhost xinetd[25346]: START: nrpe pid=25575 from=::ffff:127.0.0.1
Nov 29 19:52:03 localhost nrpe[25575]: INFO: SSL/TLS initialized. All network traffic will be encrypted.
Nov 29 19:52:03 localhost xinetd[25346]: EXIT: nrpe status=0 pid=25575 duration=0(sec)

附加信息:

/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
}

来自 netstat -at | 的输出grep nrpe:

tcp        0      0 localhost:51424         localhost:nrpe          TIME_WAIT
tcp6 0 0 [::]:nrpe [::]:* LISTEN

有没有人有提示?谢谢

最佳答案

在命令配置文件/usr/local/nagios/etc/objects/commands.cfg而不是 $USER1$ 尝试使用绝对路径 - /usr/local/nagios/libexec/

重启Nagios服务并检查。

我在你的问题中发现的另一件事是你说“check_disk 工作正常,但我手动安装的插件总是以错误结束”并且在你的 /usr/local/nagios/etc/nrpe.cfg 文件里面有check_disk 命令的配置 command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 但没有配置check_cpu 命令。因此,当您尝试执行此 /usr/local/nagios/libexec/check_nrpe -H localhost -c check_cpu -a 20 10 时,它实际上会查询您的 nrpe.cfg 文件并发现没有check_cpu命令配置。只需在 nrpe.cfg 文件中为 check_cpu 添加配置,然后它就可以工作了。

关于linux - Nagios:NRPE:无法读取输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33986728/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com