Skip to content

Commit

Permalink
Logz.io Agent v1.1.25 (#148)
Browse files Browse the repository at this point in the history
* Logz.io Agent v1.1.25

- Added ARM64 support for linux and macOs
  - yq, jq , otel, eksctl
- Upgraded jqbinary to v1.7.1
- Upgraded yqbinary to v4.40.5
- Added exclusion of launcher process metrics as temp solution due to errors (hostmetrics.yaml)
    - error reading command for process \"launcher\
    - error reading memory info for process \"launcher\" (pid 765): no such process; error reading cpu times for process
- Created a common function for downloading binaries
  - Helper functions for binary permissions, moving binary, direct download, tar.gz files download support & detect cpu arch to use correct download url.
- Created a common function to check if a binary with same version exists before download - if it does then copy it to binary path.

* Remove redudant test folder

* Small fixes

- Rename AMD binary urls consts
- Align function comments structure
- Rename arch specific url function variable & add condition for amd
- Remove redundant ˜ symbol
  • Loading branch information
ralongit authored Jan 7, 2024
1 parent 964fe41 commit c559c36
Show file tree
Hide file tree
Showing 11 changed files with 497 additions and 223 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,37 +127,11 @@ function get_is_fargate_was_selected {
# Eksctl binary file in Logz.io temp directory
function download_eksctl {
local func_name="${FUNCNAME[0]}"
local binary_name="eksctl"
local download_url=$(get_arch_specific_url "$EKSCTL_AMD_URL_DOWNLOAD" "$EKSCTL_ARM_URL_DOWNLOAD")
local binary_path="$LOGZIO_TEMP_DIR/$binary_name"

local message='Downloading eksctl ...'
send_log_to_logzio "$LOG_LEVEL_DEBUG" "$message" "$LOG_STEP_INSTALLATION" "$LOG_SCRIPT_INSTALLER" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE" "$CURRENT_DATA_SOURCE"
write_log "$LOG_LEVEL_DEBUG" "$message"

curl -fsSL "$EKSCTL_URL_DOWNLOAD" >"$LOGZIO_TEMP_DIR/eksctl.tar.gz" 2>"$TASK_ERROR_FILE"
if [[ $? -ne 0 ]]; then
message="installer.bash ($EXIT_CODE): $(get_task_error_message)"
send_log_to_logzio "$LOG_LEVEL_ERROR" "$message" "$LOG_STEP_INSTALLATION" "$LOG_SCRIPT_INSTALLER" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE" "$CURRENT_DATA_SOURCE"
write_task_post_run "write_error \"$message\""

return $EXIT_CODE
fi

tar -zxf "$LOGZIO_TEMP_DIR/eksctl.tar.gz" --directory "$LOGZIO_TEMP_DIR" 2>"$TASK_ERROR_FILE"
if [[ $? -ne 0 ]]; then
message="installer.bash ($EXIT_CODE): error extracting files from eksctl.tar.gz: $(get_task_error_message)"
send_log_to_logzio "$LOG_LEVEL_ERROR" "$message" "$LOG_STEP_INSTALLATION" "$LOG_SCRIPT_INSTALLER" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE" "$CURRENT_DATA_SOURCE"
write_task_post_run "write_error \"$message\""

return $EXIT_CODE
fi

chmod +x "$EKSCTL_BIN" 2>"$TASK_ERROR_FILE"
if [[ $? -ne 0 ]]; then
message="installer.bash ($EXIT_CODE): error giving execute premissions to '$EKSCTL_BIN': $(get_task_error_message)"
send_log_to_logzio "$LOG_LEVEL_ERROR" "$message" "$LOG_STEP_INSTALLATION" "$LOG_SCRIPT_INSTALLER" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE" "$CURRENT_DATA_SOURCE"
write_task_post_run "write_error \"$message\""

return $EXIT_CODE
fi
download_binary "$download_url" "$binary_name" "$binary_path"
}

# Creates Fargate profile with monitoring namespace on Kubernetes cluster
Expand Down
35 changes: 5 additions & 30 deletions datasources/mac/kubernetes/eks/kubernetes/installer/functions.bash
Original file line number Diff line number Diff line change
Expand Up @@ -127,39 +127,14 @@ function get_is_fargate_was_selected {
# Eksctl binary file in Logz.io temp directory
function download_eksctl {
local func_name="${FUNCNAME[0]}"
local binary_name="eksctl"
local download_url=$(get_arch_specific_url "$EKSCTL_AMD_URL_DOWNLOAD" "$EKSCTL_ARM_URL_DOWNLOAD")
local binary_path="$LOGZIO_TEMP_DIR/$binary_name"

local message='Downloading eksctl ...'
send_log_to_logzio "$LOG_LEVEL_DEBUG" "$message" "$LOG_STEP_INSTALLATION" "$LOG_SCRIPT_INSTALLER" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE" "$CURRENT_DATA_SOURCE"
write_log "$LOG_LEVEL_DEBUG" "$message"

curl -fsSL "$EKSCTL_URL_DOWNLOAD" >"$LOGZIO_TEMP_DIR/eksctl.tar.gz" 2>"$TASK_ERROR_FILE"
if [[ $? -ne 0 ]]; then
message="installer.bash ($EXIT_CODE): $(get_task_error_message)"
send_log_to_logzio "$LOG_LEVEL_ERROR" "$message" "$LOG_STEP_INSTALLATION" "$LOG_SCRIPT_INSTALLER" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE" "$CURRENT_DATA_SOURCE"
write_task_post_run "write_error \"$message\""

return $EXIT_CODE
fi

tar -zxf "$LOGZIO_TEMP_DIR/eksctl.tar.gz" --directory "$LOGZIO_TEMP_DIR" 2>"$TASK_ERROR_FILE"
if [[ $? -ne 0 ]]; then
message="installer.bash ($EXIT_CODE): error extracting files from eksctl.tar.gz: $(get_task_error_message)"
send_log_to_logzio "$LOG_LEVEL_ERROR" "$message" "$LOG_STEP_INSTALLATION" "$LOG_SCRIPT_INSTALLER" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE" "$CURRENT_DATA_SOURCE"
write_task_post_run "write_error \"$message\""

return $EXIT_CODE
fi

chmod +x "$EKSCTL_BIN" 2>"$TASK_ERROR_FILE"
if [[ $? -ne 0 ]]; then
message="installer.bash ($EXIT_CODE): error giving execute premissions to '$EKSCTL_BIN': $(get_task_error_message)"
send_log_to_logzio "$LOG_LEVEL_ERROR" "$message" "$LOG_STEP_INSTALLATION" "$LOG_SCRIPT_INSTALLER" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE" "$CURRENT_DATA_SOURCE"
write_task_post_run "write_error \"$message\""

return $EXIT_CODE
fi
download_binary "$download_url" "$binary_name" "$binary_path"
}


# Creates Fargate profile with monitoring namespace on Kubernetes cluster
# Input:
# ---
Expand Down
36 changes: 4 additions & 32 deletions resources-linux/otel/subtype_installer_utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -79,39 +79,11 @@ function remove_logzio_otel_collector_service {
# OTEL collector exe in Logz.io temp directory
function download_otel_collector_binary {
local func_name="${FUNCNAME[0]}"
local binary_name="$OTEL_COLLECTOR_BIN_NAME"
local download_url=$(get_arch_specific_url "$OTEL_COLLECTOR_AMD_URL_DOWNLOAD" "$OTEL_COLLECTOR_ARM_URL_DOWNLOAD")
local binary_path="$LOGZIO_TEMP_DIR/$binary_name"

local message='Downloading OTEL collector binary ...'
send_log_to_logzio "$LOG_LEVEL_DEBUG" "$message" "$LOG_STEP_PRE_INSTALLATION" "$LOG_SCRIPT_INSTALLER" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE"
write_log "$LOG_LEVEL_DEBUG" "$message"

if [[ ! -z "$PROXY" ]]; then
curl --proxy "$PROXY" -fsSL "$OTEL_COLLECTOR_URL_DOWNLOAD" >"$LOGZIO_TEMP_DIR/otelcol-contrib.tar.gz" 2>"$TASK_ERROR_FILE"
if [[ $? -ne 0 ]]; then
message="installer.bash ($EXIT_CODE): error downloading otelcol-logzio.tar.gz: $(get_task_error_message)"
send_log_to_logzio "$LOG_LEVEL_ERROR" "$message" "$LOG_STEP_PRE_INSTALLATION" "$LOG_SCRIPT_INSTALLER" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE"
write_task_post_run "write_error \"$message\""

return $EXIT_CODE
fi
else
curl -fsSL "$OTEL_COLLECTOR_URL_DOWNLOAD" >"$LOGZIO_TEMP_DIR/otelcol-contrib.tar.gz" 2>"$TASK_ERROR_FILE"
if [[ $? -ne 0 ]]; then
message="installer.bash ($EXIT_CODE): error downloading otelcol-logzio.tar.gz: $(get_task_error_message)"
send_log_to_logzio "$LOG_LEVEL_ERROR" "$message" "$LOG_STEP_PRE_INSTALLATION" "$LOG_SCRIPT_INSTALLER" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE"
write_task_post_run "write_error \"$message\""

return $EXIT_CODE
fi
fi

tar -zxf "$LOGZIO_TEMP_DIR/otelcol-contrib.tar.gz" --directory "$LOGZIO_TEMP_DIR" 'otelcol-contrib' 2>"$TASK_ERROR_FILE"
if [[ $? -ne 0 ]]; then
message="installer.bash ($EXIT_CODE): error extracting files from otelcol-contrib.tar.gz: $(get_task_error_message)"
send_log_to_logzio "$LOG_LEVEL_ERROR" "$message" "$LOG_STEP_PRE_INSTALLATION" "$LOG_SCRIPT_INSTALLER" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE"
write_task_post_run "write_error \"$message\""

return $EXIT_CODE
fi
download_binary "$download_url" "$binary_name" "$binary_path"
}

# Creates Logz.io opt subdirectory
Expand Down
25 changes: 4 additions & 21 deletions resources-mac/otel/subtype_installer_utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,11 @@ function remove_logzio_otel_collector_service {
# OTEL collector exe in Logz.io temp directory
function download_otel_collector_binary {
local func_name="${FUNCNAME[0]}"
local binary_name="$OTEL_COLLECTOR_BIN_NAME"
local download_url=$(get_arch_specific_url "$OTEL_COLLECTOR_AMD_URL_DOWNLOAD" "$OTEL_COLLECTOR_ARM_URL_DOWNLOAD")
local binary_path="$LOGZIO_TEMP_DIR/$binary_name"

local message='Downloading OTEL collector binary ...'
send_log_to_logzio "$LOG_LEVEL_DEBUG" "$message" "$LOG_STEP_PRE_INSTALLATION" "$LOG_SCRIPT_INSTALLER" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE"
write_log "$LOG_LEVEL_DEBUG" "$message"

curl -fsSL "$OTEL_COLLECTOR_URL_DOWNLOAD" >"$LOGZIO_TEMP_DIR/otelcol-logzio.tar.gz" 2>"$TASK_ERROR_FILE"
if [[ $? -ne 0 ]]; then
message="installer.bash ($EXIT_CODE): error downloading otelcol-logzio.tar.gz: $(get_task_error_message)"
send_log_to_logzio "$LOG_LEVEL_ERROR" "$message" "$LOG_STEP_PRE_INSTALLATION" "$LOG_SCRIPT_INSTALLER" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE"
write_task_post_run "write_error \"$message\""

return $EXIT_CODE
fi

tar -zxf "$LOGZIO_TEMP_DIR/otelcol-logzio.tar.gz" --directory "$LOGZIO_TEMP_DIR" 2>"$TASK_ERROR_FILE"
if [[ $? -ne 0 ]]; then
message="installer.bash ($EXIT_CODE): error extracting files from otelcol-logzio.tar.gz: $(get_task_error_message)"
send_log_to_logzio "$LOG_LEVEL_ERROR" "$message" "$LOG_STEP_PRE_INSTALLATION" "$LOG_SCRIPT_INSTALLER" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE"
write_task_post_run "write_error \"$message\""

return $EXIT_CODE
fi
download_binary "$download_url" "$binary_name" "$binary_path"
}

# Creates Logz.io opt subdirectory
Expand Down
3 changes: 3 additions & 0 deletions resources/otel/receivers/hostmetrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ receiver:
network:
paging:
process:
exclude:
names: ['launcher']
match_type: strict
mute_process_name_error: true
mute_process_exe_error: true
mute_process_io_error: true
18 changes: 13 additions & 5 deletions scripts/linux/consts.bash
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,29 @@ AGENT_JSON="$LOGZIO_TEMP_DIR/agent.json"

## Urls
# Url for downloading jq binary
JQ_URL_DOWNLOAD='https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64'
JQ_AMD_URL_DOWNLOAD='https://github.com/stedolan/jq/releases/download/jq-1.7.1/jq-linux64'
# Url for downloading yq binary
YQ_URL_DOWNLOAD='https://github.com/mikefarah/yq/releases/download/v4.33.2/yq_linux_amd64.tar.gz'
YQ_AMD_URL_DOWNLOAD='https://github.com/mikefarah/yq/releases/download/v4.40.5/yq_linux_amd64.tar.gz'
# Url for downloading OTEL collector tar.gz
OTEL_COLLECTOR_URL_DOWNLOAD='https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.82.0/otelcol-contrib_0.82.0_linux_amd64.tar.gz'
OTEL_COLLECTOR_AMD_URL_DOWNLOAD='https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.82.0/otelcol-contrib_0.82.0_linux_amd64.tar.gz'
# Url for downloading eksctl tar.gz
EKSCTL_URL_DOWNLOAD='https://github.com/weaveworks/eksctl/releases/download/v0.133.0/eksctl_Linux_amd64.tar.gz'
EKSCTL_AMD_URL_DOWNLOAD='https://github.com/weaveworks/eksctl/releases/download/v0.133.0/eksctl_Linux_amd64.tar.gz'
# Url for downloading jq arm64 binary
JQ_ARM_URL_DOWNLOAD='https://github.com/stedolan/jq/releases/download/jq-1.7.1/jq-linux-arm64'
# Url for downloading yq arm64 binary
YQ_ARM_URL_DOWNLOAD='https://github.com/mikefarah/yq/releases/download/v4.40.5/yq_linux_arm64.tar.gz'
# Url for downloading OTEL collector arm64 tar.gz
OTEL_COLLECTOR_ARM_URL_DOWNLOAD='https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.82.0/otelcol-contrib_0.82.0_linux_arm64.tar.gz'
# Url for downloading eksctl arm64 tar.gz
EKSCTL_ARM_URL_DOWNLOAD='https://github.com/weaveworks/eksctl/releases/download/v0.133.0/eksctl_linux_arm64.tar.gz'
# Url for AWS SQS
SQS_URL='https://sqs.us-east-1.amazonaws.com/486140753397/LogzioAgentQueue'

## Bin files
# Jq binary file path
JQ_BIN="$LOGZIO_TEMP_DIR/jq"
# Yq binary file path
YQ_BIN="$LOGZIO_TEMP_DIR/yq_linux_amd64"
YQ_BIN="$LOGZIO_TEMP_DIR/yq"
# Eksctl binary file path
EKSCTL_BIN="$LOGZIO_TEMP_DIR/eksctl"

Expand Down
Loading

0 comments on commit c559c36

Please sign in to comment.