Skip to content

Commit

Permalink
Setup Opamp client for super-agent (#980)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarocabanas authored Oct 2, 2023
1 parent eba572a commit 095d908
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 7 deletions.
34 changes: 31 additions & 3 deletions recipes/newrelic/infrastructure/super-agent/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ install:
- task: update_otel_mem_limit
- task: update_otel_end_point
- task: config_supervisors
- task: config_opamp
- task: config_host_monitoring
- task: restart_super_agent
- task: assert_super_agent_started
Expand Down Expand Up @@ -335,10 +336,10 @@ install:
config_supervisors:
cmds:
- |
if [ "{{.NR_CLI_INFRA_AGENT}}" == "false" && "{{.NR_CLI_NRDOT}}" == "false"] ; then
sed -i '/^\s*agents:/s/^/#/' /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
else
sudo sed -i 's/s*#\s*agents:/agents:/g' /etc/newrelic-super-agent/config.yaml
sed -i 's/s*#\s*agents:/agents:/g' /etc/newrelic-super-agent/config.yaml
fi
- |
if [ "{{.NR_CLI_INFRA_AGENT}}" == "false" ] ; then
Expand All @@ -357,6 +358,33 @@ install:
sed -i '/^\s*#\s*agent_type: "newrelic\/io\.opentelemetry\.collector/s/#//' /etc/newrelic-super-agent/config.yaml
fi
config_opamp:
cmds:
- |
if [ "{{.NR_CLI_FLEET_ENABLED}}" == "false" ] ; then
sed -i '/^\s*opamp:/s/^/#/' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*endpoint: https:\/\/opamp/s/^/#/' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*api-key:/s/^/#/' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*headers:/s/^/#/' /etc/newrelic-super-agent/config.yaml
else
sed -i 's/s*#\s*opamp:/opamp:/g' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*#\s*endpoint: https:\/\/opamp/s/#//' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*#\s*api-key:/s/#//' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*#\s*headers:/s/#//' /etc/newrelic-super-agent/config.yaml
fi
- |
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
sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"service.eu.newrelic.com\/v1\/opamp"'/' /etc/newrelic-super-agent/config.yaml
else
sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"service.newrelic.com\/v1\/opamp"'/' /etc/newrelic-super-agent/config.yaml
fi
- |
if [ "{{.NR_CLI_FLEET_ENABLED}}" != "false" ] ; then
sed -i 's/api-key: API_KEY_HERE/api-key: {{.NEW_RELIC_LICENSE_KEY}}/g' /etc/newrelic-super-agent/config.yaml
fi
config_host_monitoring:
cmds:
- |
Expand Down
32 changes: 30 additions & 2 deletions recipes/newrelic/infrastructure/super-agent/rhel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ install:
- task: update_otel_mem_limit
- task: update_otel_end_point
- task: config_supervisors
- task: config_opamp
- task: config_host_monitoring
- task: restart_super_agent
- task: assert_super_agent_started
Expand Down Expand Up @@ -271,10 +272,10 @@ install:
config_supervisors:
cmds:
- |
if [ "{{.NR_CLI_INFRA_AGENT}}" == "false" && "{{.NR_CLI_NRDOT}}" == "false"] ; then
if [ "{{.NR_CLI_INFRA_AGENT}}" == "false" && "{{.NR_CLI_NRDOT}}" == "false" ] ; then
sed -i '/^\s*agents:/s/^/#/' /etc/newrelic-super-agent/config.yaml
else
sudo sed -i 's/s*#\s*agents:/agents:/g' /etc/newrelic-super-agent/config.yaml
sed -i 's/s*#\s*agents:/agents:/g' /etc/newrelic-super-agent/config.yaml
fi
- |
if [ "{{.NR_CLI_INFRA_AGENT}}" == "false" ] ; then
Expand All @@ -293,6 +294,33 @@ install:
sed -i '/^\s*#\s*agent_type: "newrelic\/io\.opentelemetry\.collector/s/#//' /etc/newrelic-super-agent/config.yaml
fi
config_opamp:
cmds:
- |
if [ "{{.NR_CLI_FLEET_ENABLED}}" == "false" ] ; then
sed -i '/^\s*opamp:/s/^/#/' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*endpoint: https:\/\/opamp/s/^/#/' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*api-key:/s/^/#/' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*headers:/s/^/#/' /etc/newrelic-super-agent/config.yaml
else
sed -i 's/s*#\s*opamp:/opamp:/g' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*#\s*endpoint: https:\/\/opamp/s/#//' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*#\s*api-key:/s/#//' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*#\s*headers:/s/#//' /etc/newrelic-super-agent/config.yaml
fi
- |
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
sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"service.eu.newrelic.com\/v1\/opamp"'/' /etc/newrelic-super-agent/config.yaml
else
sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"service.newrelic.com\/v1\/opamp"'/' /etc/newrelic-super-agent/config.yaml
fi
- |
if [ "{{.NR_CLI_FLEET_ENABLED}}" != "false" ] ; then
sed -i 's/api-key: API_KEY_HERE/api-key: {{.NEW_RELIC_LICENSE_KEY}}/g' /etc/newrelic-super-agent/config.yaml
fi
config_host_monitoring:
cmds:
- |
Expand Down
32 changes: 30 additions & 2 deletions recipes/newrelic/infrastructure/super-agent/suse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ install:
- task: update_otel_mem_limit
- task: update_otel_end_point
- task: config_supervisors
- task: config_opamp
- task: config_host_monitoring
- task: restart_super_agent
- task: assert_super_agent_started
Expand Down Expand Up @@ -225,10 +226,10 @@ install:
config_supervisors:
cmds:
- |
if [ "{{.NR_CLI_INFRA_AGENT}}" == "false" && "{{.NR_CLI_NRDOT}}" == "false"] ; then
if [ "{{.NR_CLI_INFRA_AGENT}}" == "false" && "{{.NR_CLI_NRDOT}}" == "false" ] ; then
sed -i '/^\s*agents:/s/^/#/' /etc/newrelic-super-agent/config.yaml
else
sudo sed -i 's/s*#\s*agents:/agents:/g' /etc/newrelic-super-agent/config.yaml
sed -i 's/s*#\s*agents:/agents:/g' /etc/newrelic-super-agent/config.yaml
fi
- |
if [ "{{.NR_CLI_INFRA_AGENT}}" == "false" ] ; then
Expand All @@ -247,6 +248,33 @@ install:
sed -i '/^\s*#\s*agent_type: "newrelic\/io\.opentelemetry\.collector/s/#//' /etc/newrelic-super-agent/config.yaml
fi
config_opamp:
cmds:
- |
if [ "{{.NR_CLI_FLEET_ENABLED}}" == "false" ] ; then
sed -i '/^\s*opamp:/s/^/#/' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*endpoint: https:\/\/opamp/s/^/#/' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*api-key:/s/^/#/' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*headers:/s/^/#/' /etc/newrelic-super-agent/config.yaml
else
sed -i 's/s*#\s*opamp:/opamp:/g' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*#\s*endpoint: https:\/\/opamp/s/#//' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*#\s*api-key:/s/#//' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*#\s*headers:/s/#//' /etc/newrelic-super-agent/config.yaml
fi
- |
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
sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"service.eu.newrelic.com\/v1\/opamp"'/' /etc/newrelic-super-agent/config.yaml
else
sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"service.newrelic.com\/v1\/opamp"'/' /etc/newrelic-super-agent/config.yaml
fi
- |
if [ "{{.NR_CLI_FLEET_ENABLED}}" != "false" ] ; then
sed -i 's/api-key: API_KEY_HERE/api-key: {{.NEW_RELIC_LICENSE_KEY}}/g' /etc/newrelic-super-agent/config.yaml
fi
config_host_monitoring:
cmds:
- |
Expand Down

0 comments on commit 095d908

Please sign in to comment.