centreon / centreon-collect

Centreon collect software collection
11 stars 6 forks source link

Unable to listen on 0.0.0.0:4317 when using "Poller initiated connection" #1759

Open christophe-activiumid opened 1 month ago

christophe-activiumid commented 1 month ago

BUG REPORT INFORMATION

Prerequisites

Versions

CMA 24.04.06

Operating System

Windows 2019, Windows 11

How the the component has been installed and versions

Version: -- 24.10 (24.04.06)

Additional environment details (AWS, VirtualBox, physical, etc.):

Description

-- Describe the encountered issue --

Steps to Reproduce

Install the CMA, use Poller iniated connection and input "0.0.0.0:4317" image

The service is running, the TCP Port is not opened / listening

Error log :

[2024-10-11 19:03:03.470] [centreon-monitoring-agent] [info] [main_win.cc:169] centreon-monitoring-agent start [2024-10-11 19:03:03.470] [centreon-monitoring-agent] [debug] [grpc_client.cc:51] client this=0x1d9de49b360 activate compression deflate [2024-10-11 19:03:03.470] [centreon-monitoring-agent] [info] [grpc_client.cc:78] unencrypted connection to 0.0.0.0:4317 [2024-10-11 19:03:03.472] [centreon-monitoring-agent] [info] [scheduler.cc:160] schedule 0 checks to execute in 1s [2024-10-11 19:03:03.472] [centreon-monitoring-agent] [debug] [bireactor.cc:51] create client this=0x1d9de4e5a20 peer:0.0.0.0:4317 [2024-10-11 19:03:03.492] [centreon-monitoring-agent] [error] [bireactor.cc:99] 0x1d9de4e5a20 client peer:0.0.0.0:4317 fail read from stream [2024-10-11 19:03:03.493] [centreon-monitoring-agent] [debug] [bireactor.cc:196] 0x1d9de4e5a20 client::shutdown [2024-10-11 19:03:03.492] [centreon-monitoring-agent] [error] [bireactor.cc:146] 0x1d9de4e5a20 client peer 0.0.0.0:4317 fail write to stream [2024-10-11 19:03:03.493] [centreon-monitoring-agent] [error] [bireactor.cc:187] 0x1d9de4e5a20 peer:0.0.0.0:4317 client::OnDone(failed to connect to all addresses; last error: UNAVAILABLE: ipv4:0.0.0.0:4317: WSA Error) [2024-10-11 19:03:03.498] [centreon-monitoring-agent] [debug] [bireactor.cc:57] delete client this=0x1d9de4e5a20 peer:0.0.0.0:4317 [2024-10-11 19:03:13.507] [centreon-monitoring-agent] [debug] [bireactor.cc:51] create client this=0x1d9de528700 peer:0.0.0.0:4317 [2024-10-11 19:03:13.554] [centreon-monitoring-agent] [error] [bireactor.cc:99] 0x1d9de528700 client peer:0.0.0.0:4317 fail read from stream [2024-10-11 19:03:13.554] [centreon-monitoring-agent] [error] [bireactor.cc:146] 0x1d9de528700 client peer 0.0.0.0:4317 fail write to stream [2024-10-11 19:03:13.554] [centreon-monitoring-agent] [debug] [bireactor.cc:196] 0x1d9de528700 client::shutdown [2024-10-11 19:03:13.554] [centreon-monitoring-agent] [error] [bireactor.cc:187] 0x1d9de528700 peer:0.0.0.0:4317 client::OnDone(failed to connect to all addresses; last error: UNAVAILABLE: ipv4:0.0.0.0:4317: WSA Error) [2024-10-11 19:03:13.568] [centreon-monitoring-agent] [debug] [bireactor.cc:57] delete client this=0x1d9de528700 peer:0.0.0.0:4317

nothing is listening on tcp 4317, the port is free

when inputing the IP of the host interface instead of 0.0.0.0 the error is different : [2024-10-11 19:05:37.815] [centreon-monitoring-agent] [info] [main_win.cc:169] centreon-monitoring-agent start [2024-10-11 19:05:37.815] [centreon-monitoring-agent] [debug] [grpc_client.cc:51] client this=0x23f1c1c8bf0 activate compression deflate [2024-10-11 19:05:37.815] [centreon-monitoring-agent] [info] [grpc_client.cc:78] unencrypted connection to 192.168.10.10:4317 [2024-10-11 19:05:37.817] [centreon-monitoring-agent] [info] [scheduler.cc:160] schedule 0 checks to execute in 1s [2024-10-11 19:05:37.817] [centreon-monitoring-agent] [debug] [bireactor.cc:51] create client this=0x23f1c21f220 peer:192.168.10.10:4317 [2024-10-11 19:05:39.880] [centreon-monitoring-agent] [error] [bireactor.cc:99] 0x23f1c21f220 client peer:192.168.10.10:4317 fail read from stream [2024-10-11 19:05:39.880] [centreon-monitoring-agent] [debug] [bireactor.cc:196] 0x23f1c21f220 client::shutdown [2024-10-11 19:05:39.880] [centreon-monitoring-agent] [error] [bireactor.cc:146] 0x23f1c21f220 client peer 192.168.10.10:4317 fail write to stream [2024-10-11 19:05:39.880] [centreon-monitoring-agent] [error] [bireactor.cc:187] 0x23f1c21f220 peer:192.168.10.10:4317 client::OnDone(failed to connect to all addresses; last error: UNAVAILABLE: ipv4:192.168.10.10:4317: Connection refused) [2024-10-11 19:05:39.886] [centreon-monitoring-agent] [debug] [bireactor.cc:57] delete client this=0x23f1c21f220 peer:192.168.10.10:4317

(also same error with 127.0.0.1, but that's not useful)

christophe-activiumid commented 1 month ago

I found the bug after reading the code : https://github.com/centreon/centreon-collect/blob/ab623bb184f9e4d6134e9ebc740dd331a30e0271/agent/src/config_win.cc#L106

the registry key here is not the same as defined here:

https://github.com/centreon/centreon-collect/blob/ab623bb184f9e4d6134e9ebc740dd331a30e0271/agent/conf/centagent.reg#L16

I don't know where the client to configure that is coded, I could only fine the service code

when creating manually the registry key "reverse_connection" and setting it to DWORD 1, the service is running