Nagios check_ssh返回使用信息而不是状态

我在Ubuntu桌面(Nagios服务器)上安装了Nagios,我想监视Ubuntu服务器实例(受监视的客户端)。 我可以在两台机器之间通过SSH进行连接,并且不会阻止SSH。 nagios标准服务(如PING和check_users)正常工作,但check_ssh从一开始就保持UNKNOWN状态。 状态信息传递“使用情况:”这是指示参数是错误的。

我可以手动执行检查,在nagios服务器(Ubuntu桌面)

/usr/local/nagios/libexec/check_ssh -H 192.168.0.2 SSH OK - OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3 (protocol 2.0) | time=0,012856s;;;0,000000;10,000000 

并在主机(Ubuntu服务器)

 /usr/lib/nagios/plugins/check_ssh 192.168.0.2 SSH OK - OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3 (protocol 2.0) | time=0.011613s;;;0.000000;10.000000 

这是主机configuration:

 define host { use linux-server host_name backup alias Backup Server address 192.168.0.2 register 1 } 

主机的configuration是标准的:

 define service { host_name backup service_description Check SSH check_command check_ssh max_check_attempts 2 check_interval 2 retry_interval 2 check_period 24x7 check_freshness 1 contact_groups admins notification_interval 2 notification_period 24x7 notifications_enabled 1 register 1 } 

我也尝试手动添加主机的IP:

 define service { host_name backup service_description Check SSH check_command check_ssh!192.168.0.2 max_check_attempts 2 check_interval 2 retry_interval 2 check_period 24x7 check_freshness 1 contact_groups admins notification_interval 2 notification_period 24x7 notifications_enabled 1 register 1 } 

我在这里错过了什么?

我也试过基于提示

基于丹的评论,我可以发现服务实际上试图提交这个configuration中的参数:

 ssh_check $ARG1$ '$HOSTADDRESS$' 

validation备份系统上可用的ssh_checkconfiguration显示了这些可能性,但标准的ssh_check命令不起作用。

 cat /etc/nagios-plugins/config/ssh.cfg # 'check_ssh' command definition define command{ command_name check_ssh command_line /usr/lib/nagios/plugins/check_ssh '$HOSTADDRESS$' } # 'check_ssh_port' command definition define command{ command_name check_ssh_port command_line /usr/lib/nagios/plugins/check_ssh -p '$ARG1$' '$HOSTADDRESS$' } #### # use these checks, if you want to test IPv4 connectivity on IPv6 enabled systems #### # 'check_ssh_4' command definition define command{ command_name check_ssh_4 command_line /usr/lib/nagios/plugins/check_ssh -4 '$HOSTADDRESS$' } # 'check_ssh_port_4' command definition define command{ command_name check_ssh_port_4 command_line /usr/lib/nagios/plugins/check_ssh -4 -p '$ARG1$' '$HOSTADDRESS$' } 

我进一步试图提交备份服务器的IP地址作为两个参数,但没有成功。

 define service { host_name backup service_description Check SSH check_command check_ssh!192.168.0.2!192.168.0.2 max_check_attempts 2 check_interval 2 retry_interval 2 check_period 24x7 check_freshness 1 contact_groups admins notification_interval 2 notification_period 24x7 notifications_enabled 1 register 1 } 

我无法弄清楚如何解决客户端nagios插件configuration(/etc/nagios-plugins/config/ssh.cfg)中定义的服务命令。 当我设置例如ssh_check_4,我的nagios服务器抱怨一个未定义的服务。 我结束了configuration一个新的服务命令:

 define service { host_name backup service_description Check SSH check_command check_ssh_fix max_check_attempts 2 check_interval 2 retry_interval 2 check_period 24x7 check_freshness 1 contact_groups admins notification_interval 2 notification_period 24x7 notifications_enabled 1 register 1 } define command{ command_name check_ssh_fix command_line /usr/lib/nagios/plugins/check_ssh '$HOSTADDRESS$' } 

谢谢!

应该有一个定义的命令“check_ssh”

像这样,例如在Debian / Ubuntu系统上/etc/nagios-plugins/config/ssh.cfg

 define command{ command_name check_ssh command_line /usr/lib/nagios/plugins/check_ssh '$HOSTADDRESS$' } 

所以在默认情况下,hostaddress被传递给命令,除了使用check_ssh以外,没有其他任何check_ssh

我猜你的命令是这样的:

 define command{ command_name check_ssh command_line /usr/lib/nagios/plugins/check_ssh '$HOSTADDRESS$' $ARG1$ } 

为此,将运行以下命令:

 /usr/lib/nagios/plugins/check_ssh '1.2.3.4' 1.2.3.4 

检查nagios-client的版本是否与您的监控系统兼容。 当本地运行正常时,我有类似的问题。 但它没有更新我的监测(centron)。 我将nagios客户端降级到以前的版本,并开始正常工作。