check_by_ssh remote command failed @@@@@@@

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
yellowdog
Posts: 20
Joined: Mon Dec 02, 2013 7:22 am

Re: check_by_ssh remote command failed @@@@@@@

Post by yellowdog »

Here is the code.

Code: Select all

#!/usr/bin/perl

$response=`/usr/lib/nagios/plugins/check_by_ssh  -H $ARGV[0]  -l nagios -t 30 -C "/Outils/nagios_sh/check_diapason_users.sh"`;
print $response;
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_by_ssh remote command failed @@@@@@@

Post by scottwilkerson »

Can you run this as the cacti user?

Code: Select all

/usr/lib/nagios/plugins/check_by_ssh  -H 128.1.110.206  -l nagios -t 30 -C "/Outils/nagios_sh/check_diapason_users.sh"
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
yellowdog
Posts: 20
Joined: Mon Dec 02, 2013 7:22 am

Re: check_by_ssh remote command failed @@@@@@@

Post by yellowdog »

It's working after nagios password set.

Code: Select all

 sudo -u cacti  /usr/lib/nagios/plugins/check_by_ssh  -H 128.1.110.206  -l nagios -t 30 -C "/Outils/nagios_sh/check_diapason_users.sh"
nagios@128.1.110.206's password:
43
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_by_ssh remote command failed @@@@@@@

Post by scottwilkerson »

Your script cannot enter the password though
you need to setup ssh keys for the cacti user
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_by_ssh remote command failed @@@@@@@

Post by scottwilkerson »

e.g.

Code: Select all

su cacti
ssh-copy-id -i ~/.ssh/id_rsa.pub nagios@128.1.110.206
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
yellowdog
Posts: 20
Joined: Mon Dec 02, 2013 7:22 am

Re: check_by_ssh remote command failed @@@@@@@

Post by yellowdog »

I don't understand, I believed it's the nagios user who's executing programs on the remote computers and not cacti.

I don't remember cacti's password, how can I reset it and may I have some problems with my graphs already working ?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_by_ssh remote command failed @@@@@@@

Post by scottwilkerson »

if you enter this on your cacti server you will become the cacti user

Code: Select all

su cacti
Then when you enter this, you are connecting to 128.1.110.206 as nagios, it wants nagios user password

Code: Select all

ssh-copy-id -i ~/.ssh/id_rsa.pub nagios@128.1.110.206
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
yellowdog
Posts: 20
Joined: Mon Dec 02, 2013 7:22 am

Re: check_by_ssh remote command failed @@@@@@@

Post by yellowdog »

Code: Select all

su cacti
This account is currently not available.
Sounds normal because in /etc/passwd it's like this:

Code: Select all

cacti:x:103:104::/usr/share/cacti:/sbin/nologin
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_by_ssh remote command failed @@@@@@@

Post by scottwilkerson »

you may have to

Code: Select all

sudo su cacti
I am presuming the cacti user executes the command correct?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
yellowdog
Posts: 20
Joined: Mon Dec 02, 2013 7:22 am

Re: check_by_ssh remote command failed @@@@@@@

Post by yellowdog »

The same:

Code: Select all

sudo su cacti
This account is currently not available.
Locked