Gerald, I am able to successfully authenticate over ssh.
Output root@mgmt-vikee:~# ssh -i /var/lib/nagios/.ssh/id_rsa nagios@192.168.1.111 -v OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to 192.168.1.111 [192.168.1.111] port 22. debug1: Connection established. debug1: permanently_set_uid: 0/0 debug1: identity file /var/lib/nagios/.ssh/id_rsa type 1 debug1: identity file /var/lib/nagios/.ssh/id_rsa-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 pat OpenSSH_6.6.1* compat 0x04000000 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-sha1-...@openssh.com none debug1: kex: client->server aes128-ctr hmac-sha1-...@openssh.com none debug1: sending SSH2_MSG_KEX_ECDH_INIT debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ECDSA e4:9e:e9:d3:91:75:9f:f9:d4:4a:6d:71:cb:26:e8:62 debug1: Host '192.168.1.111' is known and matches the ECDSA host key. debug1: Found key in /root/.ssh/known_hosts:1 debug1: ssh_ecdsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received ############################################################### # This is a Company owned network system. # # Authorized access only! # # Disconnect IMMEDIATELY if you are not an authorized user!!! # # All actions Will be monitored and recorded # ############################################################### debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /var/lib/nagios/.ssh/id_rsa debug1: Server accepts key: pkalg ssh-rsa blen 279 debug1: key_parse_private2: missing begin marker debug1: read PEM private key done: type RSA debug1: Authentication succeeded (publickey). Authenticated to 192.168.1.111 ([192.168.1.111]:22). debug1: channel 0: new [client-session] debug1: Requesting no-more-sessi...@openssh.com debug1: Entering interactive session. debug1: Sending environment. debug1: Sending env LANG = en_US.UTF-8 Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 4.4.11-grseconprem x86_64) * Documentation: https://help.ubuntu.com/ System information as of Tue Feb 6 19:13:07 UTC 2018 System load: 0.01 Processes: 139 Usage of /: 17.5% of 15.37GB Users logged in: 1 Memory usage: 6% IP address for eth0: 192.168.1.111 Swap usage: 0% IP address for viddertun1: 1.0.0.12 Graph this data and manage this system at: https://landscape.canonical.com/ 114 packages can be updated. 98 updates are security updates. Your Hardware Enablement Stack (HWE) is supported until April 2019. Last login: Tue Feb 6 19:13:07 2018 from 192.168.1.110 debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 debug1: client_input_channel_req: channel 0 rtype e...@openssh.com reply 0 debug1: channel 0: free: client-session, nchannels 1 Connection to 192.168.1.111 closed. Transferred: sent 3676, received 3080 bytes, in 0.3 seconds Bytes per second: sent 14179.6, received 11880.7 debug1: Exit status 1 Regards, Vikee Kumar Ops Team, Vidder India On 07/02/18, 1:57 PM, "icinga-users on behalf of Gerald Vogt" <icinga-users-boun...@lists.icinga.org on behalf of v...@spamcop.net> wrote: On 07.02.18 09:12, Vikee Kumar wrote: > Hi Gerald, > > I run the below command > /usr/bin/ssh -l nagios -i /var/lib/nagios/.ssh/id_rsa \ > 192.168.1.111 "/usr/lib/nagios/plugins/check_dummy 0" > > I got below output > > root@mgmt-vikee:/usr/lib/nagios/plugins# /usr/bin/ssh -l nagios -i /var/lib/nagios/.ssh/id_rsa 192.168.1.111 "/usr/lib/nagios/plugins/check_dummy 0" > ############################################################### > # This is a company owned network system. # > # Authorized access only! # > # Disconnect IMMEDIATELY if you are not an authorized user!!! # > # All actions Will be monitored and recorded # > ############################################################### So here is additional output. And it seems you cannot execute the check on the server either, as there is no "OK" at the end. Run ssh with -v to see if it is actually able to authenticate successfully and also check the server log at 192.168.1.111 for output from the sshd server or pam service. It should tell you why the connection has been refused if so... -Gerald > > > Regards, > > Vikee Kumar > Ops Team, Vidder India > > > > On 07/02/18, 1:37 PM, "Gerald Vogt" <v...@spamcop.net> wrote: > > > > On 07.02.18 09:00, Vikee Kumar wrote: > > Hi All, > > > > I am getting below error while trying to do run check_by_ssh from > > icinga-master to client. > > > > PFA attached Image of scenario what I want to do. > > > > root@mgmt-vikee:/var/lib/nagios# /usr/lib/nagios/plugins/check_by_ssh -H > > 192.168.1.111 -l nagios -i /var/lib/nagios/.ssh/id_rsa -C > > "/usr/lib/nagios/plugins/check_dummy 0" > > > > Remote command execution failed: > > ############################################################### > > > > root@mgmt-vikee:/var/lib/nagios# /usr/lib/nagios/plugins/check_by_ssh -H > > 192.168.1.111 -l nagios -i /var/lib/nagios/.ssh/id_rsa -C > > "/usr/lib/nagios/plugins/check_dummy 0" -vvv > > > > Command: /usr/bin/ssh > > > > Argument 1: -l > > > > Argument 2: nagios > > > > Argument 3: -i > > > > Argument 4: /var/lib/nagios/.ssh/id_rsa > > > > Argument 5: 192.168.1.111 > > > > Argument 6: /usr/lib/nagios/plugins/check_dummy 0 > > Well, run exactly the command it shows you and you should see the error: > > /usr/bin/ssh -l nagios -i /var/lib/nagios/.ssh/id_rsa \ > 192.168.1.111 "/usr/lib/nagios/plugins/check_dummy 0" > > -Gerald > > > > > Remote command execution failed: > > ############################################################### > > > > Regrads, > > > > Vikee kumar > > > > > > > > _______________________________________________ > > icinga-users mailing list > > icinga-users@lists.icinga.org > > https://lists.icinga.org/mailman/listinfo/icinga-users > > > _______________________________________________ > icinga-users mailing list > icinga-users@lists.icinga.org > https://lists.icinga.org/mailman/listinfo/icinga-users > > > _______________________________________________ > icinga-users mailing list > icinga-users@lists.icinga.org > https://lists.icinga.org/mailman/listinfo/icinga-users > _______________________________________________ icinga-users mailing list icinga-users@lists.icinga.org https://lists.icinga.org/mailman/listinfo/icinga-users _______________________________________________ icinga-users mailing list icinga-users@lists.icinga.org https://lists.icinga.org/mailman/listinfo/icinga-users