Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Tue Aug 21, 2018 6:35 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: check_by_ssh remote command failed @@@@@@@@@@@@@@@@@
PostPosted: Wed Jun 20, 2018 4:12 am 
Offline

Joined: Tue Jun 08, 2010 9:11 am
Posts: 29
Hello,


I want to graph a counter with cacti, then I wrote a script, when executed manually, the script result is OK.

But when executed by cacti , the returned error is
Quote:
06/20/2018 11:00:06 AM - CMDPHP: Poller[0] Host[47] DS[507] CMD: perl /usr/share/cacti/scripts/check_VLNXDIAP_working_users.pl 128.1.110.206, output: Remote command execution failed: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


It sounds after some research on the net, it's related with a known_host problem, I suppressed my remote server in the known_host file (on my NAGIOS server) and re-populated it but still the same message.

Thanks.


Top
 Profile  
 
 Post subject: Re: check_by_ssh remote command failed @@@@@@@@@@@@@@@@@
PostPosted: Thu Jun 21, 2018 5:40 pm 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 1340
It would really depend on what your script is doing. However, to test properly, I would use root account, then issue
Code:
sudo -u <website user> perl /usr/share/cacti/scripts/check_VLNXDIAP_working_users.pl 128.1.110.206

Replace website user with apache, www-data or whatever user your website actually uses.

_________________
Cacti Resources:
Cacti Website
Cacti Issues
Cacti Releases

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
 Post subject: Re: check_by_ssh remote command failed @@@@@@@@@@@@@@@@@
PostPosted: Tue Jun 26, 2018 4:51 am 
Offline

Joined: Tue Jun 08, 2010 9:11 am
Posts: 29
For cacti user, the command fails

Code:
[[email protected] scripts]#  sudo -u cacti perl check_VLNXDIAP_working_users.pl 128.1.110.206
Remote command execution failed: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


But for nagios user, it's OK

Code:
[[email protected] scripts]#  sudo -u nagios perl check_VLNXDIAP_working_users.pl 128.1.110.206
30


Then why do I have in the /var/log/cacti/cacti.log file the following:

Quote:
06/26/2018 11:45:06 AM - CMDPHP: Poller[0] Host[47] DS[507] CMD: perl /usr/share/cacti/scripts/check_VLNXDIAP_working_users.pl 128.1.110.206, output: Remote command execution failed: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


Top
 Profile  
 
 Post subject: Re: check_by_ssh remote command failed @@@@@@@@@@@@@@@@@
PostPosted: Tue Jun 26, 2018 6:13 am 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 1340
Do you have the SSH keys install in the .ssh folder of the home directory of the cacti user? Has the remote host SSH public key changed?

Try doing the following:
sudo -u cacti ssh [email protected]

If you normally have the remote user specified in the script, change the second "cacti" to that user.

_________________
Cacti Resources:
Cacti Website
Cacti Issues
Cacti Releases

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
 Post subject: Re: check_by_ssh remote command failed @@@@@@@@@@@@@@@@@
PostPosted: Thu Jun 28, 2018 3:38 am 
Offline

Joined: Tue Jun 08, 2010 9:11 am
Posts: 29
First: I do not remember the cacti password, then can I change the password without impacting all my graphs monitored ?

Second: I updated /usr/share/cacti/.ssh/knwon_hosts . If I run
Code:
sudo -u cacti ssh [email protected]
, it's connecting to the remote server after entering nagios password, but now the message in the cacti log is:

Code:
06/28/2018 10:30:06 AM - CMDPHP: Poller[0] Host[47] DS[507] CMD: perl /usr/share/cacti/scripts/check_VLNXDIAP_working_users.pl 128.1.110.206, output: Remote command execution failed: Permission denied, please try again.


Top
 Profile  
 
 Post subject: Re: check_by_ssh remote command failed @@@@@@@@@@@@@@@@@
PostPosted: Thu Jun 28, 2018 2:33 pm 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 1340
You should not need to enter a password if you have a valid SSH key.

_________________
Cacti Resources:
Cacti Website
Cacti Issues
Cacti Releases

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
 Post subject: Re: check_by_ssh remote command failed @@@@@@@@@@@@@@@@@
PostPosted: Fri Jul 13, 2018 2:34 am 
Offline

Joined: Tue Jun 08, 2010 9:11 am
Posts: 29
My keys are valid since the following commands run perfectly:

Code:
[[email protected] scripts]# sudo -u nagios ssh [email protected]
Last login: Fri Jul 13 09:27:29 2018 from glnxngios.mydomain.com
[[email protected] ~]$


And normaly, it's the nagios user who's sending commands to the remote computer and not the cacti user.


Top
 Profile  
 
 Post subject: Re: check_by_ssh remote command failed @@@@@@@@@@@@@@@@@
PostPosted: Fri Jul 13, 2018 9:00 am 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 1340
If the keys are in the home folder of the nagios user under .ssh and the folder/key files are all set to 600 then it should work as advertised. Are you sure that the script is running as that user and connecting using the same details (eg, ip if your using IP or name if your using a name)?

_________________
Cacti Resources:
Cacti Website
Cacti Issues
Cacti Releases

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group