Announcement

Collapse
No announcement yet.

Check By SSH

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Check By SSH

    Bonjour,

    J'ai réalisé une architecture distribuée avec des collecteurs satellite distant sur différents sites.
    L'échange d'information se passe bien entre mes collecteurs et mon central via les IP publique.
    J'aimerai surveiller mes collecteurs comme s'ils étaient des hôte à partir du Central pour vérifier s'ils communiquent toujours bien via leur IP publique.
    Etant donné que seul le protocole SSH est naté vers mes collecteurs, j'aimerais créer un hôte et checker sa disponibilité par un contrôle du SSH.
    J'ai regardé un peu et, il existerait un plugin check_by_ssh par Nagios. Hors, ce plugin ne semble pas être inclus de base dans Centreon.

    Pourriez-vous m'aider ?

    Merci d'avance

  • #2
    Tu trouveras ton bonheur ci dessous: Preparation

    To be able to use check_by_ssh we need to either use an existing user or add a new one on the remote host. We also need to either create a new ssh-key to use for this or we can use an existing one. In this case we will setup a new user on the remote host and create a new ssh-key to be used only for this purpose. To setup the user on the remote host

    Login to the remote host over ssh as root or as a normal user and get root access.
      1. Create the new user:
        useradd -m -d /home/${REMOTE_HOST_USER} ${REMOTE_HOST_USER}
        A group with the same name as the user name will also be created with the useradd command.
      2. Give the user a password by executing:
        passwd ${REMOTE_HOST_USER}
        You can be disabled later




    Setup the ssh-key On the monitor server

    1. Login on the monitor server as root or as a normal user and become root.
    2. Become the monitor user:
      sudo su - monitor
    3. Create the new ssh-key:
      ssh-keygen -b 4096 -t rsa -C "monitor@$(hostname) user for check_by_ssh" -N "" -f /opt/monitor/.ssh/id_rsa_check_by_ssh

      When you are asked for a passphrase for the new ssh-keys do not add a password, just press Enter.
      Generating public/private rsa key pair.
      Your identification has been saved in /opt/monitor/.ssh/id_rsa_check_by_ssh.
      Your public key has been saved in /opt/monitor/.ssh/id_rsa_check_by_ssh.pub.
      The key fingerprint is:
      50:f7:d2:f6:5e:53:03:5f:7d:25:5a:a2:78:88:65:6e monitor@monitor-server user for check_by_ssh
      The key's randomart image is:
      +--[ RSA 4096]----+
      ...
      +-----------------+



    Now we need to add the public key to the remote host. On the Monitor server:

    For the user we created earlier create the .ssh folder and an authorized_keys file.
    1. Copy the pub key to the remote host
      ssh-copy-id -i /opt/monitor/.ssh/id_rsa_check_by_ssh ${REMOTE_HOST_USER}@${REMOTE_HOST_NAME}
    2. Test the ssh key by connecting over ssh to the remote host:
      asmonitor ssh -i /opt/monitor/.ssh/id_rsa_check_by_ssh ${REMOTE_HOST_USER}@${REMOTE_HOST_NAME}

    As ${REMOTE_HOST_NAME} remember that you need to use the same as you have/will set as "host_address" in the Centreon object configuration.
    Disable password for the user on the remote host (optional)

    If you only want have the possiblity to login as the remote user on the remote hos by using ssh keys, not with password, you can disable the password for the remote user on the remote host. To to do this just execute the following command (as the root user) on the remote host:
    passwd -l ${REMOTE_HOST_USER}
    Logout from the remote host.

    Comment


    • #3
      J'ai le même besoin que toi florianncy. Impossible de trouver trace du plugin check_by_ssh dans les distributions Centreon.
      Distribution actuelle VM 18.10.2

      La seule référence semble provenir des anciennes distribution Nagios.

      Les informations que donnent Coco163 sont celles qui aident à mettre en place la clef publique SSH afin de s'affranchir de la saisie du mot de passe, mais notre question est de trouver une source ou Repository ou se trouve le plugin check_by_ssh !

      Le connecteur centreon_connector_ssh préinstallé dans les distribution fait lui aussi référence à check_by_ssh pour comme client de connection, mais pas plus.
      https://documentation.centreon.com/d...iguration.html


      Si quelqu'un peut nous aiguiller ?

      Comment

      Working...
      X