Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 75 additions & 18 deletions recipes/newrelic/ebpf/centos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ install:
- task: disable_service_for_agent_control

assert_pre_req:
status:
- |
if [ "${FORCE_INSTALL:-}" = "true" ]; then
echo "Force install enabled - skipping pre-requisite checks"
exit 0
fi
# If FORCE_INSTALL is not true, we want the task to run normally
exit 1
cmds:
- |
IS_ROOT_OR_SUDO=$([ ! -z "$SUDO_USER" ] || [ $(whoami) = "root" ] && echo "true" || echo "false") # Assert root or sudo user
Expand Down Expand Up @@ -112,6 +120,24 @@ install:
echo ""
exit 15
fi
- |
# Check kernel version - eBPF agent requires kernel 5.4 or higher
KERNEL_VERSION=$(uname -r | cut -d'-' -f1)
KERNEL_MAJOR=$(echo $KERNEL_VERSION | cut -d'.' -f1)
KERNEL_MINOR=$(echo $KERNEL_VERSION | cut -d'.' -f2)

# Convert to comparable format (e.g., 5.4 becomes 504, 4.19 becomes 419)
KERNEL_NUM=$((KERNEL_MAJOR * 100 + KERNEL_MINOR))
REQUIRED_KERNEL_NUM=504 # 5.4

if [ $KERNEL_NUM -lt $REQUIRED_KERNEL_NUM ]; then
echo ""
echo -e "\e[31mERROR:\e[0m eBPF agent requires Linux kernel version 5.4 or higher." >&2
echo -e "Current kernel version: $KERNEL_VERSION" >&2
echo -e "Please upgrade your kernel to version 5.4 or higher and re-run the installation." >&2
echo ""
exit 17
fi
- |
if [[ ! -d "/px" ]]; then
if ! sudo mkdir -p "/px"; then
Expand Down Expand Up @@ -166,7 +192,7 @@ install:
# -- To configure the log level in increasing order of verboseness. [OFF, FATAL, ERROR, WARNING, INFO, DEBUG]
NEW_RELIC_LOG_LEVEL=INFO
# -- To configure log file path of eBPF Agent. If logging to this path fails, logs will be directed to stdout.
NEW_RELIC_LOG_FILE_PATH=""
NEW_RELIC_LOG_FILE_PATH="${NEW_RELIC_LOG_FILE_PATH:-}"
# Regular expression pattern to match the specific name(s) of the entity set that you wish to exclude.
DROP_DATA_FOR_ENTITY=""
# -- Enable TLS communication between the eBPF client and agent.
Expand Down Expand Up @@ -204,39 +230,39 @@ install:

# -- To Enable/Disable the metrics, spans, sampling latency rate of MySQL DB
PROTOCOLS_MYSQL_ENABLED="true"
PROTOCOLS_MYSQL_SPANS_ENABLED="false"
PROTOCOLS_MYSQL_SPANS_ENABLED="true"
PROTOCOLS_MYSQL_SPANS_SAMPLING_LATENCY=""

# -- To Enable/Disable the metrics, spans, sampling latency rate of PostgreSQL DB
PROTOCOLS_PGSQL_ENABLED="true"
PROTOCOLS_PGSQL_SPANS_ENABLED="false"
PROTOCOLS_PGSQL_SPANS_ENABLED="true"
PROTOCOLS_PGSQL_SPANS_SAMPLING_LATENCY=""

# -- To Enable/Disable the metrics, spans, sampling latency rate of Cassandra DB
PROTOCOLS_CASS_ENABLED="true"
PROTOCOLS_CASS_SPANS_ENABLED="false"
PROTOCOLS_CASS_SPANS_ENABLED="true"
PROTOCOLS_CASS_SPANS_SAMPLING_LATENCY=""

# -- To Enable/Disable the metrics, spans, sampling latency rate of Redis DB
PROTOCOLS_REDIS_ENABLED="true"
PROTOCOLS_REDIS_SPANS_ENABLED="false"
PROTOCOLS_REDIS_SPANS_ENABLED="true"
PROTOCOLS_REDIS_SPANS_SAMPLING_LATENCY=""

# -- To Enable/Disable the metrics, spans, sampling latency rate of MongoDB
PROTOCOLS_MONGODB_ENABLED="true"
PROTOCOLS_MONGODB_SPANS_ENABLED="false"
PROTOCOLS_MONGODB_SPANS_ENABLED="true"
PROTOCOLS_MONGODB_SPANS_SAMPLING_LATENCY=""

# -- To Enable/Disable the spans and sampling latency of Kafka
PROTOCOLS_KAFKA_SPANS_ENABLED="false"
PROTOCOLS_KAFKA_SPANS_ENABLED="true"
PROTOCOLS_KAFKA_SPANS_SAMPLING_LATENCY=""

# -- To Enable/Disable the spans and sampling latency of AMQP
PROTOCOLS_AMQP_SPANS_ENABLED="false"
PROTOCOLS_AMQP_SPANS_ENABLED="true"
PROTOCOLS_AMQP_SPANS_SAMPLING_LATENCY=""

# -- To Enable/Disable the spans and sampling latency of DNS
PROTOCOLS_DNS_SPANS_ENABLED="false"
PROTOCOLS_DNS_SPANS_ENABLED="true"
PROTOCOLS_DNS_SPANS_SAMPLING_LATENCY=""
EOS

Expand Down Expand Up @@ -381,6 +407,11 @@ install:
sudo rm -f "$CONFIG_FILE" || log_error_and_exit "Failed to delete existing configuration file at $CONFIG_FILE."
fi

# Set default log file path if NEW_RELIC_LOG_FILE_PATH is empty
if [ -z "${NEW_RELIC_LOG_FILE_PATH:-}" ]; then
NEW_RELIC_LOG_FILE_PATH="/var/log/newrelic-ebpf-agent"
fi

# Check if CONFIG_FILE_PATH is set and not empty
if [[ -z "$CONFIG_FILE_PATH" ]]; then
create_default_config_file
Expand Down Expand Up @@ -411,6 +442,16 @@ install:
else
echo "TLS is disabled. Skipping certificate generation and validation."
fi

if [[ ! -d "$NEW_RELIC_LOG_FILE_PATH" ]]; then
echo "Directory $NEW_RELIC_LOG_FILE_PATH does not exist. Attempting to create it..."
if ! sudo mkdir -p "$NEW_RELIC_LOG_FILE_PATH"; then
echo -e "\e[31mERROR:\e[0m Failed to create directory $NEW_RELIC_LOG_FILE_PATH. Aborting installation."
exit 20
fi
echo "Directory $NEW_RELIC_LOG_FILE_PATH created successfully."
fi
echo "eBPF logs directory: $NEW_RELIC_LOG_FILE_PATH"

install_linux_headers:
cmds:
Expand Down Expand Up @@ -465,7 +506,7 @@ install:
# -- To configure the log level in increasing order of verboseness. [OFF, FATAL, ERROR, WARNING, INFO, DEBUG]
NEW_RELIC_LOG_LEVEL=INFO
# -- To configure log file path of eBPF Agent. If logging to this path fails, logs will be directed to stdout.
NEW_RELIC_LOG_FILE_PATH=""
NEW_RELIC_LOG_FILE_PATH="${NEW_RELIC_LOG_FILE_PATH:-}"
# Regular expression pattern to match the specific name(s) of the entity set that you wish to exclude.
DROP_DATA_FOR_ENTITY=""
# -- Enable TLS communication between the eBPF client and agent.
Expand Down Expand Up @@ -503,39 +544,39 @@ install:

# -- To Enable/Disable the metrics, spans, sampling latency rate of MySQL DB
PROTOCOLS_MYSQL_ENABLED="true"
PROTOCOLS_MYSQL_SPANS_ENABLED="false"
PROTOCOLS_MYSQL_SPANS_ENABLED="true"
PROTOCOLS_MYSQL_SPANS_SAMPLING_LATENCY=""

# -- To Enable/Disable the metrics, spans, sampling latency rate of PostgreSQL DB
PROTOCOLS_PGSQL_ENABLED="true"
PROTOCOLS_PGSQL_SPANS_ENABLED="false"
PROTOCOLS_PGSQL_SPANS_ENABLED="true"
PROTOCOLS_PGSQL_SPANS_SAMPLING_LATENCY=""

# -- To Enable/Disable the metrics, spans, sampling latency rate of Cassandra DB
PROTOCOLS_CASS_ENABLED="true"
PROTOCOLS_CASS_SPANS_ENABLED="false"
PROTOCOLS_CASS_SPANS_ENABLED="true"
PROTOCOLS_CASS_SPANS_SAMPLING_LATENCY=""

# -- To Enable/Disable the metrics, spans, sampling latency rate of Redis DB
PROTOCOLS_REDIS_ENABLED="true"
PROTOCOLS_REDIS_SPANS_ENABLED="false"
PROTOCOLS_REDIS_SPANS_ENABLED="true"
PROTOCOLS_REDIS_SPANS_SAMPLING_LATENCY=""

# -- To Enable/Disable the metrics, spans, sampling latency rate of MongoDB
PROTOCOLS_MONGODB_ENABLED="true"
PROTOCOLS_MONGODB_SPANS_ENABLED="false"
PROTOCOLS_MONGODB_SPANS_ENABLED="true"
PROTOCOLS_MONGODB_SPANS_SAMPLING_LATENCY=""

# -- To Enable/Disable the spans and sampling latency of Kafka
PROTOCOLS_KAFKA_SPANS_ENABLED="false"
PROTOCOLS_KAFKA_SPANS_ENABLED="true"
PROTOCOLS_KAFKA_SPANS_SAMPLING_LATENCY=""

# -- To Enable/Disable the spans and sampling latency of AMQP
PROTOCOLS_AMQP_SPANS_ENABLED="false"
PROTOCOLS_AMQP_SPANS_ENABLED="true"
PROTOCOLS_AMQP_SPANS_SAMPLING_LATENCY=""

# -- To Enable/Disable the spans and sampling latency of DNS
PROTOCOLS_DNS_SPANS_ENABLED="false"
PROTOCOLS_DNS_SPANS_ENABLED="true"
PROTOCOLS_DNS_SPANS_SAMPLING_LATENCY=""
EOS

Expand Down Expand Up @@ -682,6 +723,12 @@ install:
GREP_OUTPUT=$(systemctl status newrelic-ebpf-agent.service | grep "Active:" | grep inactive)
if [[ $GREP_OUTPUT ]]; then
if [[ ! -f "$CONFIG_FILE" ]]; then

# Set default log file path if NEW_RELIC_LOG_FILE_PATH is empty
if [ -z "${NEW_RELIC_LOG_FILE_PATH:-}" ]; then
NEW_RELIC_LOG_FILE_PATH="/var/log/newrelic-ebpf-agent"
fi

# Check if CONFIG_FILE_PATH is set and not empty
if [[ -z "$CONFIG_FILE_PATH" ]]; then
create_default_config_file
Expand All @@ -700,6 +747,16 @@ install:
echo "TLS is disabled. Skipping certificate generation and validation."
fi

if [[ ! -d "$NEW_RELIC_LOG_FILE_PATH" ]]; then
echo "Directory $NEW_RELIC_LOG_FILE_PATH does not exist. Attempting to create it..."
if ! sudo mkdir -p "$NEW_RELIC_LOG_FILE_PATH"; then
echo -e "\e[31mERROR:\e[0m Failed to create directory $NEW_RELIC_LOG_FILE_PATH. Aborting installation."
exit 20
fi
echo "Directory $NEW_RELIC_LOG_FILE_PATH created successfully."
fi
echo "eBPF logs directory: $NEW_RELIC_LOG_FILE_PATH"

sudo mkdir -p /px;
sleep 5s;
systemctl restart newrelic-ebpf-agent.service
Expand Down
Loading
Loading