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
34 changes: 26 additions & 8 deletions kubernetes/linux/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,40 @@ startAMACoreAgent() {
echo "export AMACALogFilePath=$AMACALogFilePath"
} >> ~/.bashrc

if isOpenTelemetryLogsEnabled; then
export PA_AMCS_PROTOCOL="HttpProtobuf"
Comment thread
suyadav1 marked this conversation as resolved.
export PA_AMCS_HOST="0.0.0.0"
export PA_AMCS_PORT=4319
if isOpenTelemetryLogsEnabled; then
export OTLP_HTTP_PROTOBUF_LOGS_TRACES_HOST="0.0.0.0"
export OTLP_GRPC_LOGS_TRACES_HOST="0.0.0.0"
export OTLP_HTTP_PROTOBUF_LOGS_TRACES_PORT=4319
export OTLP_GRPC_LOGS_TRACES_PORT=4320
if [ -n "${AZMON_OPENTELEMETRYLOGS_CONTAINER_PORT}" ]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some comments about data validation and error handling.

  1. AZMON_OPENTELEMETRYLOGS_CONTAINER_PORT: this should be validated before using it.

  2. if [ "$port_int" -gt 0 ]
    we need handle the false case.

do 1 will eliminate if clause in 2.

# Convert AZMON_OPENTELEMETRYLOGS_CONTAINER_PORT from string to int
port_int=$((AZMON_OPENTELEMETRYLOGS_CONTAINER_PORT + 0))
if [ "$port_int" -gt 0 ] 2>/dev/null; then
export PA_AMCS_PORT=$port_int
export OTLP_HTTP_PROTOBUF_LOGS_TRACES_PORT=$port_int
fi
fi

if [ -n "${AZMON_OPENTELEMETRYLOGS_CONTAINER_PORT_GRPC}" ]; then
# Convert AZMON_OPENTELEMETRYLOGS_CONTAINER_PORT_GRPC from string to int
port_grpc_int=$((AZMON_OPENTELEMETRYLOGS_CONTAINER_PORT_GRPC + 0))
if [ "$port_grpc_int" -gt 0 ] 2>/dev/null; then
export OTLP_GRPC_LOGS_TRACES_PORT=$port_grpc_int
fi
fi

{
echo "export OTLP_HTTP_PROTOBUF_LOGS_TRACES_HOST=$OTLP_HTTP_PROTOBUF_LOGS_TRACES_HOST"
echo "export OTLP_GRPC_LOGS_TRACES_HOST=$OTLP_GRPC_LOGS_TRACES_HOST"
echo "export OTLP_HTTP_PROTOBUF_LOGS_TRACES_PORT=$OTLP_HTTP_PROTOBUF_LOGS_TRACES_PORT"
echo "export OTLP_GRPC_LOGS_TRACES_PORT=$OTLP_GRPC_LOGS_TRACES_PORT"
} >> ~/.bashrc
else
echo "OpenTelemetry logs not enabled, disabling OTLP ports for AMACoreAgent"
export OTLP_HTTP_PROTOBUF_LOGS_TRACES_PORT=-1
export OTLP_GRPC_LOGS_TRACES_PORT=-1
{
echo "export PA_AMCS_PROTOCOL=$PA_AMCS_PROTOCOL"
echo "export PA_AMCS_PORT=$PA_AMCS_PORT"
echo "export PA_AMCS_HOST=$PA_AMCS_HOST"
echo "export OTLP_HTTP_PROTOBUF_LOGS_TRACES_PORT=$OTLP_HTTP_PROTOBUF_LOGS_TRACES_PORT"
echo "export OTLP_GRPC_LOGS_TRACES_PORT=$OTLP_GRPC_LOGS_TRACES_PORT"
} >> ~/.bashrc
fi

Expand Down
2 changes: 1 addition & 1 deletion kubernetes/linux/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ gem uninstall net-imap --force
# remove rexml gem as it has a known CVE (CVE-2025-58767) and is not used by the agent
gem uninstall rexml --force

sudo tdnf install -y azure-mdsd-1.40.3
sudo tdnf install -y azure-mdsd-1.42.0
cp -f $TMPDIR/mdsd.xml /etc/mdsd.d
cp -f $TMPDIR/envmdsd /etc/mdsd.d
rm /usr/sbin/telegraf
Expand Down
Loading