Skip to content

Instantly share code, notes, and snippets.

@vpnwall-services
Created September 21, 2023 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vpnwall-services/17f7fc4d3340e30aac280dd8ebec1df0 to your computer and use it in GitHub Desktop.
Save vpnwall-services/17f7fc4d3340e30aac280dd8ebec1df0 to your computer and use it in GitHub Desktop.
[Centreon Remote Poller] Centreon Remote Poller #centreon #remote #poller #linux

docs.centreon.com À partir des paquets | Centreon Documentation 6-7 minutes

Centreon fournit des paquets RPM et DEB pour ses produits au travers de la solution Centreon Open Sources disponible gratuitement sur notre dépôt.

Les paquets peuvent être installés sur Alma/RHEL/Oracle Linux 8 et 9 ou Debian 11.

L'ensemble de la procédure d'installation doit être faite en tant qu'utilisateur privilégié.

Lorsque vous lancez une commande, vérifiez les messagez obtenus. En cas de message d'erreur, arrêtez la procédure et dépannez les problèmes.

Prérequis​

Après avoir installé votre serveur, réalisez la mise à jour de votre système d'exploitation via la commande :

Alma / RHEL / Oracle Linux 8
Alma / RHEL / Oracle Linux 9
Debian 11

apt update && apt upgrade

Acceptez toutes les clés GPG proposées et redémarrez votre serveur si une mise à jour du noyau est proposée.

Étape 1 : Pré-installation​ Désactiver SELinux​

Alma / RHEL / Oracle Linux 8
Alma / RHEL / Oracle Linux 9
Debian 11

SELinux n'est pas installé sur Debian 11, continuez. Configurer ou désactiver le pare-feu​

Paramétrez le pare-feu système ou désactivez ce dernier. Pour désactiver ce dernier exécutez les commandes suivantes :

systemctl stop firewalld systemctl disable firewalld

Vous pouvez trouver des instructions ici pour configurer le pare-feu.

Nom du serveur​

Si vous le souhaitez, vous pouvez changer le nom du serveur à l'aide de la commande suivante:

hostnamectl set-hostname new-server-name

Remplacez new-server-name par le nom de votre choix. Exemple:

hostnamectl set-hostname poller1

Installer les dépôts​

RHEL 8
Alma 8
Oracle Linux 8
Alma 9
RHEL 9
Oracle Linux 9
Debian 11

Installez les dépendances suivantes :

apt update && apt install lsb-release ca-certificates apt-transport-https software-properties-common wget gnupg2 curl

Dépôt Centreon​

Afin d’installer les logiciels Centreon à partir des dépôts, vous devez au préalable installer le fichier lié au dépôt.

Exécutez la commande suivante à partir d’un utilisateur possédant les droits suffisants :

Alma / RHEL / Oracle Linux 8
Alma / RHEL / Oracle Linux 9
Debian 11

Pour installer le dépôt Centreon, exécutez la commande suivante :

echo "deb https://packages.centreon.com/apt-standard-23.04-stable/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/centreon.list echo "deb https://packages.centreon.com/apt-plugins-stable/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/centreon-plugins.list

Puis importez la clé du dépôt :

wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 apt update

Étape 2 : Installation​

Pour installer le moteur de supervision, exécutez la commande :

Alma / RHEL / Oracle Linux 8
Alma / RHEL / Oracle Linux 9
Debian 11

apt install -y centreon-poller

Pour activer le démarrage automatique des services de supervision au démarrage du serveur, exécuter la commande suivante :

systemctl enable centreon centengine centreontrapd snmptrapd gorgoned

Les services de supervision passive peuvent être démarrés :

systemctl start centreontrapd snmptrapd gorgoned

Redémarrez Centreon Engine :

systemctl restart centengine

Étape 3 : Enregistrer le serveur​

Pour transformer le serveur en collecteur et l'enregistrer sur le serveur central ou un serveur distant, exécutez la commande suivante sur le futur collecteur :

/usr/share/centreon/bin/registerServerTopology.sh -u <API_ACCOUNT>
-t poller -h <IP_TARGET_NODE> -n <POLLER_NAME>

Exemple:

/usr/share/centreon/bin/registerServerTopology.sh -u admin -t poller -h 192.168.0.1 -n poller-1

Remplacez <IP_TARGET_NODE> par l'adresse IP du serveur Central ou du serveur distant auquel vous voulez rattacher le collecteur (adresse IP vue par le collecteur).

Le compte <API_ACCOUNT> doit avoir accès à l'API de configuration. Vous pouvez utiliser le compte admin.

Vous pouvez changer le port et la méthode HTTP, le format de l'option -h est le suivant : HTTPS://<IP_TARGET_NODE>:PORT

Suivre ensuite les instructions

Saisir le mot de passe :

Please enter the password of 192.168.0.1:

Sélectionner l'adresse IP si plusieurs interfaces réseau existent:

Which IP do you want to use as CURRENT NODE IP ?
1) 192.168.0.2
2) 192.168.0.3
1

Valider les informations:

Summary of the informations that will be send:

Api Connection:
username: admin
password: ******
target server: 192.168.0.1

Pending Registration Server:
name: poller-1
type: poller
address: 192.168.0.2

Do you want to register this server with those information? (y/n): y

Vous recevrez la validation du serveur Centreon central ou du serveur Remote Server :

2020-10-16T17:19:37+02:00 [INFO]: The CURRENT NODE 'poller': 'poller-1@192.168.0.2' linked to TARGET NODE: '192.168.0.1' has been added

Principaux messages d'erreur​

2020-10-20T10:23:15+02:00 [ERROR]: Invalid credentials

Vos informations d'identification sont incorrectes pour le compte <API_ACCOUNT>.

2020-10-20T10:24:59+02:00 [ERROR]: Access Denied.

L'utilisateur <API_ACCOUNT> n'a pas accès à l'API de configuration.

Failed connect to 192.168.0.1:444; Connection refused

Impossible d'accéder à l'API. Contrôler les valeurs <IP_TARGET_NODE>, méthode et port.

2020-10-20T10:39:30+02:00 [ERROR]: Can’t connect to the API using: https://192.168.0.1:443/centreon/api/latest/login

L'URL d'accès n'est pas complète ou invalide. Utilisez l'option --root pour définir le chemin de l'URL de l'API. Par exemple : --root monitoring.

2020-10-20T10:42:23+02:00 [ERROR]: No route found for “POST /centreon/api/latest/platform/topology”

La version Centreon du serveur distant est invalide. Elle doit être supérieure ou égale à 23.04.

Étape 4 : Ajouter le Poller à la configuration​

Rendez-vous au chapitre Ajouter un Poller à la configuration. Étape 5 : Sécuriser votre plateforme​

N'oubliez pas de sécuriser votre plateforme Centreon en suivant nos recommandations

docs.centreon.com Attach a poller to a central or a remote server | Centreon Documentation 5-6 minutes Prerequisites​

Install the poller using packages. Step 1: Configure a new Poller​

As of Centreon version 18.10, a new wizard has been added for adding a new poller to the Centreon platform.

Go to the Configuration > Pollers > Pollers menu and click on Add to configure a new poller.

Select Add a Centreon Poller and click on Next:

image

Select the option you want:
    Create new Poller if you haven't registered the poller yet on the central or remote server
    Select a Poller if you have already registered the poller on the central or remote server.

Type in the name, the IP address of the new poller and IP address of the Central Server. Click on Next:

image

    The IP address of the Poller is the IP address or the FQDN used to access this poller from the Central server.

    The IP address of the Central server is the IP address or the FQDN used to access the Central server from the Poller.

Link the poller to the central server or to a remote server:

If you want to link the poller to the Central Server, click Apply:

image

If you want to link the poller to an existing Remote Server, select one from the list, then click Apply.

    If you want to change the direction of the flow between the Central Server (or the Remote Server) and the Poller, check the Advanced: reverse Centreon Broker communication flow checkbox. In this case, it will be necessary to export the configuration of the poller as well as the server to which it will be attached.

In a few seconds the wizard will configure your new poller.

image

Step 2: Enable communication​

The communication between the Central server and a Poller is ensured by Gorgone and can be done using ZMQ (with a Gorgone running on the Poller, recommended) or using SSH protocol.

Using ZMQ (Recommended)
Using SSH

Select the communication type:

Edit the newly created Poller configuration, and select ZMQ as Gorgone connection protocol. Define the suitable port (port 5556 is recommended).

image

Click on Save.

    Note that the SSH Legacy port is not used anymore and will be removed.

    If you were using it in custom scripts, consider changing to use Gorgone communication system.

Copy the Gorgone configuration:

From the Pollers listing, click on the Display Gorgone configuration action icon on the line corresponding to your Poller image

A pop-in will show the configuration to copy into the Poller terminal. Click on Copy to clipboard.

image

Paste the content of the clipboard directly into the Poller terminal as it contains the following content, and will fill the right file:

cat <<EOF > /etc/centreon-gorgone/config.d/40-gorgoned.yaml
name:  gorgoned-My Poller
description: Configuration for poller My Poller
gorgone:
  gorgonecore:
    id: 2
    external_com_type: tcp
    external_com_path: "*:5556"
    authorized_clients:
      - key: Np1wWwpbFD2I0MdeHWRlFx51FmlYkDRZy9JTFxkrDPI
    privkey: "/var/lib/centreon-gorgone/.keys/rsakey.priv.pem"
    pubkey: "/var/lib/centreon-gorgone/.keys/rsakey.pub.pem"
  modules:
    - name: action
      package: gorgone::modules::core::action::hooks
      enable: true

    - name: engine
      package: gorgone::modules::centreon::engine::hooks
      enable: true
      command_file: "/var/lib/centreon-engine/rw/centengine.cmd"

EOF

Hit the Enter key for the command to be applied.

    You can copy the configuration in a custom file by copying the content from the pop-in.

Restart the Gorgone daemon:

From the Poller, run the following command to restart the Gorgone service:

systemctl restart gorgoned

Make sure it is started by running the following command:

systemctl status gorgoned

It should result as follows:

● gorgoned.service - Centreon Gorgone
  Loaded: loaded (/etc/systemd/system/gorgoned.service; disabled; vendor preset: disabled)
  Active: active (running) since Mon 2020-03-24 19:45:00 CET; 20h ago
Main PID: 28583 (perl)
  CGroup: /system.slice/gorgoned.service
          ├─28583 /usr/bin/perl /usr/bin/gorgoned --config=/etc/centreon-gorgone/config.yaml --logfile=/var/log/centreon-gorgone/gorgoned.log --severity=info
          ├─28596 gorgone-dbcleaner
          ├─28597 gorgone-engine
          └─28598 gorgone-action

Mar 24 19:45:00 localhost.localdomain systemd[1]: Started Centreon Gorgone.

To force the Central's Gorgone daemon to connect to the Poller, restart it with the following command from the Central server:

systemctl restart gorgoned

Step 3: Export the configuration of the remote​

This step only applies if you are attaching a poller to a remote server (not to a central server).

On the central server, deploy the configuration of the remote server to which the poller will be attached:
    Go to Configuration > Pollers > Pollers and select the remote server.
    Click on Export configuration.
    Select the first four boxes, select the Restart method and then click on Export.

Restart gorgone on the remote server:

systemctl restart gorgoned

Step 4: Export the configuration of the poller​

From the Pollers listing, select the Poller and click on Export configuration.

Then check the first four boxes, select the Restart method and click on Export:

image

The Poller's engine will then start and connect to the Broker service of the central server or of the remote server (according to which you have attached the poller to).

image

Getting started​

Go to the Getting Started chapter to configure your first monitoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment