diff --git a/collector/config/otelcol-docker-hostmetrics.yaml b/collector/config/otelcol-docker-hostmetrics.yaml index 6d07dbc..32af6a5 100644 --- a/collector/config/otelcol-docker-hostmetrics.yaml +++ b/collector/config/otelcol-docker-hostmetrics.yaml @@ -108,11 +108,12 @@ extensions: opamp: server: http: - endpoint: https://opamp.lightstep.com/v1/opamp + endpoint: https://asdasdasdasfdasfd.free.beeceptor.com/v1/opamp headers: - "Authorization": "Bearer ${LS_OPAMP_API_KEY}" + "Authorization": "Bearer YOUR_OPAMP_API_KEY" service: + extensions: [health_check, opamp] pipelines: metrics/collector: receivers: [prometheus/self] diff --git a/collector/config/otelcol-linux-hostmetrics.yaml b/collector/config/otelcol-linux-hostmetrics.yaml index 2722d0d..118e25c 100644 --- a/collector/config/otelcol-linux-hostmetrics.yaml +++ b/collector/config/otelcol-linux-hostmetrics.yaml @@ -68,8 +68,9 @@ extensions: http: endpoint: https://opamp.lightstep.com/v1/opamp headers: - "Authorization": "Bearer ${LS_OPAMP_API_KEY}" + "Authorization": "Bearer YOUR_OPAMP_API_KEY" service: + extensions: [health_check, opamp] pipelines: metrics/collector: receivers: [prometheus/self] diff --git a/collector/config/otelcol-macos-hostmetrics.yaml b/collector/config/otelcol-macos-hostmetrics.yaml index 786b0b9..3b969ee 100644 --- a/collector/config/otelcol-macos-hostmetrics.yaml +++ b/collector/config/otelcol-macos-hostmetrics.yaml @@ -17,9 +17,6 @@ receivers: collection_interval: 5s scrapers: # cpu and disk are only supported if build with CGO_ENABLED=1 - # The ServiceNow collector goreleaser build does this, other builds may not. - cpu: - disk: load: processes: filesystem: @@ -67,12 +64,13 @@ extensions: health_check: opamp: server: - ws: + http: endpoint: https://opamp.lightstep.com/v1/opamp headers: - "Authorization": "Bearer ${LS_OPAMP_API_KEY}" + "Authorization": "Bearer YOUR_OPAMP_API_KEY" service: + extensions: [health_check, opamp] pipelines: metrics/collector: receivers: [prometheus/self] diff --git a/collector/config/otelcol-windows-hostmetrics.yaml b/collector/config/otelcol-windows-hostmetrics.yaml index ade8da2..bbf689b 100644 --- a/collector/config/otelcol-windows-hostmetrics.yaml +++ b/collector/config/otelcol-windows-hostmetrics.yaml @@ -68,8 +68,9 @@ extensions: http: endpoint: https://opamp.lightstep.com/v1/opamp headers: - "Authorization": "Bearer ${LS_OPAMP_API_KEY}" + "Authorization": "Bearer YOUR_OPAMP_API_KEY" service: + extensions: [health_check, opamp] pipelines: metrics/collector: receivers: [prometheus/self] diff --git a/collector/scripts/install/install-macos.sh b/collector/scripts/install/install-macos.sh index 3fa16b2..bbcd934 100755 --- a/collector/scripts/install/install-macos.sh +++ b/collector/scripts/install/install-macos.sh @@ -157,6 +157,9 @@ Usage: $(fg_yellow '-i, --ingest-token') Defines the token to be used when communicating with Cloud Observability + $(fg_yellow '-o, --opamp-key') + Defines the API key to be used when communicating with Cloud Observability via opAMP + EOF ) info "$USAGE" @@ -307,6 +310,7 @@ setup_installation() set_download_urls set_ingest_endpoint set_ingest_token + set_opamp_api_key success "Configuration complete!" decrease_indent @@ -377,6 +381,15 @@ set_ingest_token() INGEST_TOKEN="$ingest_token" } +set_opamp_api_key() +{ + if [ -z "$opamp_api_key" ] ; then + opamp_api_key=$OPAMP_API_KEY + fi + + OPAMP_API_KEY="$opamp_api_key" +} + # latest_version gets the tag of the latest release, without the v prefix. latest_version() { @@ -386,13 +399,21 @@ latest_version() } # set the access token, if one was specified -set_access_token() +replace_access_token() { # uses | as INGEST_TOKEN can contain a / # sed is different on macOS vs Linux! sed -i '' "s|YOUR_TOKEN|"$INGEST_TOKEN"|g" $INSTALL_DIR/config.yaml } +# replace the opamp api key , if one was specified +replace_opamp_api_key() +{ + # uses | as INGEST_TOKEN can contain a / + # sed is different on macOS vs Linux! + sed -i '' "s|YOUR_OPAMP_API_KEY|"$OPAMP_API_KEY"|g" $INSTALL_DIR/config.yaml +} + # This will install the package by downloading & unpacking the tarball into the install directory install_package() { @@ -464,8 +485,13 @@ install_package() succeeded if [ -n "$INGEST_TOKEN" ]; then - info "Setting access token..." - set_access_token + info "Replacing access token in config..." + replace_access_token + fi + + if [ -n "$OPAMP_API_KEY" ]; then + info "Replacing opAMP API key in config..." + replace_opamp_api_key fi info "Starting service..." @@ -574,6 +600,8 @@ main() ingest_endpoint=$2 ; shift 2 ;; -i|--ingest-token) ingest_token=$2 ; shift 2 ;; + -o|--opamp-key) + opamp_api_key=$2 ; shift 2 ;; -b|--base-url) base_url=$2 ; shift 2 ;; --) diff --git a/collector/scripts/install/install-unix.sh b/collector/scripts/install/install-unix.sh index 96f07d0..7982eb1 100644 --- a/collector/scripts/install/install-unix.sh +++ b/collector/scripts/install/install-unix.sh @@ -168,6 +168,9 @@ Usage: $(fg_yellow '-i, --ingest-token') Defines the token to be used when communicating with Cloud Observability + $(fg_yellow '-o, --opamp-key') + Defines the API key to be used when communicating with Cloud Observability via opAMP + EOF ) info "$USAGE" @@ -264,6 +267,7 @@ setup_installation() set_ingest_endpoint set_ingest_token + set_opamp_api_key success "Configuration complete!" decrease_indent @@ -506,6 +510,14 @@ set_ingest_token() INGEST_TOKEN="$ingest_token" } +set_opamp_api_key() +{ + if [ -z "$opamp_api_key" ] ; then + opamp_api_key=$OPAMP_API_KEY + fi + + OPAMP_API_KEY="$opamp_api_key" +} # latest_version gets the tag of the latest release, without the v prefix. latest_version() @@ -516,12 +528,20 @@ latest_version() } # set the access token, if one was specified -set_access_token() +replace_access_token() { # uses | as INGEST_TOKEN can contain a / sed -i "s|YOUR_TOKEN|$INGEST_TOKEN|g" /opt/sn-collector/config.yaml } +# replace the opamp api key , if one was specified +replace_opamp_api_key() +{ + # uses | as INGEST_TOKEN can contain a / + # sed is different on macOS vs Linux! + sed -i '' "s|YOUR_OPAMP_API_KEY|"$OPAMP_API_KEY"|g" $INSTALL_DIR/config.yaml +} + # This will install the package by downloading the archived agent, # extracting the binaries, and then removing the archive. install_package() @@ -559,8 +579,13 @@ install_package() succeeded if [ -n "$INGEST_TOKEN" ]; then - info "Setting access token..." - set_access_token + info "Replacing access token in config..." + replace_access_token + fi + + if [ -n "$OPAMP_API_KEY" ]; then + info "Replacing opAMP API key in config..." + replace_opamp_api_key fi if [ "$(systemctl is-enabled sn-collector)" = "enabled" ]; then @@ -694,8 +719,8 @@ main() ingest_endpoint=$2 ; shift 2 ;; -i|--ingest-token) ingest_token=$2 ; shift 2 ;; - -c|--check-bp-url) - check_bp_url="true" ; shift 1 ;; + -o|--opamp-key) + opamp_api_key=$2 ; shift 2 ;; -b|--base-url) base_url=$2 ; shift 2 ;; -r|--uninstall)