Skip to main content

Prerequisites for pollers installed via a generated command

This page explains how to configure your platform to be able to use pollers installed via a command generated in the interface (whether they are installed on a VM, a physical machine or a container). You only have to perform this procedure once for the whole platform, before you install your first poller this way. It has no impact on the manual deployment mode.

When to use this procedure​

This page describes what to do if the following conditions are met:

  • You have just installed a platform in version 26.10, or upgraded a platform that did not have any pollers in pullwss mode.
  • You want to use pollers installed via a command generated in the interface for the first time (whether they are installed on a VM, a physical machine or a container).

If your platform had pollers in pullwss mode and you now wish to use pollers installed via a command generated in the interface, follow Adapting legacy pullwss poller setups.

Pullwss mode​

By default, the central server initiates the connection to its pollers. However, for example, a poller running in a container cannot accept incoming connections, so this mode does not work.

pullwss mode reverses the direction: the poller opens a WebSocket connection to the central server and keeps it open.

The recomended and secure way is to use HTTPS. This means that certificates are needed to secure the connection. To simplify certificate lifecycle management, Apache (which already hosts the Centreon web interface) is used as a reverse proxy to terminate the TLS connection and forward the traffic to the central server's Gorgone.

Installation requirements​

  • Make sure your container or your host machine meets the poller installation prerequisites.

  • Ensure the central server and Gorgone are already installed and up to date with the latest major version.

  • If not already done, configure HTTPS on your central server. This can be done as part of the installation procedure, or separately.

    Once HTTPS is enabled, also update the Gorgone API URL: in /etc/centreon-gorgone/config.d/31-centreon-api.yaml on the central server, set base_url to https://<central_fqdn>/centreon/api/latest/, then restart Gorgone (systemctl restart gorgoned). Otherwise, the central server rejects this type of pollers with an invalid token error.

  • The poller must be able to reach the central server.

Step 1: Configure Gorgone on the central server​

In previous versions of Centreon, Gorgone could listen for pullwss connections directly on the network if manually configured to do so. Starting with version 26.10, the recommended method is to use Apache as a reverse proxy for Gorgone.

  1. On the central server, update the file /etc/centreon-gorgone/config.d/40-gorgoned.yaml as follows. The nodes module should already be present, and does not need modification in a default installation. The proxy module is already present too, but not the httpserver sub-key, which you should add.
gorgone:
modules:

- name: proxy
package: "gorgone::modules::core::proxy::hooks"
enable: true
httpserver:
enable: true
ssl: false
address: "localhost"
port: 8087

Please note this is a yaml file, so indentation is important. Use 2 spaces for each indentation level.

Explanation of the configuration:

  • ssl: false and address: "localhost": Gorgone only accepts connections from the local machine, in plain HTTP. Apache is the one terminating TLS for the pollers and forwarding the traffic locally, so Gorgone itself does not need a certificate.
  • port: 8087: internal port used only for the connection between Apache and Gorgone on the same host. It should not be exposed to the network.
  1. Restart Gorgone after this change:
systemctl restart gorgoned
  1. Check that Gorgone is listening on port 8087 correctly:
sudo ss -tnlp | grep 8087

The command should return one line similar to this:

LISTEN 0 4096 [::1]:8087 [::]:* users:(("gorgone-proxy-h",pid=2305,fd=28))

Step 2: Configure Apache as a reverse proxy​

This step is also done on the central server.

Apache modules prerequisites​

Make sure the proxy_wstunnel Apache module is enabled:

Unlike .deb packages, the Alma Linux 9 httpd package already has the proxy_wstunnel module enabled by default, so there is nothing to do.

Apache reverse proxy configuration​

  1. Edit your Apache configuration file. This is located here:
/etc/httpd/conf.d/10-centreon.conf
  1. Add the correct contents to the Apache virtual host:

    • Centreon offers an example configuration file to enable HTTPS and serve Gorgone as a reverse proxy, available at: /usr/share/centreon/examples/centreon-apache-https.conf. You can copy and paste the contents.
    • However, if you have a custom configuration and cannot just copy and paste the example file, this is the required configuration to add inside your Apache virtual host:
    <IfModule mod_proxy_wstunnel.c>
    ProxyPass "/${base_uri}/gorgone/pullwss/websocket" "ws://localhost:8087/"
    ProxyPassReverse "/${base_uri}/gorgone/pullwss/websocket" "ws://localhost:8087/"
    </IfModule>
  2. Restart Apache

systemctl restart httpd

Add the poller to the platform's configuration​

You can now add a poller using the automatically generated command. To do so, retrieve the command from the Centreon web interface (in the poller section at the top left of the screen, whether you want to install a poller on a container or on a VM or a physical machine). The poller will automatically connect to the central server using pullwss.

If you delete all your collectors installed via an automatically generated command​

If in the future you should delete all your pollers installed via an automatically generated command, do not forget to undo the steps above.

Troubleshooting the installation​

If your installation does not work, there are multiple things you can check:

Can the poller reach the central server?​

The poller must reach the central server on the web port (443 for an https:// address, 80 for an http:// address, or the port given in the address) and on TCP port 5669 (Centreon Broker). You can check from the poller with the following commands:

nc -zv <central_hostname> 443
nc -zv <central_hostname> 5669

Is Gorgone correctly listening on port 8087?​

curl --header "Connection: Upgrade" --header "Upgrade: websocket" http://localhost:8087/

The expected output is:

HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Sec-WebSocket-Accept: Kfh9QIsMVZcl6xEPYxPHzW8SZ8w=
Server: Mojolicious (Perl)
Upgrade: websocket

Does Apache2 redirect the traffic to Gorgone correctly?​

curl -v --header "Connection: Upgrade" --header "Upgrade: websocket" https://localhost:443/centreon/gorgone/pullwss/websocket

The expected output is:

< HTTP/1.1 101 Switching Protocols
< Connection: Upgrade
< Sec-WebSocket-Accept: Kfh9QIsMVZcl6xEPYxPHzW8SZ8w=
< Server: Mojolicious (Perl)
< Upgrade: websocket

If you see an HTML page indicating You need to enable JavaScript to run this app, the Apache reverse proxy is not configured correctly, and the traffic is redirected to the Centreon web interface instead of to Gorgone. Check your Apache configuration and restart Apache after any change.

Is the poller rejected with an invalid token error?​

If the Gorgone logs of the poller (docker compose logs gorgone) show {"code":500,"message":"invalid token"}, check that the token is a valid poller-type token. If your web server redirects HTTP to HTTPS, also check that base_url in /etc/centreon-gorgone/config.d/31-centreon-api.yaml on the central server uses https://, then restart Gorgone.