I installed Nagios on a Ubuntu Desktop (Nagios server) and I want to monitor a Ubuntu server instance (monitored client). I can connect via SSH between both machines and SSH is not blocked. The nagios standard services such as PING, and check_users work, but check_ssh remains in an UNKNOWN state from the very beginning. The state information delivers "Usage: " which is an indicator that the parameters are wrong.
I can execute the check manually, at the nagios server (Ubuntu Desktop)
/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
and also at the host (Ubuntu Server)
/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
This is the host configuration:
define host {
use linux-server
host_name backup
alias Backup Server
address 192.168.0.2
register 1
}
The configuration of the host is standard:
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
}
I also tried adding the IP of the host manually:
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
}
What am I missing here?
What I also tried based on the hints
Based on the comment of Dan I could figure out that the service actually tries to submit the parameters in this configuration:
ssh_check $ARG1$ '$HOSTADDRESS$'
Verifying the available ssh_check configuration on my backup system shows these possibilities, however the standard ssh_check command did not work nevertheless.
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$'
}
I further tried to submit the IP address of the backup server as both parameters, but did not suceeed.
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
}
Solution
I could not figure out how to address the service commands defined at the client nagios plugin configuration (/etc/nagios-plugins/config/ssh.cfg ). When I set for instance ssh_check_4, my nagios server complained about an undefined service. I ended up configuring a new service command:
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$'
}
Thanks!