Skip to main content

Linux SSH

Overview​

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds.

Plugin-Pack Assets​

Monitored Objects​

This Plugin-Pack provides assets to monitor all types of Linux based systems with a SSH server enabled:

  • Centos
  • Redhat
  • Debian
  • Ubuntu
  • Fedora
  • ...

Collected Metrics​

Metric nameDescription
cpu.utilization.percentageCPU utilization. Unit : %
core.cpu.utilization.percentageCPU utilization by core. Unit : %

Prerequisites​

SSH configuration​

A user is required to query the OS Linux by SSH. There is no need for root or sudo privileges. There are two possible ways to perform SSH check, either by exchanging the SSH key from centreon-engine to the target server, or by setting your unique user and password directly in the host macros.

Add and generate a password for your user on the Target sever:

adduser ro_ssh_centreon
passwd ro_ssh_centreon

Switch to centreon-engine's bash environment on your Central server and Poller :

su - centreon-engine

Then, copy this key on to the Target server with the following commands:

ssh-keygen -t ed25519 -a 100
ssh-copy-id -i .ssh/id_ed25519.pub ro_ssh_centreon@<IP_TARGET_SERVER>

Installation​

  1. Install the Centreon Plugin on every poller monitoring Linux SSH resources:
yum install centreon-plugin-Operatingsystems-Linux-Ssh.noarch
  1. On the Centreon Web interface in "Configuration > Plugin packs > Manager", install the Linux SSH Plugin-Pack

Configuration​

Add a new Host and apply the Os-Linux-SSH-custom Host Template. Once the template set, you have to set values according to the chosen SSH backend. 3 SSH backends are available to connect to the Linux server: sshcli, plink and libssh which are detailed below.

sshcli backend​

MandatoryNameDescription
XSSHBACKENDName of the backend: sshcli
XSSHUSERNAMEBy default, it uses the user running process centengine on your poller
SSHPASSWORDCannot be used with backend. Only ssh key authentication
SSHPORTBy default: 22
SSHEXTRAOPTIONSCustomize it with your own if needed. E.g.: --ssh-priv-key=/user/.ssh/id_rsa

With that backend, you have to validate the target server fingerprint manually (with the SSHUSERNAME used).

MandatoryNameDescription
XSSHBACKENDName of the backend: plink
XSSHUSERNAMEBy default, it uses the user running process centengine on your poller
SSHPASSWORDCan be used. If not set, SSH key authentication is used
SSHPORTBy default: 22
SSHEXTRAOPTIONSCustomize it with your own if needed. E.g.: --ssh-priv-key=/user/.ssh/id_rsa

With that backend, you have to validate the target server fingerprint manually (with the SSHUSERNAME used).

libssh backend (by default)​

MandatoryNameDescription
XSSHBACKENDName of the backend: libssh
XSSHUSERNAMEBy default, it uses the user running process centengine on your poller
SSHPASSWORDCan be used. If not set, SSH key authentication is used
SSHPORTBy default: 22
SSHEXTRAOPTIONSCustomize it with your own if needed. E.g.: --ssh-priv-key=/user/.ssh/id_rsa

With that backend, you don't have to validate the target server fingerprint manually.

FAQ​

How to check in the CLI that the configuration is OK and what are the main options for ?​

Once the Plugin installed, log into your poller using the centreon-engine user account and test by running the following command :

 /usr/lib/centreon/plugins//centreon_linux_ssh.pl \
--plugin=os::linux::local::plugin \
--mode='cpu' \
--hostname='10.30.2.114' \
--ssh-backend='libssh' \
--ssh-username='myuser' \
--ssh-password='mypassword' \
--ssh-port='22' \
--warning-core='60' \
--critical-core='70' \
--warning-average='60' \
--critical-average='75' \
--verbose \
--use-new-perfdata

OK: CPU(s) average usage is 11.91 % - CPU '0' usage : 11.91 % |
'cpu.utilization.percentage'=11.91%;;;0;100 '0#core.cpu.utilization.percentage'=11.91%;;;0;100
CPU '0' usage : 11.91 %

The check command gives the average CPU of a device using SSH (--mode=CPU). It uses a SSH username centreon (--ssh-username=centreon), a SSH password centreon-password (--ssh-password='centreon-password'), uses a SSH backend libssh (--ssh-backend='libssh') and it connects to the host 10.30.2.114 (--hostname=10.30.2.114) on the SSH default port 22 (---ssh-port=22).

This command will trigger a WARNING alarm if the CPU Average increases to more than 60% (--warning-average='60') and a CRITICAL alarm if more than 75% (--critical-average='75').

Thresholds can be set on all of the device metrics using the syntax --warning-*metric* --critical-*metric*.

All the options that can be used with this plugin can be found over the --help command:

/usr/lib/centreon/plugins//centreon_linux_ssh.pl --plugin=os::linux::local::plugin 
--mode=cpu --help

I have that error message: UNKNOWN: Command error: Host key verification failed.. What does it mean ?​

It means you haven't manually validated the target server fingerprint with ssh or plink on the Centreon poller.