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

Update Install Script & Fix #22 #25

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ service:
- periodic:
exporter:
otlp:
protocol: grpc/protobuf
endpoint: ${env:INSTANA_OTEL_ENDPOINT_GRPC:-localhost:4317}
protocol: http/protobuf
endpoint: ${env:INSTANA_OTEL_ENDPOINT_HTTP:-http://localhost:8992}
headers:
x-instana-key: ${env:INSTANA_KEY:-instanalocal}
# extensions: [opamp]
Expand Down
33 changes: 24 additions & 9 deletions tools/packaging/linux/package_instana_collector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ package_files() {
mkdir -p collector/bin collector/config
cp config.yaml collector/config
cp tools/packaging/linux/instana_collector_service.sh collector/bin
cp tools/packaging/linux/uninstall.sh collector/bin
mv otelcol-dev/otelcol-dev collector/bin/instana-otelcol
tar -czvf "instana-otel-collector-release-v$VERSION.tar.gz" collector
}
Expand All @@ -55,11 +56,12 @@ create_installer_script() {
set -e
show_help() {
echo "Usage: instana-collector-installer-v$VERSION.sh -e INSTANA_ENDPOINT -a INSTANA_KEY [install_path]"
echo "Usage: instana-collector-installer-v$VERSION.sh -e INSTANA_OTEL_ENDPOINT_GRPC [-H INSTANA_OTEL_ENDPOINT_HTTP] -a INSTANA_KEY [install_path]"
echo "Options:"
echo " -h, --help Show this help message and exit"
echo " -e ENDPOINT Set the Instana endpoint (required)"
echo " -a KEY Set the Instana key (required)"
echo " -h, --help Show this help message and exit"
echo " -e gRPC ENDPOINT Set the Instana OTel gRPC endpoint (required)"
echo " -H HTTP ENDPOINT Set the Instana OTel HTTP endpoint"
echo " -a KEY Set the Instana key (required)"
exit 0
}
Expand All @@ -69,7 +71,8 @@ fi
# Default values
INSTALL_PATH="/opt/instana"
INSTANA_ENDPOINT=""
INSTANA_OTEL_ENDPOINT_GRPC=""
INSTANA_OTEL_ENDPOINT_HTTP=""
INSTANA_KEY=""
# Parse arguments
Expand All @@ -79,7 +82,10 @@ while getopts "he:a:" opt; do
show_help
;;
e )
INSTANA_ENDPOINT="\$OPTARG"
INSTANA_OTEL_ENDPOINT_GRPC="\$OPTARG"
;;
H )
INSTANA_OTEL_ENDPOINT_HTTP="\$OPTARG"
;;
a )
INSTANA_KEY="\$OPTARG"
Expand All @@ -91,11 +97,16 @@ while getopts "he:a:" opt; do
done
shift \$((OPTIND -1))
if [[ -z "\$INSTANA_ENDPOINT" || -z "\$INSTANA_KEY" ]]; then
echo "Error: Both -e (INSTANA_ENDPOINT) and -a (INSTANA_KEY) are required."
if [[ -z "\$INSTANA_OTEL_ENDPOINT_GRPC" || -z "\$INSTANA_KEY" ]]; then
echo "Error: Both -e (INSTANA_OTEL_ENDPOINT_GRPC) and -a (INSTANA_KEY) are required."
show_help
fi
# Derive INSTANA_OTEL_ENDPOINT_HTTP if not set
if [[ -z "\$INSTANA_OTEL_ENDPOINT_HTTP" ]]; then
INSTANA_OTEL_ENDPOINT_HTTP="http://\$(echo "\$INSTANA_OTEL_ENDPOINT_GRPC" | sed -E 's/:[0-9]+//g'):4318"
fi
if [[ -n "\$1" ]]; then
INSTALL_PATH="\$1"
fi
Expand All @@ -105,8 +116,12 @@ mkdir -p "\$INSTALL_PATH"
echo "$BASE64_TAR" | base64 --decode > "\$INSTALL_PATH/instana-otel-collector-release-v$VERSION.tar.gz"
tar -xzvf "\$INSTALL_PATH/instana-otel-collector-release-v$VERSION.tar.gz" -C "\$INSTALL_PATH"
# Delete the package tar.gz file after extraction
rm -f "\$INSTALL_PATH/instana-otel-collector-release-v$VERSION.tar.gz"
echo "Creating config.env file..."
echo "INSTANA_ENDPOINT=\$INSTANA_ENDPOINT" > "\$INSTALL_PATH/collector/config/config.env"
echo "INSTANA_OTEL_ENDPOINT_GRPC=\$INSTANA_OTEL_ENDPOINT_GRPC" > "\$INSTALL_PATH/collector/config/config.env"
echo "INSTANA_OTEL_ENDPOINT_HTTP=\$INSTANA_OTEL_ENDPOINT_HTTP" >> "\$INSTALL_PATH/collector/config/config.env"
echo "INSTANA_KEY=\$INSTANA_KEY" >> "\$INSTALL_PATH/collector/config/config.env"
chmod 600 "\$INSTALL_PATH/collector/config/config.env"
Expand Down
Loading