Skip to content

Commit

Permalink
super_agent: nr-otel-collector agent type 0.1.0 (#1049)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenruizdegauna authored Mar 7, 2024
1 parent ea40ebd commit ee0261f
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 67 deletions.
48 changes: 24 additions & 24 deletions recipes/newrelic/infrastructure/super-agent/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ install:
- task: update_apt_nr_source
- task: install_super_agent
- task: update_otel_license_key
- task: update_otel_mem_limit
- task: update_otel_end_point
- task: config_supervisors
- task: config_opamp
- task: config_host_monitoring
- task: update_otel_mem_limit
- task: update_otel_end_point
- task: restart_super_agent
- task: assert_super_agent_started
- task: post_install
Expand Down Expand Up @@ -192,7 +192,7 @@ install:
echo 'enable_process_metrics: true' >> /etc/newrelic-infra.yml
echo 'status_server_enabled: true' >> /etc/newrelic-infra.yml
echo 'status_server_port: 18003' >> /etc/newrelic-infra.yml
echo 'license_key: {{.NEW_RELIC_LICENSE_KEY}}' >> /etc/newrelic-infra.yml
echo 'license_key: {{`{{NEW_RELIC_LICENSE_KEY}}`}}' >> /etc/newrelic-infra.yml
echo '{{.NRIA_CUSTOM_ATTRIBUTES}}' >> /etc/newrelic-infra.yml
fi
Expand Down Expand Up @@ -303,42 +303,40 @@ install:
# Force-Install the Software
echo "Attempting to install any missing dependencies or fixes broken packages."
apt-get $OPTIONS install -f
if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then
exit 1
fi
echo "Installation is successful"
fi
fi
silent: true

# Add NR Ingest Key as ENV Var for the Super Agent Systemd service (used by Infra Agent and Otel)
update_otel_license_key:
cmds:
- |
sed -i 's/\(api-key: \).*/\1'"{{.NEW_RELIC_LICENSE_KEY}}"'/' /etc/nr-otel-collector/config.yaml
sed -i "/^NEW_RELIC_LICENSE_KEY/d" /etc/newrelic-super-agent/newrelic-super-agent.conf
echo 'NEW_RELIC_LICENSE_KEY="{{.NEW_RELIC_LICENSE_KEY}}"' >> /etc/newrelic-super-agent/newrelic-super-agent.conf
update_otel_mem_limit:
cmds:
- |
sed -i 's/\(limit_mib: \).*/\1'"100"'/' /etc/nr-otel-collector/config.yaml
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
sed -i "s/limit_mib: .*$/limit_mib: 100/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
fi
# Add OTLP Endpoint as ENV Var for the Super Agent Systemd service
update_otel_end_point:
cmds:
- |
if [ -f /etc/newrelic-super-agent/newrelic-super-agent.conf ]; then
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/values
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
echo 'otel_exporter_otlp_endpoint: "staging-otlp.nr-data.net:4317"' >> /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then
echo 'otel_exporter_otlp_endpoint: "otlp.eu01.nr-data.net:4317"' >> /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
else
echo 'otel_exporter_otlp_endpoint: "otlp.nr-data.net:4317"' >> /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
sed -i "s/endpoint: .*$/endpoint: staging-otlp.nr-data.net:4317/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then
sed -i "s/endpoint: .*$/endpoint: otlp.eu01.nr-data.net:4317/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
else
sed -i "s/endpoint: .*$/endpoint: otlp.nr-data.net:4317/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
fi
fi
config_supervisors:
Expand Down Expand Up @@ -402,10 +400,12 @@ install:
- |
if [ "{{.NR_CLI_HOST_MONITORING_SOURCE}}" = "otel" ]; then
echo 'is_secure_forward_only: true' >> /etc/newrelic-infra.yml
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values
cp /etc/newrelic-super-agent/examples/values-nr-otel-collector-agent-linux-0.1.0.yaml /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
else
if [ -f /etc/nr-otel-collector/config.yaml ]; then
sed -i 's/\<otlp, hostmetrics\>/otlp/g' /etc/nr-otel-collector/config.yaml
sed -i 's/\<otlp, filelog\>/otlp/g' /etc/nr-otel-collector/config.yaml
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values
cp /etc/newrelic-super-agent/examples/values-nr-otel-collector-gateway-0.1.0.yaml /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
fi
fi
Expand Down
46 changes: 23 additions & 23 deletions recipes/newrelic/infrastructure/super-agent/rhel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ install:
- task: setup_infra_proxy
- task: install_super_agent
- task: update_otel_license_key
- task: update_otel_mem_limit
- task: update_otel_end_point
- task: config_supervisors
- task: config_opamp
- task: config_host_monitoring
- task: update_otel_mem_limit
- task: update_otel_end_point
- task: restart_super_agent
- task: assert_super_agent_started
- task: post_install
Expand Down Expand Up @@ -202,7 +202,7 @@ install:
echo 'enable_process_metrics: true' >> /etc/newrelic-infra.yml
echo 'status_server_enabled: true' >> /etc/newrelic-infra.yml
echo 'status_server_port: 18003' >> /etc/newrelic-infra.yml
echo 'license_key: {{.NEW_RELIC_LICENSE_KEY}}' >> /etc/newrelic-infra.yml
echo 'license_key: {{`{{NEW_RELIC_LICENSE_KEY}}`}}' >> /etc/newrelic-infra.yml
echo '{{.NRIA_CUSTOM_ATTRIBUTES}}' >> /etc/newrelic-infra.yml
fi
Expand Down Expand Up @@ -251,30 +251,28 @@ install:
update_otel_license_key:
cmds:
- |
sed -i 's/\(api-key: \).*/\1'"{{.NEW_RELIC_LICENSE_KEY}}"'/' /etc/nr-otel-collector/config.yaml
sed -i "/^NEW_RELIC_LICENSE_KEY/d" /etc/newrelic-super-agent/newrelic-super-agent.conf
echo 'NEW_RELIC_LICENSE_KEY="{{.NEW_RELIC_LICENSE_KEY}}"' >> /etc/newrelic-super-agent/newrelic-super-agent.conf
update_otel_mem_limit:
cmds:
- |
sed -i 's/\(limit_mib: \).*/\1'"100"'/' /etc/nr-otel-collector/config.yaml
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
sed -i "s/limit_mib: .*$/limit_mib: 100/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
fi
# Add OTLP Endpoint as ENV Var for the Super Agent Systemd service
update_otel_end_point:
cmds:
- |
if [ -f /etc/newrelic-super-agent/newrelic-super-agent.conf ]; then
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/values
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=staging-otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.eu01.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
else
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.nr-data.net:4317' >> //etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
sed -i "s/endpoint: .*$/endpoint: staging-otlp.nr-data.net:4317/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then
sed -i "s/endpoint: .*$/endpoint: otlp.eu01.nr-data.net:4317/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
else
sed -i "s/endpoint: .*$/endpoint: otlp.nr-data.net:4317/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
fi
fi
config_supervisors:
Expand Down Expand Up @@ -338,10 +336,12 @@ install:
- |
if [ "{{.NR_CLI_HOST_MONITORING_SOURCE}}" = "otel" ]; then
echo 'is_secure_forward_only: true' >> /etc/newrelic-infra.yml
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values
cp /etc/newrelic-super-agent/examples/values-nr-otel-collector-agent-linux-0.1.0.yaml /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
else
if [ -f /etc/nr-otel-collector/config.yaml ]; then
sed -i 's/\<otlp, hostmetrics\>/otlp/g' /etc/nr-otel-collector/config.yaml
sed -i 's/\<otlp, filelog\>/otlp/g' /etc/nr-otel-collector/config.yaml
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values
cp /etc/newrelic-super-agent/examples/values-nr-otel-collector-gateway-0.1.0.yaml /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
fi
fi
Expand Down Expand Up @@ -376,4 +376,4 @@ install:
post_install:
info: |2
⚙️ The New Relic Super Agent configuration file can be found in /etc/newrelic-super-agent/config.yaml
⚙️ The New Relic Super Agent configuration file can be found in /etc/newrelic-super-agent/config.yaml
40 changes: 20 additions & 20 deletions recipes/newrelic/infrastructure/super-agent/suse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ install:
- task: setup_infra_proxy
- task: install_super_agent
- task: update_otel_license_key
- task: update_otel_mem_limit
- task: update_otel_end_point
- task: config_supervisors
- task: config_opamp
- task: config_host_monitoring
- task: update_otel_mem_limit
- task: update_otel_end_point
- task: restart_super_agent
- task: assert_super_agent_started
- task: post_install
Expand Down Expand Up @@ -165,7 +165,7 @@ install:
echo 'enable_process_metrics: true' >> /etc/newrelic-infra.yml
echo 'status_server_enabled: true' >> /etc/newrelic-infra.yml
echo 'status_server_port: 18003' >> /etc/newrelic-infra.yml
echo 'license_key: {{.NEW_RELIC_LICENSE_KEY}}' >> /etc/newrelic-infra.yml
echo 'license_key: {{`{{NEW_RELIC_LICENSE_KEY}}`}}' >> /etc/newrelic-infra.yml
echo '{{.NRIA_CUSTOM_ATTRIBUTES}}' >> /etc/newrelic-infra.yml
fi

Expand Down Expand Up @@ -206,30 +206,28 @@ install:
update_otel_license_key:
cmds:
- |
sed -i 's/\(api-key: \).*/\1'"{{.NEW_RELIC_LICENSE_KEY}}"'/' /etc/nr-otel-collector/config.yaml
sed -i "/^NEW_RELIC_LICENSE_KEY/d" /etc/newrelic-super-agent/newrelic-super-agent.conf
echo 'NEW_RELIC_LICENSE_KEY="{{.NEW_RELIC_LICENSE_KEY}}"' >> /etc/newrelic-super-agent/newrelic-super-agent.conf
update_otel_mem_limit:
cmds:
- |
sed -i 's/\(limit_mib: \).*/\1'"100"'/' /etc/nr-otel-collector/config.yaml
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
sed -i "s/limit_mib: .*$/limit_mib: 100/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
fi
# Add OTLP Endpoint as ENV Var for the Super Agent Systemd service
update_otel_end_point:
cmds:
- |
if [ -f /etc/newrelic-super-agent/newrelic-super-agent.conf ]; then
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/values
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=staging-otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
sed -i "s/endpoint: .*$/endpoint: staging-otlp.nr-data.net:4317/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.eu01.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
sed -i "s/endpoint: .*$/endpoint: otlp.eu01.nr-data.net:4317/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
else
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
sed -i "s/endpoint: .*$/endpoint: otlp.nr-data.net:4317/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
fi
fi
config_supervisors:
Expand Down Expand Up @@ -295,10 +293,12 @@ install:
- |
if [ "{{.NR_CLI_HOST_MONITORING_SOURCE}}" = "otel" ]; then
echo 'is_secure_forward_only: true' >> /etc/newrelic-infra.yml
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values
cp /etc/newrelic-super-agent/examples/values-nr-otel-collector-agent-linux-0.1.0.yaml /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
else
if [ -f /etc/nr-otel-collector/config.yaml ]; then
sed -i 's/\<otlp, hostmetrics\>/otlp/g' /etc/nr-otel-collector/config.yaml
sed -i 's/\<otlp, filelog\>/otlp/g' /etc/nr-otel-collector/config.yaml
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values
cp /etc/newrelic-super-agent/examples/values-nr-otel-collector-gateway-0.1.0.yaml /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
fi
fi
Expand Down Expand Up @@ -333,4 +333,4 @@ install:
post_install:
info: |2
⚙️ The New Relic Super Agent configuration file can be found in /etc/newrelic-super-agent/config.yaml
⚙️ The New Relic Super Agent configuration file can be found in /etc/newrelic-super-agent/config.yaml

0 comments on commit ee0261f

Please sign in to comment.