dynatrace-oss / dynatrace-azure-log-forwarder

This project provides a mechanism that allows streaming Azure logs from Azure Event Hub into Dynatrace Logs via Azure Function App. It supports both: Azure Resource Logs and Azure Activity Logs.
https://www.dynatrace.com/support/help/technology-support/cloud-platforms/microsoft-azure-services/set-up-log-forwarder-azure/
Apache License 2.0
21 stars 16 forks source link

ActiveGate state check fails for running ActiveGate #52

Closed kzzalews closed 2 years ago

kzzalews commented 2 years ago

See: https://github.com/dynatrace-oss/dynatrace-azure-log-forwarder/blob/a45dafe8ea40582ab85b128702c26df92dab66c6/deployment/dynatrace-azure-logs.sh#L103

ActiveGate state check checks if response from ${TARGET_URL}/rest/health equals RUNNING string, but mentioned ActiveGate endpoint returns "RUNNING", so check should expect \"RUNNING\" string.

Fixed code:

check_activegate_state() {
  if ACTIVE_GATE_STATE=$(curl -ksS "${TARGET_URL}/rest/health" --connect-timeout 20); then
    if [[ "$ACTIVE_GATE_STATE" != "\"RUNNING\"" ]]; then
      echo -e ""
      echo -e "\e[91mERROR: \e[37mActiveGate endpoint is not reporting RUNNING state. Please verify provided values for parameters: --target-url (${TARGET_URL})."
      exit 1
    fi
  else
      echo -e "\e[93mWARNING: \e[37mFailed to connect with provided ActiveGate url ($TARGET_URL) to check state. It can be ignored if ActiveGate does not allow public access."
  fi
}
dt-be commented 2 years ago

@kzzalews could you tell me what was the setup and/or bash you were running this against? I will probably add a check for both options for now, but still would like to know what was the scenario when it equals "\"RUNNING\"" - for me it's still "RUNNING" (both locally and in Azure CloudShell) and the script works only before the "fix"

dt-be commented 2 years ago

Temp fix for different responses from DoK and normal Dt clusters - checking both versions https://github.com/dynatrace-oss/dynatrace-azure-log-forwarder/pull/55