Nagios check_service.sh错误redis-server无法识别的服务

我有一个与Nagios监控有关的问题。 我有以下configuration:

在commands.cfg中

define command{ command_name check_service.sh command_line /usr/lib64/nagios/plugins/check_service.sh -o $ARG1$ -t $ARG2$ } 

在服务定义

 define service { use generic-service host_name ARGPLUS_REDIS_SLV service_description Redis Service check_command check_service.sh!linux!"service redis-server status" notifications_enabled 0 } 

我得到以下错误:

当前状态:UNKNOWN(对于0d 0h 0m 17s)状态信息:未知状态:redis-server:无法识别的服务在命令或服务configuration中是否存在拼写错误?:redis-server:无法识别的服务

但是使用相同的configuration,只需更改进程名称即可获得正确的输出

 define service { use generic-service host_name ARGPLUS_REDIS_SLV service_description Redis Service check_command check_service.sh!linux!"service nrpe status" notifications_enabled 0 } 

输出 服务状态信息当前状态:OK(对于0d 0h 24m 20s)状态信息:nrpe(pid 16124)正在运行…

我认为进程名称redis-server的减号正在成为问题。

我认为redis服务也可以使用名称redis来运行。 所以它可能是。

 define service { use generic-service host_name ARGPLUS_REDIS_SLV service_description Redis Service check_command check_service.sh!linux!"service redis status" notifications_enabled 0 } 

确认运行手动检查

  $ ./check_service.sh -o linux -t "service redis status"