From 0cf4393ff15d4de8cd7c9cb51d33f2a0ff822205 Mon Sep 17 00:00:00 2001 From: Evan-Adam <152897682+Evan-Adam@users.noreply.github.com> Date: Wed, 27 Nov 2024 12:58:24 +0100 Subject: [PATCH 1/2] fix(gorgone): reduce buffer_size and document it. #1889 Refs:MON-1515144 --- gorgone/docs/modules/core/proxy.md | 17 +++++++++-------- gorgone/gorgone/modules/core/proxy/hooks.pm | 2 +- .../tests/robot/tests/centreon/legacycmd.robot | 15 ++++++++++++--- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/gorgone/docs/modules/core/proxy.md b/gorgone/docs/modules/core/proxy.md index 69899491411..b1d1ee14af3 100644 --- a/gorgone/docs/modules/core/proxy.md +++ b/gorgone/docs/modules/core/proxy.md @@ -12,16 +12,17 @@ A SSH client library make routing to non-gorgoned nodes possible. ## Configuration -| Directive | Description | Default value | -|:---------------------|:-------------------------------------------------------------------|:---------------| -| pool | Number of children to instantiate to process events | `5` | -| synchistory_time | Time in seconds between two log synchronisations | `60` | -| synchistory_timeout | Time in seconds before log synchronisation is considered timed out | `30` | -| ping | Time in seconds between two node pings | `60` | -| pong_discard_timeout | Time in seconds before a ping is considered lost | `300` | +| Directive | Description | Default value | +|:---------------------|:-----------------------------------------------------------------------------------------------------------------------------------|:--------------| +| pool | Number of children to instantiate to process events | `5` | +| synchistory_time | Time in seconds between two log synchronisations | `60` | +| synchistory_timeout | Time in seconds before log synchronisation is considered timed out | `30` | +| ping | Time in seconds between two node pings | `60` | +| pong_discard_timeout | Time in seconds before a ping is considered lost | `300` | +| buffer_size | Maximum size of the packet sent from a node to another. This is mainly used by legacycmd to send files from the central to the poller. | `150000` | -This part of the configuration is only used if some poller must connect with the pullwss module. +This part of the configuration is only used if some poller must connect with the pullwss module. | Directive | Description | Default value | |:--------------|:-----------------------------------------------------------------------------------------------|:--------------| diff --git a/gorgone/gorgone/modules/core/proxy/hooks.pm b/gorgone/gorgone/modules/core/proxy/hooks.pm index 1319abad40e..25b5c5dc2e4 100644 --- a/gorgone/gorgone/modules/core/proxy/hooks.pm +++ b/gorgone/gorgone/modules/core/proxy/hooks.pm @@ -1169,7 +1169,7 @@ sub prepare_remote_copy { sysopen(FH, $localsrc, O_RDONLY); binmode(FH); - my $buffer_size = (defined($config->{buffer_size})) ? $config->{buffer_size} : 500_000; + my $buffer_size = (defined($config->{buffer_size})) ? $config->{buffer_size} : 150_000; my $buffer; while (my $bytes = sysread(FH, $buffer, $buffer_size)) { my $action = JSON::XS->new->encode({ diff --git a/gorgone/tests/robot/tests/centreon/legacycmd.robot b/gorgone/tests/robot/tests/centreon/legacycmd.robot index 96fd52b4863..1d423b3b9fa 100644 --- a/gorgone/tests/robot/tests/centreon/legacycmd.robot +++ b/gorgone/tests/robot/tests/centreon/legacycmd.robot @@ -40,6 +40,8 @@ Legacycmd Teardown Terminate Process pipeWatcher_${comm} Run rm -rf /var/cache/centreon/config Run rm -rf /etc/centreon/centreon_vmware.json + Run rm -rf /etc/centreon-engine/randomBigFile.cfg + Run rm -rf /etc/centreon-engine/engine-hosts.cfg Push Engine And vmware Configuration [Arguments] ${comm}= ${poller_id}=2 @@ -51,23 +53,30 @@ Push Engine And vmware Configuration Run sed -i -e 's/@COMMUNICATION_MODE@/${comm}/g' /var/cache/centreon/config/vmware/${poller_id}/centreon_vmware.json Run sed -i -e 's/@COMMUNICATION_MODE@/${comm}/g' /var/cache/centreon/config/broker/${poller_id}/broker.cfg Run sed -i -e 's/@COMMUNICATION_MODE@/${comm}/g' /var/cache/centreon/config/engine/${poller_id}/engine-hosts.cfg + Run dd if=/dev/urandom of=/var/cache/centreon/config/engine/${poller_id}/randomBigFile.cfg bs=200MB count=1 iflag=fullblock + ${MD5Start}= Run md5sum /var/cache/centreon/config/engine/${poller_id}/randomBigFile.cfg | cut -f 1 -d " " Run chown www-data:www-data /var/cache/centreon/config/*/${poller_id}/* Run chmod 644 /var/cache/centreon/config/*/${poller_id}/* - + # gorgone central should get these files, and send it to poller in /etc/centreon/, /etc/centreon-broker/, /etc/centreon-engine/ - ${log_query} Create List centreon_vmware.json + # we are checking the poller have the last bit of centreon-engine before continuing. + ${log_query} Create List Copy to '/etc/centreon-engine//' finished successfully # SENDCFGFILE say to gorgone to push conf to poller for a poller id. Run echo SENDCFGFILE:${poller_id} > /var/lib/centreon/centcore/random.cmd - ${log_status} Ctn Find In Log With Timeout log=/var/log/centreon-gorgone/${comm}_gorgone_central_legacycmd/gorgoned.log content=${log_query} regex=0 timeout=20 + ${log_status} Ctn Find In Log With Timeout log=/var/log/centreon-gorgone/${comm}_gorgone_poller${poller_id}_legacycmd/gorgoned.log content=${log_query} regex=0 timeout=40 Should Be True ${log_status} Didn't found the logs : ${log_status} Log To Console File should be set in /etc/centreon/ now + # check vmware conf file ${res}= Run cat /etc/centreon/centreon_vmware.json Should Be Equal As Strings ${res} {"communication mode": "${comm}"} data in /etc/centreon/centreon_vmware.json is not correct. # check the user/group and permission are right. as gorgone run as root in the tests and as centreon-gorgone in prod, this might be different from real life. ${vmware_stat}= Run stat -c "%a %U %G" /etc/centreon/centreon_vmware.json Should Be Equal As Strings ${vmware_stat} 644 centreon-gorgone centreon for vmware file + ${MD5Result}= Run md5sum /etc/centreon-engine/randomBigFile.cfg | cut -f 1 -d " " + Should Be Equal ${MD5Start} ${MD5Result} MD5 Don't match, the big file might have been corrupted. + # check engine conf file # for now gorgone don't set user/group after it untar, it's only done when copying single files. # We can't check the user in the test as "www-data" user is "httpd" on rhel based system From 05a802f983d44a1bcdac654d4f9c5a27b6fe3364 Mon Sep 17 00:00:00 2001 From: Evan Adam Date: Wed, 27 Nov 2024 13:53:00 +0100 Subject: [PATCH 2/2] fix(ci): use new harbor username/password for docker Refs:MON-154010 --- .github/workflows/gorgone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gorgone.yml b/.github/workflows/gorgone.yml index b4725d17df7..1e35bacba83 100644 --- a/.github/workflows/gorgone.yml +++ b/.github/workflows/gorgone.yml @@ -156,8 +156,8 @@ jobs: container: image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:${{ needs.get-environment.outputs.gorgone_docker_version }} credentials: - username: ${{ secrets.DOCKER_REGISTRY_ID }} - password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} + username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }} + password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }} services: mariadb: