Question

Linux open files monitoring failing with os-linux-ssh template

  • 1 February 2024
  • 11 replies
  • 215 views

Userlevel 1
Badge +5

Hello,

Openfiles monitoring failing due to authentication issue. Error - 

Status information

UNKNOWN: command execution error [exit code: 127]

When trying the command i get below error: 

# /usr/lib/centreon/plugins/centreon_linux_ssh.pl --plugin=os::linux::local::plugin --mode=open-files --hostname='x.x.x.x' --ssh-backend='libssh' --ssh-username='admin'--ssh-password='******' --ssh-port='22'
UNKNOWN: auth issue: pubkey issue

 

Manual ssh to the server works fine from poller. 
Please assist. 


11 replies

Userlevel 5
Badge +11

Hello,

When you tried to connect to your host from your poller through SSH, did you try the connection as the user ‘centreon-engine’?

 

Userlevel 4
Badge +13

Please note 

 

 --ssh-password
            Define the password associated with the user name. Cannot be
            used with the sshcli backend. Warning: using a password is not
            recommended. Use --ssh-priv-key instead.

 

Also do you you have a space between username and password

[centreon-engine@CC-2304-Central ~]$ /usr/lib/centreon/plugins/centreon_linux_ssh.pl --plugin=os::linux::local::plugin --mode=open-files --hostname='localhost' --ssh-backend='libssh' --ssh-username='centreon' --ssh-password='centreon' --ssh-port='22'
OK: current open files: 202 | 'system.files.open.count'=202;;;0;

[centreon-engine@CC-2304-Central ~]$ /usr/lib/centreon/plugins/centreon_linux_ssh.pl --plugin=os::linux::local::plugin --mode=open-files --hostname='localhost' --ssh-backend='libssh' --ssh-username='centreon'--ssh-password='centreon' --ssh-port='22'
UNKNOWN: auth issue: Access denied for 'publickey'. Authentication that can continue: publickey,gssapi-keyex,gssapi-with-mic

 

 

Userlevel 1
Badge +5

No, I am not using the centreon-engine user. I have a predefined user for ssh to all my machines for monitoring needs and i am using the same. SSH connection using that user is working fine. 

Userlevel 5
Badge +11

Okay but what i mean is when you tried your manual SSH connection from the poller, which poller’s user you used

When Centreon execute plugins (like centreon_linux_ssh.pl), it does as centreon-engine s o to reproduce the exact condition of Centreon execution, you need to test your command as centreon-engine , even if you connect remotely to your host as another user 🙂

Like this

#On your Poller
su centreon-engine

ssh admin@x.x.x.x
#OR
/usr/lib/centreon/plugins/centreon_linux_ssh.pl --plugin=os::linux::local::plugin --mode=open-files --hostname='x.x.x.x' --ssh-backend='libssh' --ssh-username='admin' --ssh-password='******' --ssh-port='22'

 

Also, as said @ponchoh, don’t forget the space between your username and password parameter, it seems there is not in the command you gave us (and i got the same error as you when i remove this space)

Userlevel 1
Badge +5

I get the same error as in the centreon gui 

 

[root@~]# su centreon-engine
bash-4.4$
bash-4.4$ /usr/lib/centreon/plugins/centreon_linux_ssh.pl --plugin=os::linux::local::plugin --mode=open-files --hostname='x.x.x.x' --ssh-backend='libssh' --ssh-username='admin' --ssh-password='******' --ssh-port='22'
UNKNOWN: command execution error [exit code: 127]

Userlevel 5
Badge +11

Okay, and did you try the manual SSH connection too, as centreon-engine on your poller?

 

Userlevel 1
Badge +5

Yes manual ssh connection works from centreon-engine on poller to the host. 

Userlevel 4
Badge +13

more questions:

  1. when you do an ssh connection does it ask for username and password?
    1. if not we need to provide the keys to the script
  2. can you run the command with “--verbose --debug”
  3. owner and rights for “ll  /usr/lib/centreon/plugins/centreon_linux_ssh.pl”
    1. “-rwxrwxr-x 1 root root”
  4. can you ssh into the host and run:
    1. “lsof -a -d ^mem -d ^cwd -d ^rtd -d ^txt -d ^DEL 2>&1”
      1. does it work?
    2. https://github.com/centreon/centreon-plugins/blob/develop/src/os/linux/local/mode/openfiles.pm#L94
  5. do we need more questions? 😅😂😉
Userlevel 1
Badge +5

Now I have a different error. Direct ssh works but when i use the centreon_linux_ssh.pl to connect, I get

UNKNOWN: auth issue: pubkey issue
 

Userlevel 4
Badge +13

Possibly you are using some other user than cenrteon-engine? can you confirm you can do the ssh through your centreon-engine?

su - centreon-engine

ssh …..

or the cenrteon command

 

[UPDATE]

in this case is not enjoying your keys, have you confirmed login without username/password but with keys?

🤔

Userlevel 1
Badge +5

No I am using basic username password and not keys. Anyways thanks for your inputs but i am moving to snmp based template monitoring. the ssh based monitoring is too complicated. 

Reply