Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature healthcheck #2

Merged
merged 6 commits into from Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions data/common.yaml
Expand Up @@ -44,6 +44,11 @@ fluentbit::storage_backlog_mem_limit: 5M
fluentbit::storage_metrics: true
fluentbit::storage_delete_irrecoverable_chunks: false

fluentbit::health_check: false
fluentbit::hc_errors_count: 5
fluentbit::hc_retry_failure_count: 5
fluentbit::hc_period: 60

fluentbit::manage_plugins_file: true
fluentbit::plugins_file: '/etc/fluent-bit/plugins.conf'

Expand Down
16 changes: 15 additions & 1 deletion manifests/config.pp
Expand Up @@ -105,6 +105,10 @@
$storage_max_chunks_up = $fluentbit::storage_max_chunks_up
$storage_metrics = bool2str($fluentbit::storage_metrics, 'On', 'Off')
$storage_delete_irrecoverable_chunks = bool2str($fluentbit::storage_delete_irrecoverable_chunks, 'On', 'Off')
$health_check = bool2str($fluentbit::health_check, 'On', 'Off')
$hc_errors_count = $fluentbit::hc_errors_count
$hc_retry_failure_count = $fluentbit::hc_retry_failure_count
$hc_period = $fluentbit::hc_period
$scheduler_cap = $fluentbit::scheduler_cap
$scheduler_base = $fluentbit::scheduler_base
$json_convert_nan_to_null = $fluentbit::json_convert_nan_to_null
Expand All @@ -124,6 +128,15 @@
'storage.delete_irrecoverable_chunks' => $storage_delete_irrecoverable_chunks,
},
}
$health_config = $health_check ? {
undef => {},
default => {
'health.check' => $health_check,
'hc.errors_count' => $hc_errors_count,
'hc.retry_failure_count' => $hc_retry_failure_count,
'hc.period' => $hc_period,
},
}

file { $fluentbit::config_file:
mode => $fluentbit::config_file_mode,
Expand All @@ -147,7 +160,8 @@
'scheduler.cap' => $scheduler_cap,
'scheduler.base' => $scheduler_base,
'json.convert_nan_to_null' => $json_convert_nan_to_null,
} + $storage_config,
} + $storage_config
+ $health_config,
},
),
}
Expand Down
18 changes: 18 additions & 0 deletions manifests/init.pp
Expand Up @@ -111,6 +111,18 @@
# located in the configured storage path directory will be deleted when Fluent-Bit starts.
# Default value: false
#
# @param health_check
# Enable or disable health_check
# Default Off
# @param hc_errors_count
# Only in use if health_check is enabled. The error count after which the healcheck returns an error.
# Default 5
# @param hc_retry_failure_count
# Only in use if health_check is enabled. Retry count till a check returns an error
# Default 5
# @param hc_period
# Only in use if health_check is enabled. Time period by second to count the error and retry failure data point
# Default 60
# @param manage_plugins_file
# Whether to manage the enabled external plugins
#
Expand Down Expand Up @@ -232,6 +244,12 @@
Boolean $storage_metrics,
Boolean $storage_delete_irrecoverable_chunks,
Optional[String[1]] $storage_backlog_mem_limit,

Boolean $health_check,
Integer $hc_errors_count,
Integer $hc_retry_failure_count,
Integer $hc_period,

Integer $coro_stack_size,
String $plugins_dir,
String $scripts_dir,
Expand Down
6 changes: 6 additions & 0 deletions templates/fluentbit.conf.epp
Expand Up @@ -34,6 +34,12 @@
storage.max_chunks_up <%= $service['storage.max_chunks_up'] %>
storage.metrics <%= $service['storage.metrics'] %>
storage.delete_irrecoverable_chunks <%= $service['storage.delete_irrecoverable_chunks'] %>
<% if $service['health.check'] { %>
Health_Check <%= $service['health.check'] %>
HC_Errors_Count <%= $service['hc.errors_count'] %>
HC_Rerty_Failure_Count <%= $service['hc.retry_failure_count'] %>
HC_Period <%= $service['hc.period'] %>
<% } -%>

<%- if $manage_config_dir { %>
@INCLUDE pipelines/*.conf
Expand Down