Page 2 of 3

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

Posted: Thu Jun 28, 2018 2:54 am
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;

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

Posted: Thu Jun 28, 2018 7:19 am
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"

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

Posted: Thu Jun 28, 2018 8:43 am
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"
[email protected]'s password:
43

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

Posted: Thu Jun 28, 2018 8:56 am
by scottwilkerson
Your script cannot enter the password though
you need to setup ssh keys for the cacti user

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

Posted: Thu Jun 28, 2018 8:57 am
by scottwilkerson
e.g.

Code: Select all

su cacti
ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

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

Posted: Thu Jun 28, 2018 9:32 am
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 ?

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

Posted: Thu Jun 28, 2018 9:37 am
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 [email protected]

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

Posted: Thu Jun 28, 2018 10:25 am
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

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

Posted: Thu Jun 28, 2018 10:33 am
by scottwilkerson
you may have to

Code: Select all

sudo su cacti
I am presuming the cacti user executes the command correct?

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

Posted: Thu Jun 28, 2018 10:38 am
by yellowdog
The same:

Code: Select all

sudo su cacti
This account is currently not available.