Skip to main content
Hello,I'm encountering an error when using the "centreon_linux_ssh" plugin. I want to test whether a folder is present on a remote server (Ubuntu).I get the error message "option '63' requires an argument" from the Centreon interface.However, when testing the command as "centreon-engine," I do get a response.Thank you for your help.Eric

/usr/lib/centreon/plugins//centreon_linux_ssh.pl --plugin=os::linux::local::plugin --mode=cmd-return --hostname='10.X.X.X' --ssh-backend='' --ssh-username='root' --ssh-priv-key='/var/lib/centreon-engine/.ssh/id_ecdsa' --ssh-port=''  --exec-command='ls'  --exec-command-options='/etc/cron.d/montage' --manage-returns='%(code) == 0,CRITIQUE,disque RO#%(code) == 1,UNKNOWN,probleme inconnu#%(code) == 2,OK,disque RW' --verbose --debug


same result with this:
/usr/lib/centreon/plugins//centreon_linux_ssh.pl --plugin=os::linux::local::plugin --mode=cmd-return --hostname='10.XX.XX.XX' --ssh-backend='' --ssh-username='root' --ssh-priv-key='/var/lib/centreon-engine/.ssh/id_ecdsa' --ssh-port='' --exec-command='find' --exec-command-options='/etc/cron.d/montage' --manage-returns='%(code) == 3,OK,disque RW#%(code) == 1,UNKNOWN,probleme inconnu#%(code) == 0,CRITIQUE,disque RO' --verbose --debug

Are you using Centreon’s templates? Do you get any errors on the other checks? does the Host check work? 😊sorry for so many questions, I’ve never seen the 63


Hello,yes, no, and noThis is indeed a first for me; the other models work perfectly.

 


Hello
never seen that too.
can you check your env variables are the same than engine ?
in root, do the following : 

ps -aux | grep centengine find the pid of the process

tr '\0' '\n' <  /proc/<PID>/environ

 

Then you can sudo su centreon-engine and change your env variable to match what you saw in the last command.

if you execute the plugin in this condition do you have the same output as the webapp ?

 

Evan


Hello Evanadam,This is what I get, 
but then I don't know how to modify the "env" variable.

in centreon-engine user, you can copy paste the output of the command you show directly in your terminal, then use the command “env” to list all environment variable, and use the command 

unset variableName to remove every variable not present in your capture. Once you have the same environment variable you can try to execute the plugin again


I think you use the centreon ssh connector for the plugins in check_command configuration . if you disable it normally it will be fine .

 


Hello Sdouce,I deactivated the plugin, replaced "find" with "ls" (it works on others), and the error message is different now:
However, from Centreon Engine, the command returns two different codes: 0 if the "montage" folder exists and "3" if it doesn't.Thank you

Did you test it from centreon-engine user on your poller ? 
Try /bin/ls for the command 
add --sshcli-option='-o=StrictHostKeyChecking=no' 

 


I'm making progress :-)- First attempt without the montage.txt file- Then with it
The variable return value seems correct from Centreon Engine, but from the interface, I still get the message: "execute command failed"

 


 --manage-returns='%(code) == 0,OK,File xxx exist#%(code) == 1,CRITICAL,File xxx not exist#,UNKNOWN,XXXXXXX'

You try to do ‘ls /home/montage.txt’

what apend when you execute from centreon-engine user 

ssh -i /var/lib/centreon-engine/.ssh/id_rsa.pu root@YOUR_IP ‘ls /home/montage.txt’
echo $?

This return code you want to manage to buid your managed-return …. 

PS: Your IP address is readable as well . 

 


1st test with id_rsa.pub2nd test with id_ecdsa

Ok first your id_rsa key should have 0600 right … Sorry you have to connect  with id_rsa not id_rsa.pub

 

And launch : 

ssh -i /var/lib/centreon-engine/.ssh/id_rsa.pu root@YOUR_IP ‘ls /home/montage.txt && /bin/echo $?’
 


1. Test without the "montage.txt" file2. Test with the file

 


no space between $ and ? you have to write echo $? 

 

 


with and without

 


I dont understand this ‘without’ version of command line . 

The firts command line work as well :

  • It show you the result of you ls : /home/montage.txt
  • It show you the return code:  0

  --manage-returns='%(code) == 0,OK,File xxx exist#%(code) == 1,CRITICAL,File xxx not exist#,UNKNOWN,XXXXXXX'

 

The other code you can catch them to do your monitoring

 


Hello,The first line is the output of the command when the "montage.txt" file is created on the server being monitored.The second line is the output without the "montage.txt" file.I do get two different return codes, but from the Centreon interface, the status remains "unknown" instead of changing to "available" or "critical".

 

Hello Sdouce,

When I run the full command from Centreon Engine, everything works correctly. The command returns "0" when the "montage.txt" file is present.

However, from the graphical interface, I still get the message "execute command fail".

 


It seem so you have an environnent variable on your centreon-engine. 
Try to connect on centreon-engine user 

Type env and unset one by one one and execute in commande line 

unset PATH

centreon_linux_ssh.pl --plugin=os::linux::local::plugin --mode=cmd-return --hostn …..

 


I'm afraid I don't quite understand.
Here's the output of "env" from Centreon Engine.