I am testing a check_by_ssh program. I tried to test the command below and have good result.
sheenlim08@Server1:/etc/nagios3/conf.d$
/usr/lib/nagios/plugins/check_by_ssh -H /usr/lib/nagios/plugins/check_by_ssh -H 192.168.114.149 -C "/usr/lib/nagios/plugins/check_ssh -H localhost" -l sheenlim08 -i /home/sheenlim08/.ssh/nag_id_rsa
SSH OK - OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 (protocol 2.0) | time=0.006329s;;;0.000000;10.000000
I then created a custom command /etc/nagios-plugins/config/ssh_check_disk.cfg and defined it below.
define command {
command_name ssh_check_disk
command_line /usr/lib/nagios/plugins/check_by_ssh -H '$HOSTADDRESS$' -C "/usr/lib/nagios/plugins/check_disk -w '$ARG1$' -c '$ARG2$' -e -p '$ARG3$'" -l sheenlim08 -i /home/sheenlim08/.ssh/nag_id_rsa
I then defined the service that will refer to the 'ssh_check_disk' command in my monitoring configuration file for that server.
define service {
use generic-service
host_name H:PH-CDO-Server2
service_description SSH-Check Disk Status
check_command ssh_check_disk!20%!10%!/dev/mapper/ubuntuServer--vg-root
}
Then restarted the nagios service 'sudo invoke-rc.d reload'
However, I get a Host key verification failed. message on the dashboard.
All I could think of is that it is related to the private key not being able to be retrieve when its time nagios calls it, but its there
Any ideas?