Skip to content

Commit ee0261f

Browse files
super_agent: nr-otel-collector agent type 0.1.0 (#1049)
1 parent ea40ebd commit ee0261f

File tree

3 files changed

+67
-67
lines changed

3 files changed

+67
-67
lines changed

recipes/newrelic/infrastructure/super-agent/debian.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ install:
7676
- task: update_apt_nr_source
7777
- task: install_super_agent
7878
- task: update_otel_license_key
79-
- task: update_otel_mem_limit
80-
- task: update_otel_end_point
8179
- task: config_supervisors
8280
- task: config_opamp
8381
- task: config_host_monitoring
82+
- task: update_otel_mem_limit
83+
- task: update_otel_end_point
8484
- task: restart_super_agent
8585
- task: assert_super_agent_started
8686
- task: post_install
@@ -192,7 +192,7 @@ install:
192192
echo 'enable_process_metrics: true' >> /etc/newrelic-infra.yml
193193
echo 'status_server_enabled: true' >> /etc/newrelic-infra.yml
194194
echo 'status_server_port: 18003' >> /etc/newrelic-infra.yml
195-
echo 'license_key: {{.NEW_RELIC_LICENSE_KEY}}' >> /etc/newrelic-infra.yml
195+
echo 'license_key: {{`{{NEW_RELIC_LICENSE_KEY}}`}}' >> /etc/newrelic-infra.yml
196196
echo '{{.NRIA_CUSTOM_ATTRIBUTES}}' >> /etc/newrelic-infra.yml
197197
fi
198198
@@ -303,42 +303,40 @@ install:
303303
# Force-Install the Software
304304
echo "Attempting to install any missing dependencies or fixes broken packages."
305305
apt-get $OPTIONS install -f
306-
if [ $? -ne 0 ]; then
306+
if [ $? -ne 0 ]; then
307307
exit 1
308308
fi
309309
echo "Installation is successful"
310310
fi
311311
fi
312312
silent: true
313313

314+
# Add NR Ingest Key as ENV Var for the Super Agent Systemd service (used by Infra Agent and Otel)
314315
update_otel_license_key:
315316
cmds:
316317
- |
317-
sed -i 's/\(api-key: \).*/\1'"{{.NEW_RELIC_LICENSE_KEY}}"'/' /etc/nr-otel-collector/config.yaml
318+
sed -i "/^NEW_RELIC_LICENSE_KEY/d" /etc/newrelic-super-agent/newrelic-super-agent.conf
319+
echo 'NEW_RELIC_LICENSE_KEY="{{.NEW_RELIC_LICENSE_KEY}}"' >> /etc/newrelic-super-agent/newrelic-super-agent.conf
318320
319321
update_otel_mem_limit:
320322
cmds:
321323
- |
322-
sed -i 's/\(limit_mib: \).*/\1'"100"'/' /etc/nr-otel-collector/config.yaml
324+
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
325+
sed -i "s/limit_mib: .*$/limit_mib: 100/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
326+
fi
323327
328+
# Add OTLP Endpoint as ENV Var for the Super Agent Systemd service
324329
update_otel_end_point:
325330
cmds:
326331
- |
327-
if [ -f /etc/newrelic-super-agent/newrelic-super-agent.conf ]; then
328-
sed -i "/^OTEL_EXPORTER_OTLP_ENDPOINT/d" /etc/newrelic-super-agent/newrelic-super-agent.conf
329-
fi
330-
- |
331-
# Remove old config location (to deprecate)
332-
rm -f /etc/newrelic-super-agent/nrdot-values.yaml
333-
sed -i "/^OTEL_EXPORTER_OTLP_ENDPOINT/d" /etc/newrelic-super-agent/newrelic-super-agent.conf
334-
# Create nr-otel-collector sub-agent dir
335-
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values
336-
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
337-
echo 'otel_exporter_otlp_endpoint: "staging-otlp.nr-data.net:4317"' >> /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
338-
elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then
339-
echo 'otel_exporter_otlp_endpoint: "otlp.eu01.nr-data.net:4317"' >> /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
340-
else
341-
echo 'otel_exporter_otlp_endpoint: "otlp.nr-data.net:4317"' >> /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
332+
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
333+
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
334+
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
335+
elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then
336+
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
337+
else
338+
sed -i "s/endpoint: .*$/endpoint: otlp.nr-data.net:4317/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
339+
fi
342340
fi
343341
344342
config_supervisors:
@@ -402,10 +400,12 @@ install:
402400
- |
403401
if [ "{{.NR_CLI_HOST_MONITORING_SOURCE}}" = "otel" ]; then
404402
echo 'is_secure_forward_only: true' >> /etc/newrelic-infra.yml
403+
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values
404+
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
405405
else
406-
if [ -f /etc/nr-otel-collector/config.yaml ]; then
407-
sed -i 's/\<otlp, hostmetrics\>/otlp/g' /etc/nr-otel-collector/config.yaml
408-
sed -i 's/\<otlp, filelog\>/otlp/g' /etc/nr-otel-collector/config.yaml
406+
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
407+
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values
408+
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
409409
fi
410410
fi
411411

recipes/newrelic/infrastructure/super-agent/rhel.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ install:
9595
- task: setup_infra_proxy
9696
- task: install_super_agent
9797
- task: update_otel_license_key
98-
- task: update_otel_mem_limit
99-
- task: update_otel_end_point
10098
- task: config_supervisors
10199
- task: config_opamp
102100
- task: config_host_monitoring
101+
- task: update_otel_mem_limit
102+
- task: update_otel_end_point
103103
- task: restart_super_agent
104104
- task: assert_super_agent_started
105105
- task: post_install
@@ -202,7 +202,7 @@ install:
202202
echo 'enable_process_metrics: true' >> /etc/newrelic-infra.yml
203203
echo 'status_server_enabled: true' >> /etc/newrelic-infra.yml
204204
echo 'status_server_port: 18003' >> /etc/newrelic-infra.yml
205-
echo 'license_key: {{.NEW_RELIC_LICENSE_KEY}}' >> /etc/newrelic-infra.yml
205+
echo 'license_key: {{`{{NEW_RELIC_LICENSE_KEY}}`}}' >> /etc/newrelic-infra.yml
206206
echo '{{.NRIA_CUSTOM_ATTRIBUTES}}' >> /etc/newrelic-infra.yml
207207
fi
208208
@@ -251,30 +251,28 @@ install:
251251
update_otel_license_key:
252252
cmds:
253253
- |
254-
sed -i 's/\(api-key: \).*/\1'"{{.NEW_RELIC_LICENSE_KEY}}"'/' /etc/nr-otel-collector/config.yaml
254+
sed -i "/^NEW_RELIC_LICENSE_KEY/d" /etc/newrelic-super-agent/newrelic-super-agent.conf
255+
echo 'NEW_RELIC_LICENSE_KEY="{{.NEW_RELIC_LICENSE_KEY}}"' >> /etc/newrelic-super-agent/newrelic-super-agent.conf
255256
256257
update_otel_mem_limit:
257258
cmds:
258259
- |
259-
sed -i 's/\(limit_mib: \).*/\1'"100"'/' /etc/nr-otel-collector/config.yaml
260+
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
261+
sed -i "s/limit_mib: .*$/limit_mib: 100/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
262+
fi
260263
264+
# Add OTLP Endpoint as ENV Var for the Super Agent Systemd service
261265
update_otel_end_point:
262266
cmds:
263267
- |
264-
if [ -f /etc/newrelic-super-agent/newrelic-super-agent.conf ]; then
265-
sed -i "/^OTEL_EXPORTER_OTLP_ENDPOINT/d" /etc/newrelic-super-agent/newrelic-super-agent.conf
266-
fi
267-
- |
268-
# Remove old config location (to deprecate)
269-
rm -f /etc/newrelic-super-agent/nrdot-values.yaml
270-
# Create nr-otel-collector sub-agent dir
271-
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values
272-
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
273-
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=staging-otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
274-
elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then
275-
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.eu01.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
276-
else
277-
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.nr-data.net:4317' >> //etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
268+
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
269+
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
270+
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
271+
elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then
272+
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
273+
else
274+
sed -i "s/endpoint: .*$/endpoint: otlp.nr-data.net:4317/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
275+
fi
278276
fi
279277
280278
config_supervisors:
@@ -338,10 +336,12 @@ install:
338336
- |
339337
if [ "{{.NR_CLI_HOST_MONITORING_SOURCE}}" = "otel" ]; then
340338
echo 'is_secure_forward_only: true' >> /etc/newrelic-infra.yml
339+
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values
340+
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
341341
else
342-
if [ -f /etc/nr-otel-collector/config.yaml ]; then
343-
sed -i 's/\<otlp, hostmetrics\>/otlp/g' /etc/nr-otel-collector/config.yaml
344-
sed -i 's/\<otlp, filelog\>/otlp/g' /etc/nr-otel-collector/config.yaml
342+
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
343+
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values
344+
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
345345
fi
346346
fi
347347
@@ -376,4 +376,4 @@ install:
376376
377377
post_install:
378378
info: |2
379-
⚙️ The New Relic Super Agent configuration file can be found in /etc/newrelic-super-agent/config.yaml
379+
⚙️ The New Relic Super Agent configuration file can be found in /etc/newrelic-super-agent/config.yaml

recipes/newrelic/infrastructure/super-agent/suse.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ install:
6666
- task: setup_infra_proxy
6767
- task: install_super_agent
6868
- task: update_otel_license_key
69-
- task: update_otel_mem_limit
70-
- task: update_otel_end_point
7169
- task: config_supervisors
7270
- task: config_opamp
7371
- task: config_host_monitoring
72+
- task: update_otel_mem_limit
73+
- task: update_otel_end_point
7474
- task: restart_super_agent
7575
- task: assert_super_agent_started
7676
- task: post_install
@@ -165,7 +165,7 @@ install:
165165
echo 'enable_process_metrics: true' >> /etc/newrelic-infra.yml
166166
echo 'status_server_enabled: true' >> /etc/newrelic-infra.yml
167167
echo 'status_server_port: 18003' >> /etc/newrelic-infra.yml
168-
echo 'license_key: {{.NEW_RELIC_LICENSE_KEY}}' >> /etc/newrelic-infra.yml
168+
echo 'license_key: {{`{{NEW_RELIC_LICENSE_KEY}}`}}' >> /etc/newrelic-infra.yml
169169
echo '{{.NRIA_CUSTOM_ATTRIBUTES}}' >> /etc/newrelic-infra.yml
170170
fi
171171

@@ -206,30 +206,28 @@ install:
206206
update_otel_license_key:
207207
cmds:
208208
- |
209-
sed -i 's/\(api-key: \).*/\1'"{{.NEW_RELIC_LICENSE_KEY}}"'/' /etc/nr-otel-collector/config.yaml
209+
sed -i "/^NEW_RELIC_LICENSE_KEY/d" /etc/newrelic-super-agent/newrelic-super-agent.conf
210+
echo 'NEW_RELIC_LICENSE_KEY="{{.NEW_RELIC_LICENSE_KEY}}"' >> /etc/newrelic-super-agent/newrelic-super-agent.conf
210211
211212
update_otel_mem_limit:
212213
cmds:
213214
- |
214-
sed -i 's/\(limit_mib: \).*/\1'"100"'/' /etc/nr-otel-collector/config.yaml
215+
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
216+
sed -i "s/limit_mib: .*$/limit_mib: 100/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
217+
fi
215218
219+
# Add OTLP Endpoint as ENV Var for the Super Agent Systemd service
216220
update_otel_end_point:
217221
cmds:
218222
- |
219-
if [ -f /etc/newrelic-super-agent/newrelic-super-agent.conf ]; then
220-
sed -i "/^OTEL_EXPORTER_OTLP_ENDPOINT/d" /etc/newrelic-super-agent/newrelic-super-agent.conf
221-
fi
222-
- |
223-
# Remove old config location (to deprecate)
224-
rm -f /etc/newrelic-super-agent/nrdot-values.yaml
225-
# Create nr-otel-collector sub-agent dir
226-
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values
223+
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
227224
if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then
228-
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=staging-otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
225+
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
229226
elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then
230-
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.eu01.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
227+
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
231228
else
232-
echo 'OTEL_EXPORTER_OTLP_ENDPOINT=otlp.nr-data.net:4317' >> /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yml
229+
sed -i "s/endpoint: .*$/endpoint: otlp.nr-data.net:4317/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml
230+
fi
233231
fi
234232
235233
config_supervisors:
@@ -295,10 +293,12 @@ install:
295293
- |
296294
if [ "{{.NR_CLI_HOST_MONITORING_SOURCE}}" = "otel" ]; then
297295
echo 'is_secure_forward_only: true' >> /etc/newrelic-infra.yml
296+
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values
297+
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
298298
else
299-
if [ -f /etc/nr-otel-collector/config.yaml ]; then
300-
sed -i 's/\<otlp, hostmetrics\>/otlp/g' /etc/nr-otel-collector/config.yaml
301-
sed -i 's/\<otlp, filelog\>/otlp/g' /etc/nr-otel-collector/config.yaml
299+
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
300+
mkdir -p /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values
301+
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
302302
fi
303303
fi
304304
@@ -333,4 +333,4 @@ install:
333333
334334
post_install:
335335
info: |2
336-
⚙️ The New Relic Super Agent configuration file can be found in /etc/newrelic-super-agent/config.yaml
336+
⚙️ The New Relic Super Agent configuration file can be found in /etc/newrelic-super-agent/config.yaml

0 commit comments

Comments
 (0)