diff --git a/recipes/newrelic/infrastructure/super-agent/debian.yml b/recipes/newrelic/infrastructure/super-agent/debian.yml index 393d72402..3a089f20a 100644 --- a/recipes/newrelic/infrastructure/super-agent/debian.yml +++ b/recipes/newrelic/infrastructure/super-agent/debian.yml @@ -4,7 +4,7 @@ name: super-agent displayName: New Relic Super Agent description: New Relic install recipe for the Super Agent -repository: https://github.com/newrelic/newrelic-supervisor +repository: https://github.com/newrelic/newrelic-super-agent installTargets: - type: host @@ -328,16 +328,25 @@ install: sed -i "/^OTEL_EXPORTER_OTLP_ENDPOINT/d" /etc/newrelic-super-agent/newrelic-super-agent.conf fi - | + # Remove old config location (to deprecate) + rm -f /etc/newrelic-super-agent/nrdot-values.yaml + sed -i "/^OTEL_EXPORTER_OTLP_ENDPOINT/d" /etc/newrelic-super-agent/newrelic-super-agent.conf + # Create nr_otel_collector sub-agent dir + mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then - echo 'otel_exporter_otlp_endpoint: "staging-otlp.nr-data.net:4317"' >> /etc/newrelic-super-agent/nrdot-values.yaml + echo 'otel_exporter_otlp_endpoint: "staging-otlp.nr-data.net:4317"' >> /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then - echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.eu01.nr-data.net:4317' >> /etc/newrelic-super-agent/newrelic-super-agent.conf + echo 'otel_exporter_otlp_endpoint: "otlp.eu01.nr-data.net:4317"' >> /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml else - echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/newrelic-super-agent.conf + echo 'otel_exporter_otlp_endpoint: "otlp.nr-data.net:4317"' >> /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml fi config_supervisors: cmds: + - | + # Remove values_file keys from config.yaml + sed -i '/^\s*values_file:/d' /etc/newrelic-super-agent/config.yaml + sed -i '/^\s*#\s*values_file:/d' /etc/newrelic-super-agent/config.yaml - | if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ]; then sed -i '/^\s*agents:/s/^/#/' /etc/newrelic-super-agent/config.yaml @@ -359,9 +368,6 @@ install: else sed -i '/^\s*#\s*nr_otel_collector:/s/#//' /etc/newrelic-super-agent/config.yaml sed -i '/^\s*#\s*agent_type: "newrelic\/io\.opentelemetry\.collector/s/#//' /etc/newrelic-super-agent/config.yaml - if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then - sed -i 's/nr_otel_collector:/nr_otel_collector:\n values_file: "\/etc\/newrelic-super-agent\/nrdot-values\.yaml"/' /etc/newrelic-super-agent/config.yaml - fi fi config_opamp: diff --git a/recipes/newrelic/infrastructure/super-agent/rhel.yml b/recipes/newrelic/infrastructure/super-agent/rhel.yml index 9bc0e24d3..e7e23d899 100644 --- a/recipes/newrelic/infrastructure/super-agent/rhel.yml +++ b/recipes/newrelic/infrastructure/super-agent/rhel.yml @@ -4,7 +4,7 @@ name: super-agent displayName: New Relic Super Agent description: New Relic install recipe for the Super Agent -repository: https://github.com/newrelic/newrelic-supervisor +repository: https://github.com/newrelic/newrelic-super-agent installTargets: - type: host @@ -265,16 +265,24 @@ install: sed -i "/^OTEL_EXPORTER_OTLP_ENDPOINT/d" /etc/newrelic-super-agent/newrelic-super-agent.conf fi - | + # Remove old config location (to deprecate) + rm -f /etc/newrelic-super-agent/nrdot-values.yaml + # Create nr_otel_collector sub-agent dir + mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then - echo 'otel_exporter_otlp_endpoint: "staging-otlp.nr-data.net:4317"' >> /etc/newrelic-super-agent/nrdot-values.yaml + echo 'OTEL_EXPORTER_OTLP_ENDPOINT=staging-otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then - echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.eu01.nr-data.net:4317' >> /etc/newrelic-super-agent/newrelic-super-agent.conf + echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.eu01.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml else - echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/newrelic-super-agent.conf + echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.nr-data.net:4317' >> //etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml fi config_supervisors: cmds: + - | + # Remove values_file keys from config.yaml + sed -i '/^\s*values_file:/d' /etc/newrelic-super-agent/config.yaml + sed -i '/^\s*#\s*values_file:/d' /etc/newrelic-super-agent/config.yaml - | if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ] ; then sed -i '/^\s*agents:/s/^/#/' /etc/newrelic-super-agent/config.yaml @@ -295,10 +303,7 @@ install: sed -i '/^\s*agent_type: "newrelic\/io\.opentelemetry\.collector/s/^/#/' /etc/newrelic-super-agent/config.yaml else sed -i '/^\s*#\s*nr_otel_collector:/s/#//' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*agent_type: "newrelic\/io\.opentelemetry\.collector/s/#//' /etc/newrelic-super-agent/config.yaml - if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then - sed -i 's/nr_otel_collector:/nr_otel_collector:\n values_file: "\/etc\/newrelic-super-agent\/nrdot-values\.yaml"/' /etc/newrelic-super-agent/config.yaml - fi + sed -i '/^\s*#\s*agent_type: "newrelic\/io\.opentelemetry\.collector/s/#//' /etc/newrelic-super-agent/config.yaml fi config_opamp: diff --git a/recipes/newrelic/infrastructure/super-agent/suse.yml b/recipes/newrelic/infrastructure/super-agent/suse.yml index 4460a2aca..788e1711e 100644 --- a/recipes/newrelic/infrastructure/super-agent/suse.yml +++ b/recipes/newrelic/infrastructure/super-agent/suse.yml @@ -4,7 +4,7 @@ name: super-agent displayName: New Relic Super Agent description: New Relic install recipe for the Super Agent -repository: https://github.com/newrelic/newrelic-supervisor +repository: https://github.com/newrelic/newrelic-super-agent installTargets: - type: host @@ -220,16 +220,24 @@ install: sed -i "/^OTEL_EXPORTER_OTLP_ENDPOINT/d" /etc/newrelic-super-agent/newrelic-super-agent.conf fi - | + # Remove old config location (to deprecate) + rm -f /etc/newrelic-super-agent/nrdot-values.yaml + # Create nr_otel_collector sub-agent dir + mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then - echo 'otel_exporter_otlp_endpoint: "staging-otlp.nr-data.net:4317"' >> /etc/newrelic-super-agent/nrdot-values.yaml + echo 'OTEL_EXPORTER_OTLP_ENDPOINT=staging-otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then - echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.eu01.nr-data.net:4317' >> /etc/newrelic-super-agent/newrelic-super-agent.conf + echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.eu01.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml else - echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/newrelic-super-agent.conf + echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr_otel_collector/values.yml fi config_supervisors: cmds: + - | + # Remove values_file keys from config.yaml + sed -i '/^\s*values_file:/d' /etc/newrelic-super-agent/config.yaml + sed -i '/^\s*#\s*values_file:/d' /etc/newrelic-super-agent/config.yaml - | if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ] ; then sed -i '/^\s*agents:/s/^/#/' /etc/newrelic-super-agent/config.yaml @@ -251,9 +259,6 @@ install: else sed -i '/^\s*#\s*nr_otel_collector:/s/#//' /etc/newrelic-super-agent/config.yaml sed -i '/^\s*#\s*agent_type: "newrelic\/io\.opentelemetry\.collector/s/#//' /etc/newrelic-super-agent/config.yaml - if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then - sed -i 's/nr_otel_collector:/nr_otel_collector:\n values_file: "\/etc\/newrelic-super-agent\/nrdot-values\.yaml"/' /etc/newrelic-super-agent/config.yaml - fi fi config_opamp: @@ -271,6 +276,8 @@ install: sed -i '/^\s*#\s*headers:/s/#//' /etc/newrelic-super-agent/config.yaml fi - | + # Remove old config location (to deprecate) + rm -f /etc/newrelic-super-agent/nrdot-values.yaml if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"staging-service.newrelic.com\/v1\/opamp"'/' /etc/newrelic-super-agent/config.yaml elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then