2
2
# https://github.com/newrelic/open-install-library/blob/main/docs/recipe-spec/recipe-spec.md#schema-definition
3
3
4
4
name : super-agent
5
- displayName : New Relic Super Agent
6
- description : New Relic install recipe for the Super Agent
5
+ displayName : Agent Control
6
+ description : New Relic install recipe for Agent Control
7
7
repository : https://github.com/newrelic/newrelic-super-agent
8
8
9
9
installTargets :
@@ -92,7 +92,7 @@ install:
92
92
- task : update_otel_end_point
93
93
- task : migrate_newrelic_infra_config
94
94
- task : restart_super_agent
95
- - task : assert_super_agent_started
95
+ - task : assert_super_agent_status_ok
96
96
- task : signal_recipe_applied
97
97
- task : post_install
98
98
@@ -175,18 +175,18 @@ install:
175
175
if [ -n "{{.DEBIAN_CODENAME}}" ]; then
176
176
IS_AGENT_AVAILABLE=$(curl -Is {{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/apt/dists/{{.DEBIAN_CODENAME}}/InRelease | grep " 2[0-9][0-9] " | wc -l)
177
177
if [ $IS_AGENT_AVAILABLE -eq 0 ] ; then
178
- echo "there is no newrelic super agent available for the distribution with codename '{{.DEBIAN_CODENAME}}'." >&2
178
+ echo "there is no New Relic Agent Control available for the distribution with codename '{{.DEBIAN_CODENAME}}'." >&2
179
179
exit 131
180
180
fi
181
181
else
182
182
if [ -n "{{.DEBIAN_VERSION_CODENAME}}" ]; then
183
183
IS_INFRA_AVAILABLE=$(curl -Is {{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/apt/dists/{{.DEBIAN_VERSION_CODENAME}}/InRelease | grep " 2[0-9][0-9] " | wc -l)
184
184
if [ $IS_INFRA_AVAILABLE -eq 0 ] ; then
185
- echo "there is no newrelic super agent available for the distribution with version codename '{{.DEBIAN_VERSION_CODENAME}}'." >&2
185
+ echo "there is no New Relic Agent Control available for the distribution with version codename '{{.DEBIAN_VERSION_CODENAME}}'." >&2
186
186
exit 131
187
187
fi
188
188
else
189
- echo "there is no newrelic super agent available for the distribution, no version codename was found." >&2
189
+ echo "there is no New Relic Agent Control available for the distribution, no version codename was found." >&2
190
190
exit 131
191
191
fi
192
192
fi
@@ -198,7 +198,7 @@ install:
198
198
199
199
cleanup :
200
200
# skipping this task if .nr-cli exists
201
- status :
201
+ status :
202
202
- test -f /etc/newrelic-super-agent/.nr-cli
203
203
cmds :
204
204
- |
@@ -207,8 +207,8 @@ install:
207
207
fi
208
208
209
209
setup_infra_license :
210
- status :
211
- - test -f /etc/newrelic-super-agent/.nr-cli
210
+ status :
211
+ - test -f /etc/newrelic-super-agent/.nr-cli
212
212
cmds :
213
213
- |
214
214
if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then
@@ -227,7 +227,7 @@ install:
227
227
if [ "{{.NR_SA_MIGRATE_INFRA_CONFIG}}" == "true" ] || [ "{{.NEW_RELIC_ASSUME_YES}}" == "true" ] ; then
228
228
touch /etc/newrelic-infra-do-migrate
229
229
else
230
- printf "\nWould you like to migrate this newrelic-infra config to use it with the newrelic super agent ? (y/N): "
230
+ printf "\nWould you like to migrate this newrelic-infra config to use it with New Relic Agent Control ? (y/N): "
231
231
read -r MIGRATE_NEWRELIC_INFRA_CONFIG
232
232
MIGRATE_NEWRELIC_INFRA_CONFIG=${MIGRATE_NEWRELIC_INFRA_CONFIG:-N}
233
233
@@ -253,8 +253,8 @@ install:
253
253
echo '{{.NRIA_CUSTOM_ATTRIBUTES}}' >> /etc/newrelic-infra.yml
254
254
fi
255
255
setup_infra_proxy :
256
- status :
257
- - test -f /etc/newrelic-super-agent/.nr-cli
256
+ status :
257
+ - test -f /etc/newrelic-super-agent/.nr-cli
258
258
cmds :
259
259
- |
260
260
if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] && [ ! -z "$HTTPS_PROXY" ]; then
@@ -368,9 +368,9 @@ install:
368
368
fi
369
369
silent : true
370
370
371
- # If configured to do so, migrate the newrelic-infra configuration for usage with the super agent
371
+ # If configured to do so, migrate the newrelic-infra configuration for usage with New Relic Agent Control
372
372
migrate_newrelic_infra_config :
373
- status :
373
+ status :
374
374
- test -f /etc/newrelic-super-agent/.nr-cli
375
375
cmds :
376
376
- |
@@ -379,18 +379,18 @@ install:
379
379
newrelic-config-migrate
380
380
fi
381
381
382
- # Add NR Ingest Key as ENV Var for the Super Agent Systemd service (used by Infra Agent and Otel)
382
+ # Add NR Ingest Key as ENV Var for the super-agent Systemd service (used by Infra Agent and Otel)
383
383
update_otel_license_key :
384
- status :
385
- - test -f /etc/newrelic-super-agent/.nr-cli
384
+ status :
385
+ - test -f /etc/newrelic-super-agent/.nr-cli
386
386
cmds :
387
387
- |
388
388
sed -i "/^NEW_RELIC_LICENSE_KEY/d" /etc/newrelic-super-agent/newrelic-super-agent.conf
389
389
echo 'NEW_RELIC_LICENSE_KEY="{{.NEW_RELIC_LICENSE_KEY}}"' >> /etc/newrelic-super-agent/newrelic-super-agent.conf
390
390
391
391
update_otel_mem_limit :
392
- status :
393
- - test -f /etc/newrelic-super-agent/.nr-cli
392
+ status :
393
+ - test -f /etc/newrelic-super-agent/.nr-cli
394
394
cmds :
395
395
- |
396
396
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
@@ -399,8 +399,8 @@ install:
399
399
400
400
# Add OTLP Endpoint as ENV Var for the Super Agent Systemd service
401
401
update_otel_end_point :
402
- status :
403
- - test -f /etc/newrelic-super-agent/.nr-cli
402
+ status :
403
+ - test -f /etc/newrelic-super-agent/.nr-cli
404
404
cmds :
405
405
- |
406
406
if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then
@@ -414,8 +414,8 @@ install:
414
414
fi
415
415
416
416
config_supervisors :
417
- status :
418
- - test -f /etc/newrelic-super-agent/.nr-cli
417
+ status :
418
+ - test -f /etc/newrelic-super-agent/.nr-cli
419
419
cmds :
420
420
- |
421
421
if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ]; then
@@ -441,8 +441,8 @@ install:
441
441
fi
442
442
443
443
config_fleet_id :
444
- status :
445
- - test -f /etc/newrelic-super-agent/.nr-cli
444
+ status :
445
+ - test -f /etc/newrelic-super-agent/.nr-cli
446
446
cmds :
447
447
- |
448
448
if [ ! -z "{{.NR_CLI_FLEET_ID}}" ] ; then
@@ -451,8 +451,8 @@ install:
451
451
fi
452
452
453
453
config_opamp :
454
- status :
455
- - test -f /etc/newrelic-super-agent/.nr-cli
454
+ status :
455
+ - test -f /etc/newrelic-super-agent/.nr-cli
456
456
cmds :
457
457
- |
458
458
if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" = "false" ]; then
@@ -484,8 +484,8 @@ install:
484
484
fi
485
485
486
486
config_super_agent_auth :
487
- status :
488
- - test -f /etc/newrelic-super-agent/.nr-cli
487
+ status :
488
+ - test -f /etc/newrelic-super-agent/.nr-cli
489
489
cmds :
490
490
- |
491
491
if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" != "false" ] && [ "{{ .NEW_RELIC_ORGANIZATION }}" != "" ]; then
@@ -579,8 +579,8 @@ install:
579
579
fi
580
580
581
581
config_host_monitoring :
582
- status :
583
- - test -f /etc/newrelic-super-agent/.nr-cli
582
+ status :
583
+ - test -f /etc/newrelic-super-agent/.nr-cli
584
584
cmds :
585
585
- |
586
586
if [ "{{.NEW_RELIC_SUPER_AGENT_HOST_MONITORING_SOURCE}}" = "otel" ]; then
@@ -607,21 +607,45 @@ install:
607
607
fi
608
608
fi
609
609
610
- assert_super_agent_started :
610
+ assert_super_agent_status_ok :
611
611
cmds :
612
612
- |
613
- # Ensure super agent has enough time to start
614
- sleep 10
615
- IS_AGENT_INSTALLED=$(sudo ps aux | grep newrelic-super-agent | grep -v grep | wc -l)
616
- if [ $IS_AGENT_INSTALLED -eq 0 ] ; then
617
- echo "The newrelic super agent has not started after installing. Please try again later, or see our documentation for installing manually https://docs.newrelic.com/docs/using-new-relic/cross-product-functions/install-configure/install-new-relic" >&2
618
-
619
- if [ {{.IS_SYSTEMCTL}} -gt 0 ]; then
620
- journalctl -u newrelic-super-agent --no-pager
613
+ MAX_RETRIES=150
614
+ TRIES=0
615
+ echo "Running agent status check attempt..."
616
+ # wait for status endpoint to be ready
617
+ while [ $TRIES -lt $MAX_RETRIES ]; do
618
+ ((TRIES++))
619
+ statusCheckOutput=$(curl -s http://localhost:51200/status)
620
+ if [ -z "$statusCheckOutput" ]; then
621
+ # so jq doesn't fail if empty
622
+ statusCheckOutput="{}"
621
623
fi
622
-
623
- exit 31
624
- fi
624
+ STATUS=$(echo $statusCheckOutput | /usr/local/bin/newrelic utils jq '.super_agent.healthy')
625
+ if [ "$STATUS" == "true" ]; then
626
+ echo "Agent status check ok."
627
+ break
628
+ else
629
+ if [ "$TRIES" -eq "$MAX_RETRIES" ]; then
630
+ # Process-based validation attempt
631
+ IS_AGENT_INSTALLED=$(ps aux | grep newrelic-super-agent | grep -v grep | wc -l)
632
+ if [ $IS_AGENT_INSTALLED -gt 0 ] ; then
633
+ echo "detected newrelic-super-agent process running"
634
+ exit 0
635
+ fi
636
+
637
+ echo "New Relic Agent Control has not started after installing. Please try again later, or see our documentation for installing manually https://docs.newrelic.com/docs/using-new-relic/cross-product-functions/install-configure/install-new-relic" >&2
638
+
639
+ if [ {{.IS_SYSTEMCTL}} -gt 0 ]; then
640
+ journalctl -u newrelic-super-agent --no-pager
641
+ fi
642
+
643
+ exit 31
644
+ fi
645
+ fi
646
+
647
+ sleep 2
648
+ done
625
649
626
650
signal_recipe_applied :
627
651
cmds :
@@ -630,4 +654,4 @@ install:
630
654
631
655
post_install :
632
656
info : |2
633
- ⚙️ The New Relic Super Agent configuration file can be found in /etc/newrelic-super-agent/config.yaml
657
+ ⚙️ New Relic Agent Control configuration file can be found in /etc/newrelic-super-agent/config.yaml
0 commit comments