Skip to content

Commit

Permalink
fix(gorgone): reduce buffer_size and document it. #1889
Browse files Browse the repository at this point in the history
Refs:MON-1515144
  • Loading branch information
Evan-Adam committed Nov 27, 2024
1 parent 61a28e5 commit 0e466e2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
17 changes: 9 additions & 8 deletions gorgone/docs/modules/core/proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
|:--------------|:-----------------------------------------------------------------------------------------------|:--------------|
Expand Down
2 changes: 1 addition & 1 deletion gorgone/gorgone/modules/core/proxy/hooks.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
15 changes: 12 additions & 3 deletions gorgone/tests/robot/tests/centreon/legacycmd.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 0e466e2

Please sign in to comment.