Skip to content

Commit

Permalink
fix(gorgone): reduce buffer_size and document it.
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 b9ac220 commit 4913777
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 12 deletions.
46 changes: 35 additions & 11 deletions gorgone/docs/modules/core/proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,30 @@ A SSH client library make routing to non-gorgoned nodes possible.

## Configuration

| Directive | Description | Default value |
| :------------------- | :------------------------------------------------------------------ | :------------ |
| pool | Number of childs to instantiate to process events | `5` |
| synchistory_time | Time in seconds between two logs synchronisation | `60` |
| synchistory_timeout | Time in seconds before logs synchronisation is considered timed out | `30` |
| ping | Time in seconds between two node pings | `60` |
| pong_discard_timeout | Time in seconds before a node is considered dead | `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.

| Directive | Description | Default value |
|:--------------|:-----------------------------------------------------------------------------------------------|:--------------|
| httpserver | Array containing all the configuration below for a pullwss connection | no value. |
| enable | Boolean if HTTP server should be enabled | `false` |
| ssl | Should connection be made over TLS/SSL or not | `false` |
| ssl_cert_file | Path to a SSL certificate file. required if ssl: true | |
| ssl_key_file | Path to a SSL key file associated to the certificate already configured. required if ssl: true | |
| passphrase | May be an optional passphrase for the SSL key. | |
| token | Allow to authenticate node. It is required to enable the HTTP server. | |
| address | Address to listen to. It can be 0.0.0.0 to listen on all IPv4 addresses. | |
| port | TCP port to listen to. | |


#### Example

Expand All @@ -31,12 +48,19 @@ synchistory_time: 60
synchistory_timeout: 30
ping: 60
pong_discard_timeout: 300
httpserver: # this is used only if you want to configure pullwss nodes. to make it work you have to add the register module and configure a configuration file for it.
enable: true
ssl: true
ssl_cert_file: /etc/centreon-gorgone/keys/public.pem
ssl_key_file: /etc/centreon-gorgone/keys/private.pem
token: secure_token
address: "0.0.0.0"
```
## Events
| Event | Description |
| :-------------- | :----------------------------------------------------------------------------- |
|:----------------|:-------------------------------------------------------------------------------|
| PROXYREADY | Internal event to notify the core |
| REMOTECOPY | Copy files or directories from the server running the daemon to another server |
| SETLOGS | Internal event to insert logs into the database |
Expand All @@ -53,20 +77,20 @@ pong_discard_timeout: 300
### Copy files or directory to remote server
| Endpoint | Method |
| :------------------------- | :----- |
|:---------------------------|:-------|
| /api/core/proxy/remotecopy | `POST` |

#### Headers

| Header | Value |
| :----------- | :--------------- |
|:-------------|:-----------------|
| Accept | application/json |
| Content-Type | application/json |

#### Body

| Key | Value |
| :---------- | :------------------------------------------------ |
|:------------|:--------------------------------------------------|
| source | Path of the source file or directory |
| destination | Path of the destination file or directory |
| cache_dir | Path to the cache directory for archiving purpose |
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

0 comments on commit 4913777

Please sign in to comment.