From c53d6ac5ccf0be8818161bdeb8b8a7f4049764b4 Mon Sep 17 00:00:00 2001 From: Guillermo Sanchez Gavier Date: Tue, 17 Dec 2024 15:57:48 +0100 Subject: [PATCH 1/6] fix(agent-control): remove agent type references (#1140) --- .../infrastructure/super-agent/debian.yml | 20 ++++--------------- .../infrastructure/super-agent/rhel.yml | 20 ++++--------------- .../infrastructure/super-agent/suse.yml | 20 ++++--------------- 3 files changed, 12 insertions(+), 48 deletions(-) diff --git a/recipes/newrelic/infrastructure/super-agent/debian.yml b/recipes/newrelic/infrastructure/super-agent/debian.yml index c0cc2b82..f8359131 100644 --- a/recipes/newrelic/infrastructure/super-agent/debian.yml +++ b/recipes/newrelic/infrastructure/super-agent/debian.yml @@ -420,25 +420,13 @@ install: - | if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ]; then cp /etc/newrelic-super-agent/examples/super-agent-config-no-agents.yaml /etc/newrelic-super-agent/config.yaml + elif [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ]; then + cp /etc/newrelic-super-agent/examples/super-agent-config-nr-otel-collector.yaml /etc/newrelic-super-agent/config.yaml + elif [ "{{.NR_CLI_NRDOT}}" = "false" ]; then + cp /etc/newrelic-super-agent/examples/super-agent-config-nr-infra-agent.yaml /etc/newrelic-super-agent/config.yaml else cp /etc/newrelic-super-agent/examples/super-agent-config-all-agents.yaml /etc/newrelic-super-agent/config.yaml fi - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ]; then - sed -i '/^\s*nr-infra-agent:/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*agent_type: "newrelic\/com\.newrelic\.infrastructure_agent/s/^/#/' /etc/newrelic-super-agent/config.yaml - else - sed -i '/^\s*#\s*nr-infra-agent:/s/#//' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*agent_type: "newrelic\/com\.newrelic\.infrastructure_agent/s/#//' /etc/newrelic-super-agent/config.yaml - fi - - | - if [ "{{.NR_CLI_NRDOT}}" = "false" ]; then - sed -i '/^\s*nr-otel-collector:/s/^/#/' /etc/newrelic-super-agent/config.yaml - 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 - fi config_fleet_id: status: diff --git a/recipes/newrelic/infrastructure/super-agent/rhel.yml b/recipes/newrelic/infrastructure/super-agent/rhel.yml index 04432cf5..af6f525b 100644 --- a/recipes/newrelic/infrastructure/super-agent/rhel.yml +++ b/recipes/newrelic/infrastructure/super-agent/rhel.yml @@ -363,25 +363,13 @@ install: - | if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ]; then cp /etc/newrelic-super-agent/examples/super-agent-config-no-agents.yaml /etc/newrelic-super-agent/config.yaml + elif [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ]; then + cp /etc/newrelic-super-agent/examples/super-agent-config-nr-otel-collector.yaml /etc/newrelic-super-agent/config.yaml + elif [ "{{.NR_CLI_NRDOT}}" = "false" ]; then + cp /etc/newrelic-super-agent/examples/super-agent-config-nr-infra-agent.yaml /etc/newrelic-super-agent/config.yaml else cp /etc/newrelic-super-agent/examples/super-agent-config-all-agents.yaml /etc/newrelic-super-agent/config.yaml fi - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ]; then - sed -i '/^\s*nr-infra-agent:/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*agent_type: "newrelic\/com\.newrelic\.infrastructure_agent/s/^/#/' /etc/newrelic-super-agent/config.yaml - else - sed -i '/^\s*#\s*nr-infra-agent:/s/#//' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*agent_type: "newrelic\/com\.newrelic\.infrastructure_agent/s/#//' /etc/newrelic-super-agent/config.yaml - fi - - | - if [ "{{.NR_CLI_NRDOT}}" = "false" ]; then - sed -i '/^\s*nr-otel-collector:/s/^/#/' /etc/newrelic-super-agent/config.yaml - 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 - fi config_fleet_id: status: diff --git a/recipes/newrelic/infrastructure/super-agent/suse.yml b/recipes/newrelic/infrastructure/super-agent/suse.yml index 3899efe9..1c10f434 100644 --- a/recipes/newrelic/infrastructure/super-agent/suse.yml +++ b/recipes/newrelic/infrastructure/super-agent/suse.yml @@ -310,25 +310,13 @@ install: - | if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ]; then cp /etc/newrelic-super-agent/examples/super-agent-config-no-agents.yaml /etc/newrelic-super-agent/config.yaml + elif [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ]; then + cp /etc/newrelic-super-agent/examples/super-agent-config-nr-otel-collector.yaml /etc/newrelic-super-agent/config.yaml + elif [ "{{.NR_CLI_NRDOT}}" = "false" ]; then + cp /etc/newrelic-super-agent/examples/super-agent-config-nr-infra-agent.yaml /etc/newrelic-super-agent/config.yaml else cp /etc/newrelic-super-agent/examples/super-agent-config-all-agents.yaml /etc/newrelic-super-agent/config.yaml fi - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ]; then - sed -i '/^\s*nr-infra-agent:/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*agent_type: "newrelic\/com\.newrelic\.infrastructure_agent/s/^/#/' /etc/newrelic-super-agent/config.yaml - else - sed -i '/^\s*#\s*nr-infra-agent:/s/#//' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*agent_type: "newrelic\/com\.newrelic\.infrastructure_agent/s/#//' /etc/newrelic-super-agent/config.yaml - fi - - | - if [ "{{.NR_CLI_NRDOT}}" = "false" ]; then - sed -i '/^\s*nr-otel-collector:/s/^/#/' /etc/newrelic-super-agent/config.yaml - 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 - fi config_fleet_id: status: From 47186b6c8fa72ba8fa3cbd52df5dc9af397cbfdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20S=C3=A1nchez?= Date: Mon, 16 Dec 2024 17:28:28 +0000 Subject: [PATCH 2/6] feat(agent-control): rename `opamp` option to `fleet_control` --- recipes/newrelic/infrastructure/super-agent/debian.yml | 6 +++--- recipes/newrelic/infrastructure/super-agent/rhel.yml | 8 ++++---- recipes/newrelic/infrastructure/super-agent/suse.yml | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/recipes/newrelic/infrastructure/super-agent/debian.yml b/recipes/newrelic/infrastructure/super-agent/debian.yml index f8359131..6dec4eae 100644 --- a/recipes/newrelic/infrastructure/super-agent/debian.yml +++ b/recipes/newrelic/infrastructure/super-agent/debian.yml @@ -85,7 +85,7 @@ install: - task: update_otel_license_key - task: config_supervisors - task: config_fleet_id - - task: config_opamp + - task: config_fleet_control - task: config_super_agent_auth - task: config_host_monitoring - task: update_otel_mem_limit @@ -438,13 +438,13 @@ install: sed -i 's/fleet_id: FLEET_ID_HERE/fleet_id: {{.NR_CLI_FLEET_ID}}/g' /etc/newrelic-super-agent/config.yaml fi - config_opamp: + config_fleet_control: status: - test -f /etc/newrelic-super-agent/.nr-cli cmds: - | if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" = "false" ]; then - sed -i '/^\s*opamp:/s/^/#/' /etc/newrelic-super-agent/config.yaml + sed -i '/^\s*fleet_control:/s/^/#/' /etc/newrelic-super-agent/config.yaml sed -i '/^\s*endpoint: https:\/\/opamp/s/^/#/' /etc/newrelic-super-agent/config.yaml else sed -i 's/s*#\s*opamp:/opamp:/g' /etc/newrelic-super-agent/config.yaml diff --git a/recipes/newrelic/infrastructure/super-agent/rhel.yml b/recipes/newrelic/infrastructure/super-agent/rhel.yml index af6f525b..ffbf9be6 100644 --- a/recipes/newrelic/infrastructure/super-agent/rhel.yml +++ b/recipes/newrelic/infrastructure/super-agent/rhel.yml @@ -105,7 +105,7 @@ install: - task: update_otel_license_key - task: config_supervisors - task: config_fleet_id - - task: config_opamp + - task: config_fleet_control - task: config_super_agent_auth - task: config_host_monitoring - task: update_otel_mem_limit @@ -381,16 +381,16 @@ install: sed -i 's/fleet_id: FLEET_ID_HERE/fleet_id: {{.NR_CLI_FLEET_ID}}/g' /etc/newrelic-super-agent/config.yaml fi - config_opamp: + config_fleet_control: status: - test -f /etc/newrelic-super-agent/.nr-cli cmds: - | if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" = "false" ]; then - sed -i '/^\s*opamp:/s/^/#/' /etc/newrelic-super-agent/config.yaml + sed -i '/^\s*fleet_control:/s/^/#/' /etc/newrelic-super-agent/config.yaml sed -i '/^\s*endpoint: https:\/\/opamp/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*#\s*fleet_control:/fleet_control:/g' /etc/newrelic-super-agent/config.yaml sed -i '/^\s*#\s*endpoint: https:\/\/opamp/s/# //' /etc/newrelic-super-agent/config.yaml fi - | diff --git a/recipes/newrelic/infrastructure/super-agent/suse.yml b/recipes/newrelic/infrastructure/super-agent/suse.yml index 1c10f434..43451a9b 100644 --- a/recipes/newrelic/infrastructure/super-agent/suse.yml +++ b/recipes/newrelic/infrastructure/super-agent/suse.yml @@ -71,7 +71,7 @@ install: - task: update_otel_license_key - task: config_supervisors - task: config_fleet_id - - task: config_opamp + - task: config_fleet_control - task: config_super_agent_auth - task: config_host_monitoring - task: update_otel_mem_limit @@ -328,16 +328,16 @@ install: sed -i 's/fleet_id: FLEET_ID_HERE/fleet_id: {{.NR_CLI_FLEET_ID}}/g' /etc/newrelic-super-agent/config.yaml fi - config_opamp: + config_fleet_control: status: - test -f /etc/newrelic-super-agent/.nr-cli cmds: - | if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" = "false" ]; then - sed -i '/^\s*opamp:/s/^/#/' /etc/newrelic-super-agent/config.yaml + sed -i '/^\s*fleet_control:/s/^/#/' /etc/newrelic-super-agent/config.yaml sed -i '/^\s*endpoint: https:\/\/opamp/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*#\s*fleet_control:/fleet_control:/g' /etc/newrelic-super-agent/config.yaml sed -i '/^\s*#\s*endpoint: https:\/\/opamp/s/# //' /etc/newrelic-super-agent/config.yaml fi - | From 0ff6e0c1d4aebce5159f42f0aa72b649eced38c7 Mon Sep 17 00:00:00 2001 From: rubenruizdegauna Date: Tue, 17 Dec 2024 16:17:21 +0100 Subject: [PATCH 3/6] fix(agent-control): rename Super Aagent to Agent Control (#1141) --- docs/recipe-spec/recipe-spec.md | 6 +- .../infrastructure/agent-control/debian.yml | 730 ++++++++++++++++++ .../agent-control/logs/linux-logs.yml | 274 +++++++ .../infrastructure/agent-control/rhel.yml | 673 ++++++++++++++++ .../infrastructure/agent-control/suse.yml | 620 +++++++++++++++ .../infrastructure/ohi/mysql/debian.yml | 8 +- .../debians/debian11-agent-control-eu.json | 35 + .../debians/ubuntu16-agent-control-eu.json | 35 + .../debians/ubuntu18-agent-control-eu.json | 35 + .../debians/ubuntu20-agent-control-eu.json | 37 + .../ubuntu20arm64-agent-control-eu.json | 37 + .../debians/ubuntu22-agent-control-eu.json | 37 + .../amazonlinux2-agent-control-logs-eu.json | 37 + ...amazonlinux2023-agent-control-logs-eu.json | 38 + .../logs/debian11-agent-control-logs-eu.json | 38 + .../logs/redhat8-agent-control-logs-eu.json | 37 + .../logs/redhat9-agent-control-logs-eu.json | 37 + .../logs/suse154-agent-control-logs-eu.json | 35 + .../logs/ubuntu20-agent-control-logs-eu.json | 38 + .../logs/ubuntu22-agent-control-logs-eu.json | 38 + .../rhel/awslinux23-agent-control-eu.json | 35 + .../rhel/awslinuxarm64-agent-control-eu.json | 34 + .../rhel/redhat8arm64-agent-control-eu.json | 34 + .../suse/suse125-agent-control-eu.json | 34 + .../suse/suse154-agent-control-eu.json | 34 + .../debians/debian11-agent-control.json | 35 + .../debians/ubuntu16-agent-control.json | 35 + .../debians/ubuntu18-agent-control.json | 35 + .../debians/ubuntu20-agent-control.json | 37 + .../debians/ubuntu20arm64-agent-control.json | 37 + .../debians/ubuntu22-agent-control.json | 37 + .../logs/amazonlinux2-agent-control-logs.json | 37 + ...nlinux2023-aarch64-agent-control-logs.json | 39 + ...mazonlinux2023-x86-agent-control-logs.json | 38 + .../logs/debian11-agent-control-logs.json | 38 + .../logs/redhat8-agent-control-logs.json | 37 + .../logs/redhat9-agent-control-logs.json | 37 + .../logs/suse154-agent-control-logs.json | 35 + .../logs/suse155-agent-control-logs.json | 37 + .../logs/ubuntu20-agent-control-logs.json | 38 + .../logs/ubuntu22-agent-control-logs.json | 38 + .../rhel/awslinux23-agent-control.json | 35 + .../rhel/awslinuxarm64-agent-control.json | 34 + .../rhel/redhat8arm64-agent-control.json | 34 + .../suse/suse125-agent-control.json | 34 + .../suse/suse154-agent-control.json | 34 + 46 files changed, 3750 insertions(+), 7 deletions(-) create mode 100644 recipes/newrelic/infrastructure/agent-control/debian.yml create mode 100644 recipes/newrelic/infrastructure/agent-control/logs/linux-logs.yml create mode 100644 recipes/newrelic/infrastructure/agent-control/rhel.yml create mode 100644 recipes/newrelic/infrastructure/agent-control/suse.yml create mode 100644 test/definitions-eu/agent-control/debians/debian11-agent-control-eu.json create mode 100644 test/definitions-eu/agent-control/debians/ubuntu16-agent-control-eu.json create mode 100644 test/definitions-eu/agent-control/debians/ubuntu18-agent-control-eu.json create mode 100644 test/definitions-eu/agent-control/debians/ubuntu20-agent-control-eu.json create mode 100644 test/definitions-eu/agent-control/debians/ubuntu20arm64-agent-control-eu.json create mode 100644 test/definitions-eu/agent-control/debians/ubuntu22-agent-control-eu.json create mode 100644 test/definitions-eu/agent-control/logs/amazonlinux2-agent-control-logs-eu.json create mode 100644 test/definitions-eu/agent-control/logs/amazonlinux2023-agent-control-logs-eu.json create mode 100644 test/definitions-eu/agent-control/logs/debian11-agent-control-logs-eu.json create mode 100644 test/definitions-eu/agent-control/logs/redhat8-agent-control-logs-eu.json create mode 100644 test/definitions-eu/agent-control/logs/redhat9-agent-control-logs-eu.json create mode 100644 test/definitions-eu/agent-control/logs/suse154-agent-control-logs-eu.json create mode 100644 test/definitions-eu/agent-control/logs/ubuntu20-agent-control-logs-eu.json create mode 100644 test/definitions-eu/agent-control/logs/ubuntu22-agent-control-logs-eu.json create mode 100644 test/definitions-eu/agent-control/rhel/awslinux23-agent-control-eu.json create mode 100644 test/definitions-eu/agent-control/rhel/awslinuxarm64-agent-control-eu.json create mode 100644 test/definitions-eu/agent-control/rhel/redhat8arm64-agent-control-eu.json create mode 100644 test/definitions-eu/agent-control/suse/suse125-agent-control-eu.json create mode 100644 test/definitions-eu/agent-control/suse/suse154-agent-control-eu.json create mode 100644 test/definitions/agent-control/debians/debian11-agent-control.json create mode 100644 test/definitions/agent-control/debians/ubuntu16-agent-control.json create mode 100644 test/definitions/agent-control/debians/ubuntu18-agent-control.json create mode 100644 test/definitions/agent-control/debians/ubuntu20-agent-control.json create mode 100644 test/definitions/agent-control/debians/ubuntu20arm64-agent-control.json create mode 100644 test/definitions/agent-control/debians/ubuntu22-agent-control.json create mode 100644 test/definitions/agent-control/logs/amazonlinux2-agent-control-logs.json create mode 100644 test/definitions/agent-control/logs/amazonlinux2023-aarch64-agent-control-logs.json create mode 100644 test/definitions/agent-control/logs/amazonlinux2023-x86-agent-control-logs.json create mode 100644 test/definitions/agent-control/logs/debian11-agent-control-logs.json create mode 100644 test/definitions/agent-control/logs/redhat8-agent-control-logs.json create mode 100644 test/definitions/agent-control/logs/redhat9-agent-control-logs.json create mode 100644 test/definitions/agent-control/logs/suse154-agent-control-logs.json create mode 100644 test/definitions/agent-control/logs/suse155-agent-control-logs.json create mode 100644 test/definitions/agent-control/logs/ubuntu20-agent-control-logs.json create mode 100644 test/definitions/agent-control/logs/ubuntu22-agent-control-logs.json create mode 100644 test/definitions/agent-control/rhel/awslinux23-agent-control.json create mode 100644 test/definitions/agent-control/rhel/awslinuxarm64-agent-control.json create mode 100644 test/definitions/agent-control/rhel/redhat8arm64-agent-control.json create mode 100644 test/definitions/agent-control/suse/suse125-agent-control.json create mode 100644 test/definitions/agent-control/suse/suse154-agent-control.json diff --git a/docs/recipe-spec/recipe-spec.md b/docs/recipe-spec/recipe-spec.md index 0f2628f1..39004af8 100644 --- a/docs/recipe-spec/recipe-spec.md +++ b/docs/recipe-spec/recipe-spec.md @@ -41,11 +41,11 @@ repository: string, required # dependencies: # - infrastructure-agent-installer # -# A special 'OR' variant for recipe dependencies involves the infrastructure and super agents. It allows the super-agent -# to be used as an alternative recipe dependency instead of the infrastructure-agent-installer when the super-agent is a targeted install: +# A special 'OR' variant for recipe dependencies involves the infrastructure and agent controls. It allows the agent-control +# to be used as an alternative recipe dependency instead of the infrastructure-agent-installer when the agent-control is a targeted install: # ex: # dependencies: -# - infrastructure-agent-installer || super-agent +# - infrastructure-agent-installer || agent-control dependencies: list, optional # Still TBD diff --git a/recipes/newrelic/infrastructure/agent-control/debian.yml b/recipes/newrelic/infrastructure/agent-control/debian.yml new file mode 100644 index 00000000..5a16c762 --- /dev/null +++ b/recipes/newrelic/infrastructure/agent-control/debian.yml @@ -0,0 +1,730 @@ +# Visit our schema definition for additional information on this file format. +# https://github.com/newrelic/open-install-library/blob/main/docs/recipe-spec/recipe-spec.md#schema-definition + +name: agent-control +displayName: Agent Control +description: New Relic install recipe for Agent Control +repository: https://github.com/newrelic/newrelic-agent-control + +installTargets: + - type: host + os: linux + platformFamily: debian + platformVersion: "(10|11|12)\\.*" # Buster, Bullseye, Bookworm # + - type: host + os: linux + platform: ubuntu + platformVersion: "(16|18|20|22|24)\\.04" + +keywords: + - AgentControl + - OpenTelemetry + - OTel + - Infrastructure + - Agent + - Linux + - Debian + - jammy + - focal + - bionic + - xenial + - bullseye + - buster + +processMatch: [] + +preInstall: + requireAtDiscovery: | + IS_DOCKER_CONTAINER_CGROUP=$(grep 'docker\|lxc' /proc/1/cgroup | wc -l) + if [ $IS_DOCKER_CONTAINER_CGROUP -gt 0 ] ; then + echo "docker detected with cgroup, unsupported" >&2 + exit 131 + fi + IS_DOCKER_CONTAINER_ENVIRON=$(grep container=lxc /proc/1/environ | wc -l) + if [ $IS_DOCKER_CONTAINER_ENVIRON -gt 0 ] ; then + echo "docker detected with environ, unsupported" >&2 + exit 131 + fi + if [ -f /.dockerenv ] ; then + echo "docker detected with .dockerenv, unsupported" >&2 + exit 131 + fi + IS_WSL_CONTAINER=$(grep -i 'Microsoft' /proc/version | wc -l) + if [ $IS_WSL_CONTAINER -gt 0 ] ; then + echo "microsoft Windows Subsystem for Linux for infra detected, unsupported" >&2 + exit 131 + fi + exit 0 + + discoveryMode: + - targeted +install: + version: "3" + silent: true + vars: + IS_SYSTEMCTL: + sh: command -v systemctl | wc -l + IS_INITCTL: + sh: command -v initctl | wc -l + tasks: + default: + cmds: + - task: write_recipe_metadata + - task: detect_previous_install + - task: assert_pre_req + - task: cleanup + - task: setup_infra_license + - task: setup_infra_proxy + - task: log_ssl_ciphers + - task: update_apt + - task: install_gnupg + - task: add_gpg_key + - task: add_nr_source + - task: update_apt_nr_source + - task: install_agent_control + - task: update_otel_license_key + - task: config_supervisors + - task: config_fleet_id + - task: config_fleet_control + - task: config_agent_control_auth + - task: config_host_monitoring + - task: update_otel_mem_limit + - task: update_otel_end_point + - task: migrate_newrelic_infra_config + - task: restart_agent_control + - task: assert_agent_control_status_ok + - task: signal_recipe_applied + - task: post_install + + write_recipe_metadata: + cmds: + - | + echo '{"Metadata":{"CapturedCliOutput":"true"}}' | tee {{.NR_CLI_OUTPUT}} > /dev/null + + detect_previous_install: + cmds: + - | + if [ -f /etc/newrelic-agent-control/.nr-cli ] ; then + echo "A previous execution of this installation was detected. Some installation tasks will be skipped." + echo "If you would like to run all the tasks, please remove the /etc/newrelic-agent-control/.nr-cli file and re-run the installation." + fi + + assert_pre_req: + cmds: + - | + IS_ROOT_OR_SUDO=$([ ! -z "$SUDO_USER" ] || [ $(whoami) = "root" ] && echo "true" || echo "false") # Assert root or sudo user + if [ "$IS_ROOT_OR_SUDO" = "false" ]; then + echo "This newrelic install must be run under sudo or root" >&2 + exit 3 + fi + - | + IS_GREP_INSTALLED=$(which grep | wc -l) + if [ $IS_GREP_INSTALLED -eq 0 ] ; then + echo "grep is required to run the newrelic install. Please install grep and re-run the installation." >&2 + exit 10 + fi + - | + IS_SED_INSTALLED=$(which sed | wc -l) + if [ $IS_SED_INSTALLED -eq 0 ] ; then + echo "sed is required to run the newrelic install. Please install sed and re-run the installation." >&2 + exit 11 + fi + - | + IS_AWK_INSTALLED=$(which awk | wc -l) + if [ $IS_AWK_INSTALLED -eq 0 ] ; then + echo "awk is required to run the newrelic install. Please install awk and re-run the installation." >&2 + exit 12 + fi + - | + IS_CAT_INSTALLED=$(which cat | wc -l) + if [ $IS_CAT_INSTALLED -eq 0 ] ; then + echo "cat is required to run the newrelic install. Please install cat and re-run the installation." >&2 + exit 13 + fi + - | + IS_TEE_INSTALLED=$(which tee | wc -l) + if [ $IS_TEE_INSTALLED -eq 0 ] ; then + echo "tee is required to run the newrelic install. Please install tee and re-run the installation." >&2 + exit 14 + fi + - | + IS_TOUCH_INSTALLED=$(which touch | wc -l) + if [ $IS_TOUCH_INSTALLED -eq 0 ] ; then + echo "touch is required to run the newrelic install. Please install touch and re-run the installation." >&2 + exit 15 + fi + - | + IS_CURL_INSTALLED=$(which curl | wc -l) + if [ $IS_CURL_INSTALLED -eq 0 ] ; then + echo "curl is required to run the newrelic install. Please install curl and re-run the installation." >&2 + exit 16 + fi + - | + IS_OPENSSL_INSTALLED=$(which openssl | wc -l) + if [ $IS_OPENSSL_INSTALLED -eq 0 ] ; then + echo "openssl is required to run the newrelic install. Please install openssl and re-run the installation." >&2 + exit 17 + fi + - | + IS_MKTEMP_INSTALLED=$(which mktemp | wc -l) + if [ $IS_MKTEMP_INSTALLED -eq 0 ] ; then + echo "mktemp is required to run the newrelic install. Please install coreutils and re-run the installation." >&2 + exit 18 + fi + - | + if [ -n "{{.DEBIAN_CODENAME}}" ]; then + IS_AGENT_AVAILABLE=$(curl -Is {{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/apt/dists/{{.DEBIAN_CODENAME}}/InRelease | grep " 2[0-9][0-9] " | wc -l) + if [ $IS_AGENT_AVAILABLE -eq 0 ] ; then + echo "there is no New Relic Agent Control available for the distribution with codename '{{.DEBIAN_CODENAME}}'." >&2 + exit 131 + fi + else + if [ -n "{{.DEBIAN_VERSION_CODENAME}}" ]; then + 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) + if [ $IS_INFRA_AVAILABLE -eq 0 ] ; then + echo "there is no New Relic Agent Control available for the distribution with version codename '{{.DEBIAN_VERSION_CODENAME}}'." >&2 + exit 131 + fi + else + echo "there is no New Relic Agent Control available for the distribution, no version codename was found." >&2 + exit 131 + fi + fi + vars: + DEBIAN_CODENAME: + sh: awk -F= '/VERSION_CODENAME/ {print $2}' /etc/os-release + DEBIAN_VERSION_CODENAME: + sh: cat /etc/os-release | grep "VERSION=\"[0-9] " | awk -F " " '{print $2}' | sed 's/[()"]//g' + + cleanup: + # skipping this task if .nr-cli exists + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then + rm -rf /var/db/newrelic-infra/data 2>/dev/null + fi + + setup_infra_license: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then + if [ -f /etc/newrelic-infra.yml ]; then + printf "\nAn existing newrelic-infra configuration file was detected. Updating where needed." + + sed -i "/^staging/d" /etc/newrelic-infra.yml + sed -i "/^enable_process_metrics/d" /etc/newrelic-infra.yml + sed -i "/^status_server_enabled/d" /etc/newrelic-infra.yml + sed -i "/^status_server_port/d" /etc/newrelic-infra.yml + sed -i "/^license_key/d" /etc/newrelic-infra.yml + sed -i '/^custom_attributes:/,/^\S/{ /^\S/!d }' /etc/newrelic-infra.yml + sed -i '/^custom_attributes:/d' /etc/newrelic-infra.yml + sed -i "/^is_integrations_only/d" /etc/newrelic-infra.yml + + if [ "{{.NR_AC_MIGRATE_INFRA_CONFIG}}" == "true" ] || [ "{{.NEW_RELIC_ASSUME_YES}}" == "true" ] ; then + touch /etc/newrelic-infra-do-migrate + else + printf "\nWould you like to migrate this newrelic-infra config to use it with New Relic Agent Control? (y/N): " + read -r MIGRATE_NEWRELIC_INFRA_CONFIG + MIGRATE_NEWRELIC_INFRA_CONFIG=${MIGRATE_NEWRELIC_INFRA_CONFIG:-N} + + if [ "$MIGRATE_NEWRELIC_INFRA_CONFIG" == "y" ] ; then + touch /etc/newrelic-infra-do-migrate + fi + fi + else + touch /etc/newrelic-infra.yml + # If we are creating a new file, perform the migration as well + touch /etc/newrelic-infra-do-migrate + fi + fi + - | + if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then + if [ $(echo {{.NEW_RELIC_REGION}} | grep -i staging | wc -l) -gt 0 ]; then + echo 'staging: true' >> /etc/newrelic-infra.yml + fi + 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 '{{.NRIA_CUSTOM_ATTRIBUTES}}' >> /etc/newrelic-infra.yml + fi + setup_infra_proxy: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] && [ ! -z "$HTTPS_PROXY" ]; then + sed -i "/^proxy/d" /etc/newrelic-infra.yml + echo 'proxy: {{.HTTPS_PROXY}}' >> /etc/newrelic-infra.yml + fi + + log_ssl_ciphers: + cmds: + - | + IS_SORT_INSTALLED=$(which sort | wc -l) + IS_UNIQ_INSTALLED=$(which uniq | wc -l) + if [ $IS_SORT_INSTALLED -gt 0 ] && [ $IS_UNIQ_INSTALLED -gt 0 ]; then + echo "Detecting available SSL ciphers..." + openssl ciphers -v | awk '{print " - " $2}' | sort | uniq + fi + ignore_error: true + + update_apt: + cmds: + - | + # Get latest definitions and skip any failure because of deprecation + OPTIONS="-o DPkg::Lock::Timeout=60 -o Acquire::Check-Valid-Until=false" + if [ ! -z "$HTTPS_PROXY" ]; then + OPTIONS="$OPTIONS -o Acquire::Http::Proxy={{.HTTPS_PROXY}}" + fi + apt-get $OPTIONS update -yq + silent: true + # apt will return an error if fails to update any of its sources. Ignore these errors and let the "install_infra" task fail. + ignore_error: true + + install_gnupg: + cmds: + - | + if [ {{.HAS_GPG}} -eq 0 ] ; then + OPTIONS="-o DPkg::Lock::Timeout=60" + if [ ! -z "$HTTPS_PROXY" ]; then + OPTIONS="$OPTIONS -o Acquire::Http::Proxy={{.HTTPS_PROXY}}" + fi + apt-get $OPTIONS install gnupg2 -y + fi + vars: + HAS_GPG: + sh: command -v gpg | wc -l + + add_gpg_key: + cmds: + - | + curl -s {{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/keys/newrelic_apt_key_current.gpg | apt-key add - + silent: true + + add_nr_source: + cmds: + - | + ARCH="amd64" + IS_ARM=$(uname -m | grep -i 'aarch64' | wc -l) + if [ $IS_ARM -gt 0 ] ; then + ARCH="arm64" + fi + + if [ -n "{{.DEBIAN_CODENAME}}" ]; then + printf "deb [arch="$ARCH"] {{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/linux/apt {{.DEBIAN_CODENAME}} main" | tee /etc/apt/sources.list.d/newrelic-infra.list > /dev/null + printf "\ndeb [arch="$ARCH"] {{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/apt {{.DEBIAN_CODENAME}} main" | tee -a /etc/apt/sources.list.d/newrelic-infra.list > /dev/null + else + printf "deb [arch="$ARCH"] {{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/linux/apt {{.DEBIAN_VERSION_CODENAME}} main" | tee /etc/apt/sources.list.d/newrelic-infra.list > /dev/null + printf "\ndeb [arch="$ARCH"] {{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/apt {{.DEBIAN_VERSION_CODENAME}} main" | tee -a /etc/apt/sources.list.d/newrelic-infra.list > /dev/null + fi + vars: + DEBIAN_CODENAME: + sh: awk -F= '/VERSION_CODENAME/ {print $2}' /etc/os-release + DEBIAN_VERSION_CODENAME: + sh: cat /etc/os-release | grep "VERSION=\"[0-9] " | awk -F " " '{print $2}' | sed 's/[()"]//g' + silent: true + + update_apt_nr_source: + cmds: + - | + # Get latest definitions and skip any failure because of deprecation + OPTIONS="-o DPkg::Lock::Timeout=60 -o Acquire::Check-Valid-Until=false" + if [ ! -z "$HTTPS_PROXY" ]; then + OPTIONS="$OPTIONS -o Acquire::Http::Proxy={{.HTTPS_PROXY}}" + fi + apt-get $OPTIONS update -yq + # apt will return an error if fails to update any of its sources. Ignore these errors and let the "install_infra" task fail. Just to trigger the pipeline + ignore_error: true + + install_agent_control: + cmds: + - | + OPTIONS="-o DPkg::Lock::Timeout=60" + if [ ! -z "$HTTPS_PROXY" ]; then + OPTIONS="$OPTIONS -o Acquire::Http::Proxy={{.HTTPS_PROXY}}" + fi + apt-get $OPTIONS install newrelic-agent-control -y -qq + # Check the exit status of the previous command + if [ $? -ne 0 ]; then + echo "Error: newrelic-agent-control installation failed" + echo "Attempting to configure the packages again" + dpkg --configure -a + # Check if there was an error + if [ $? -ne 0 ]; then + echo "Error found while reconfiguring dpkg database" + # Force-Install the Software + echo "Attempting to install any missing dependencies or fixes broken packages." + apt-get $OPTIONS install -f + if [ $? -ne 0 ]; then + exit 1 + fi + echo "Installation is successful" + fi + fi + silent: true + + # If configured to do so, migrate the newrelic-infra configuration for usage with New Relic Agent Control + migrate_newrelic_infra_config: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ -f /etc/newrelic-infra-do-migrate ]; then + rm /etc/newrelic-infra-do-migrate + newrelic-config-migrate + fi + + # Add NR Ingest Key as ENV Var for the agent-control Systemd service (used by Infra Agent and Otel) + update_otel_license_key: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + sed -i "/^NEW_RELIC_LICENSE_KEY/d" /etc/newrelic-agent-control/newrelic-agent-control.conf + echo 'NEW_RELIC_LICENSE_KEY="{{.NEW_RELIC_LICENSE_KEY}}"' >> /etc/newrelic-agent-control/newrelic-agent-control.conf + + update_otel_mem_limit: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then + sed -i "s/limit_mib: .*$/limit_mib: 100/g" /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + fi + + # Add OTLP Endpoint as ENV Var for the Agent Control Systemd service + update_otel_end_point: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then + if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then + sed -i "s/endpoint: .*$/endpoint: https:\/\/staging-otlp.nr-data.net:4317/g" /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then + sed -i "s/endpoint: .*$/endpoint: https:\/\/otlp.eu01.nr-data.net:4317/g" /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + else + sed -i "s/endpoint: .*$/endpoint: https:\/\/otlp.nr-data.net:4317/g" /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + fi + fi + + config_supervisors: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ]; then + cp /etc/newrelic-agent-control/examples/agent-control-config-no-agents.yaml /etc/newrelic-agent-control/config.yaml + elif [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ]; then + cp /etc/newrelic-agent-control/examples/agent-control-config-nr-otel-collector.yaml /etc/newrelic-agent-control/config.yaml + elif [ "{{.NR_CLI_NRDOT}}" = "false" ]; then + cp /etc/newrelic-agent-control/examples/agent-control-config-nr-infra-agent.yaml /etc/newrelic-agent-control/config.yaml + else + cp /etc/newrelic-agent-control/examples/agent-control-config-all-agents.yaml /etc/newrelic-agent-control/config.yaml + fi + + config_fleet_id: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ ! -z "{{.NR_CLI_FLEET_ID}}" ] ; then + sed -i 's/^#\s*fleet_id:/fleet_id:/g' /etc/newrelic-agent-control/config.yaml + sed -i 's/fleet_id: FLEET_ID_HERE/fleet_id: {{.NR_CLI_FLEET_ID}}/g' /etc/newrelic-agent-control/config.yaml + fi + + config_fleet_control: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_FLEET_ENABLED}}" = "false" ]; then + sed -i '/^\s*fleet_control:/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*endpoint: https:\/\/opamp/s/^/#/' /etc/newrelic-agent-control/config.yaml + else + sed -i 's/s*#\s*opamp:/opamp:/g' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*endpoint: https:\/\/opamp/s/# //' /etc/newrelic-agent-control/config.yaml + fi + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_FLEET_ENABLED}}" = "false" ]; then + sed -i '/^\s*api-key:/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*headers:/s/^/#/' /etc/newrelic-agent-control/config.yaml + else + sed -i '/^\s*#\s*api-key:/s/# //' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*headers:/s/# //' /etc/newrelic-agent-control/config.yaml + fi + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_FLEET_ENABLED}}" != "false" ] ; then + sed -i 's/api-key: API_KEY_HERE/api-key: {{ .NEW_RELIC_LICENSE_KEY }}/g' /etc/newrelic-agent-control/config.yaml + fi + - | + if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then + sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"staging-service.newrelic.com\/v1\/opamp"'/' /etc/newrelic-agent-control/config.yaml + elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then + sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"service.eu.newrelic.com\/v1\/opamp"'/' /etc/newrelic-agent-control/config.yaml + else + sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"service.newrelic.com\/v1\/opamp"'/' /etc/newrelic-agent-control/config.yaml + fi + + config_agent_control_auth: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_FLEET_ENABLED}}" != "false" ] && [ "{{ .NEW_RELIC_ORGANIZATION }}" != "" ]; then + sed -i '/^\s*#\s*auth_config:\s*$/s/# //' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*token_url: PLACEHOLDER/s/# //' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*client_id: PLACEHOLDER/s/# //' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*provider: PLACEHOLDER/s/# //' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*private_key_path: PLACEHOLDER/s/# //' /etc/newrelic-agent-control/config.yaml + else + sed -i '/^\s*auth_config:/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*token_url: PLACEHOLDER/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*client_id: PLACEHOLDER/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*provider: PLACEHOLDER/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*private_key_path: PLACEHOLDER/s/^/#/' /etc/newrelic-agent-control/config.yaml + fi + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_FLEET_ENABLED}}" != "false" ] && [ "{{ .NEW_RELIC_ORGANIZATION }}" != "" ]; then + set -uo pipefail + + mkdir -p /etc/newrelic-agent-control/keys + chown root:root /etc/newrelic-agent-control/keys + chmod 700 /etc/newrelic-agent-control/keys + + TEMPORAL_FOLDER=$(mktemp -d newrelic-agent-control.XXXXXXXXXX) + chown root:root "${TEMPORAL_FOLDER}" + chmod 700 "${TEMPORAL_FOLDER}" + trap "rm -rf $TEMPORAL_FOLDER" EXIT + openssl genrsa -out "$TEMPORAL_FOLDER/key" 4096 + openssl rsa -in "$TEMPORAL_FOLDER/key" -pubout -out "$TEMPORAL_FOLDER/pub" + + if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then + REGISTRATION_ENDPOINT=https://staging-api.newrelic.com/graphql + TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.staging-service.newrelic.com/oauth2/token + IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.staging-service.nr-ops.net/system-identity/graphql + elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then + REGISTRATION_ENDPOINT=https://api.eu.newrelic.com/graphql + TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.service.newrelic.com/oauth2/token + IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.service.eu.nr-ops.net/system-identity/graphql + else + REGISTRATION_ENDPOINT=https://api.newrelic.com/graphql + TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.service.newrelic.com/oauth2/token + IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.service.nr-ops.net/system-identity/graphql + fi + + ############################################################ + # Get the L1 Access Token + ############################################################ + if [ "{{.NEW_RELIC_AUTH_CLIENT_ID}}" != "" ] && [ "{{.NEW_RELIC_AUTH_CLIENT_SECRET}}" != "" ]; then + RESPONSE_FILE=$TEMPORAL_FOLDER/response_token.json + for RETRY in 1 2 3; do + HTTP_CODE=$(echo '{"client_id": "{{.NEW_RELIC_AUTH_CLIENT_ID}}", "client_secret": "{{.NEW_RELIC_AUTH_CLIENT_SECRET}}", "grant_type": "client_credentials"}' | tr -d $'\n' | curl \ + -s -w "%{http_code}" \ + -H "Content-Type: application/json" \ + -o "$RESPONSE_FILE" \ + --data-binary @- \ + "$TOKEN_RENEWAL_ENDPOINT" + ) + + if [ $HTTP_CODE -eq 200 ]; then + break + fi + + ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.error_description // "invalid_request"' < "$TEMPORAL_FOLDER/response_token.json" | tr -d '"') + + echo "Error getting system identity auth token. The API endpoint returned $HTTP_CODE: $ERROR_MESSAGE. Retrying ($RETRY/3)..." + sleep 2 + done + + if [ $HTTP_CODE -ne 200 ]; then + echo "Error getting system identity auth token" + exit 99 + fi + + ACCESS_TOKEN=$(/usr/local/bin/newrelic utils jq '.access_token' < "$RESPONSE_FILE" | tr -d '"' ) + + ############################################################ + # Create System Identity + ############################################################ + DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + NAME="System Identity for $(hostname) - $DATE" + + for RETRY in 1 2 3; do + HTTP_CODE=$(echo '{ "query": + "mutation { + create( + name: \"'$NAME'\", + organizationId: \"{{ .NEW_RELIC_ORGANIZATION }}\", + publicKey: \"'$(openssl enc -base64 -A -in "$TEMPORAL_FOLDER/pub")'\" + ) { + clientId, + name + } + }" + }' | tr -d $'\n' | curl \ + -s -w "%{http_code}" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $ACCESS_TOKEN" \ + -o "$TEMPORAL_FOLDER/response.json" \ + --data-binary @- \ + "$IDENTITY_CREATION_ENDPOINT" + ) + + if [ $HTTP_CODE -eq 200 ]; then + break + fi + + echo "Error creating L2 system identity. The API endpoint returned $HTTP_CODE. Retrying ($RETRY/3)..." + sleep 2 + done + + if [ $HTTP_CODE -ne 200 ]; then + exit 99 + fi + + ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.errors[0].message // "NOERROR"' < "$TEMPORAL_FOLDER/response.json" | tr -d '"') + if [ "$ERROR_MESSAGE" != "NOERROR" ]; then + echo "Failed to create a New Relic System Identity for Fleet Control communication authentication. Please verify that your User Key is valid and that your Account Organization has the necessary permissions to create a System Identity: $ERROR_MESSAGE" + exit 100 + fi + + CLIENT_ID=$(/usr/local/bin/newrelic utils jq '.data.create.clientId' < "$TEMPORAL_FOLDER/response.json" | tr -d '"' ) + else + ############################################################ + # Create System Identity (Legacy) + ############################################################ + DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + NAME="System Identity for $(hostname) - $DATE" + + for RETRY in 1 2 3; do + HTTP_CODE=$(echo '{ "query": + "mutation { + systemIdentityCreate( + name: \"'$NAME'\", + organizationId: \"{{ .NEW_RELIC_ORGANIZATION }}\", + publicKey: \"'$(openssl enc -base64 -A -in "$TEMPORAL_FOLDER/pub")'\" + ) { + clientId, + name + } + }" + }' | tr -d $'\n' | curl \ + -s -w "%{http_code}" \ + -H "Content-Type: application/json" \ + -H "API-Key: {{ .NEW_RELIC_API_KEY }}" \ + -o "$TEMPORAL_FOLDER/response.json" \ + --data-binary @- \ + "$REGISTRATION_ENDPOINT" + ) + + if [ $HTTP_CODE -eq 200 ]; then + break + fi + + echo "Error creating the new system identity. The API endpoint returned $HTTP_CODE. Retrying ($RETRY/3)..." + sleep 2 + done + + if [ $HTTP_CODE -ne 200 ]; then + exit 99 + fi + + ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.errors[0].message // "NOERROR"' < "$TEMPORAL_FOLDER/response.json" | tr -d '"') + if [ "$ERROR_MESSAGE" != "NOERROR" ]; then + echo "Failed to create a New Relic System Identity for Fleet Control communication authentication. Please verify that your User Key is valid and that your Account Organization has the necessary permissions to create a System Identity: $ERROR_MESSAGE" + exit 100 + fi + + CLIENT_ID=$(/usr/local/bin/newrelic utils jq '.data.systemIdentityCreate.clientId' < "$TEMPORAL_FOLDER/response.json" | tr -d '"' ) + fi + + mv "$TEMPORAL_FOLDER/key" "/etc/newrelic-agent-control/keys/$CLIENT_ID.key" + sed -i 's~token_url: PLACEHOLDER~token_url: '"$TOKEN_RENEWAL_ENDPOINT"'~g' /etc/newrelic-agent-control/config.yaml + sed -i 's/client_id: PLACEHOLDER/client_id: '"$CLIENT_ID"'/g' /etc/newrelic-agent-control/config.yaml + sed -i 's/provider: PLACEHOLDER/provider: local/g' /etc/newrelic-agent-control/config.yaml + sed -i 's~private_key_path: PLACEHOLDER~private_key_path: '"/etc/newrelic-agent-control/keys/$CLIENT_ID.key"'~g' /etc/newrelic-agent-control/config.yaml + fi + + config_host_monitoring: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_HOST_MONITORING_SOURCE}}" = "otel" ]; then + echo 'is_integrations_only: true' >> /etc/newrelic-infra.yml + mkdir -p /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values + cp /etc/newrelic-agent-control/examples/values-nr-otel-collector-agent-linux.yaml /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + else + if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then + mkdir -p /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values + cp /etc/newrelic-agent-control/examples/values-nr-otel-collector-gateway.yaml /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + fi + fi + + restart_agent_control: + cmds: + - | + if [ {{.IS_SYSTEMCTL}} -gt 0 ]; then + systemctl restart newrelic-agent-control + else + if [ {{.IS_INITCTL}} -gt 0 ]; then + initctl restart newrelic-agent-control + else + /etc/init.d/newrelic-agent-control restart + fi + fi + + assert_agent_control_status_ok: + cmds: + - | + MAX_RETRIES=150 + TRIES=0 + echo "Running agent status check attempt..." + # wait for status endpoint to be ready + while [ $TRIES -lt $MAX_RETRIES ]; do + ((TRIES++)) + statusCheckOutput=$(curl -s http://localhost:51200/status) + if [ -z "$statusCheckOutput" ]; then + # so jq doesn't fail if empty + statusCheckOutput="{}" + fi + STATUS=$(echo $statusCheckOutput | /usr/local/bin/newrelic utils jq '.agent_control.healthy') + if [ "$STATUS" == "true" ]; then + echo "Agent status check ok." + break + else + if [ "$TRIES" -eq "$MAX_RETRIES" ]; then + # Process-based validation attempt + IS_AGENT_INSTALLED=$(ps aux | grep newrelic-agent-control | grep -v grep | wc -l) + if [ $IS_AGENT_INSTALLED -gt 0 ] ; then + echo "detected newrelic-agent-control process running" + exit 0 + fi + + 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 + + if [ {{.IS_SYSTEMCTL}} -gt 0 ]; then + journalctl -u newrelic-agent-control --no-pager + fi + + exit 31 + fi + fi + + sleep 2 + done + + signal_recipe_applied: + cmds: + - | + touch /etc/newrelic-agent-control/.nr-cli + + post_install: + info: |2 + ⚙️ New Relic Agent Control configuration file can be found in /etc/newrelic-agent-control/config.yaml diff --git a/recipes/newrelic/infrastructure/agent-control/logs/linux-logs.yml b/recipes/newrelic/infrastructure/agent-control/logs/linux-logs.yml new file mode 100644 index 00000000..d2d9c4ec --- /dev/null +++ b/recipes/newrelic/infrastructure/agent-control/logs/linux-logs.yml @@ -0,0 +1,274 @@ +# Visit our schema definition for additional information on this file format +# https://github.com/newrelic/open-install-library/blob/main/docs/recipe-spec/recipe-spec.md#schema-definition + +name: logs-integration-agent-control +displayName: Logs Integration +description: New Relic install recipe for Logging in agent-control +repository: https://github.com/newrelic/infrastructure-agent/tree/master/assets/examples/logging + +installTargets: + - type: host + os: linux + platform: amazon + platformVersion: "2" # Required to override linux-unsupported + kernelArch: x86_64 + - type: host + os: linux + platform: amazon + platformVersion: "2022" + kernelArch: x86_64 + - type: host + os: linux + platform: amazon + platformVersion: "(2023\\.*)" + kernelArch: x86_64 + - type: host + os: linux + platform: "debian" + platformVersion: "((8|9|10|11|12)\\.?.*)" # Jessie, Buster, Strecht + kernelArch: x86_64 + - type: host + os: linux + platform: "ubuntu" + platformVersion: "(((16|18|20|21|22|24)\\.04)|(20.10))" # Xenial, Bionic, Focal, Hirsute, Jammy, Groovy + - type: host + os: linux + platform: "redhat" + platformFamily: rhel + platformVersion: "((7|8|9)\\.?.*)" + - type: host + os: linux + platform: "centos" + platformFamily: rhel + platformVersion: "((7|8|9)\\.?.*)" + - type: host + os: linux + platformFamily: suse + platformVersion: "(15\\.[1-5]|15-SP[1-5])" + kernelArch: x86_64 + # ARM supported + - type: host + os: linux + platform: amazon + platformVersion: "2" + kernelArch: aarch64 + - type: host + os: linux + platform: "debian" + platformVersion: "((8|9|10|11|12)\\.?.*)" # Jessie, Buster, Strecht + kernelArch: aarch64 + - type: host + os: linux + platform: "ubuntu" + platformVersion: "(((16|18|20|21|22)\\.04)|(20.10))" # Xenial, Bionic, Focal, Hirsute, Jammy, Groovy + kernelArch: aarch64 + - type: host + os: linux + platform: "centos" + platformFamily: rhel + platformVersion: "((7|8)\\.?.*)" + kernelArch: aarch64 + - type: host + os: linux + platform: amazon + platformVersion: "(2023\\.*)" + kernelArch: aarch64 + # Fluent Bit supported is not available for Suse aarch64 + # - type: host + # os: linux + # platformFamily: suse + # platformVersion: "(15\\.[1-5]|15-SP[1-5])" + # kernelArch: aarch64 + +keywords: + - Logs + +processMatch: [] + +preInstall: + discoveryMode: + - targeted + +install: + version: "3" + silent: true + + tasks: + default: + cmds: + - task: assert_pre_req + - task: init + - task: setup + - task: logEvent + + assert_pre_req: + cmds: + - | + IS_ROOT_OR_SUDO=$([ ! -z "$SUDO_USER" ] || [ $(whoami) = "root" ] && echo "true" || echo "false") # Assert root or sudo user + if [ "$IS_ROOT_OR_SUDO" = "false" ]; then + echo "This newrelic install must be run under sudo or root" >&2 + exit 3 + fi + - | + # Map of tool names to the associated error code + required_tools_and_error_codes="grep:10 sed:11 tee:14 touch:15" + + for tuple in $required_tools_and_error_codes; do + tool=$(echo ${tuple} |cut -d':' -f1) + code=$(echo ${tuple} |cut -d':' -f2) + + IS_TOOL_INSTALLED=$(which ${tool} | wc -l) + if [ "$IS_TOOL_INSTALLED" -eq 0 ]; then + echo "This installation recipe on Linux requires '${tool}' to be installed." >&2 + exit ${code} + fi + done + + init: + cmds: + - | + if [ -f /etc/newrelic-infra/logging.d/logging.yml ]; then + rm /etc/newrelic-infra/logging.d/logging.yml; + fi + - | + if [ -f /etc/newrelic-infra/logging.d/discovered.yml ]; then + rm /etc/newrelic-infra/logging.d/discovered.yml; + fi + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_HOST_MONITORING_SOURCE}}" != "otel" ]; then + mkdir -p "/etc/newrelic-infra/logging.d" + touch /etc/newrelic-infra/logging.d/logging.yml; + touch /etc/newrelic-infra/logging.d/discovered.yml; + fi + + setup: + cmds: + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_HOST_MONITORING_SOURCE}}" != "otel" ]; then + NR_CLI_SKIP_LOGS={{.NR_CLI_SKIP_LOGS}} + target_log_files=() + target_discovered_log_files=() + source_log_files=("/var/log/alternatives.log") + source_log_files+=("/var/log/cloud-init.log") + source_log_files+=("/var/log/auth.log") + source_log_files+=("/var/log/dpkg.log") + source_log_files+=("/var/log/syslog") + source_log_files+=("/var/log/messages") + source_log_files+=("/var/log/secure") + source_log_files+=("/var/log/yum.log") + + for log_file in "${source_log_files[@]}" + do + file_exist=$(ls $log_file 2>1 | wc -l) + if [ $file_exist -gt 0 ]; then + target_log_files+=($log_file) + fi + done + + discoveredLogFiles=$(echo -n "{{.NR_DISCOVERED_LOG_FILES | trim}}") + discoveredLogsStringLength=${#discoveredLogFiles} + # Disable glob expansion (necessary for discovered logs) + set -f + if [ $discoveredLogsStringLength -gt 0 ]; then + for filePath in $(echo -n $discoveredLogFiles | sed "s/,/ /g"); do + target_discovered_log_files+=($filePath) + done + fi + + file_exist=$(find /var/lib/docker/containers -name "*.log" 2>1 | wc -l) + if [ $file_exist -gt 0 ]; then + target_log_files+=("/var/lib/docker/containers/*/*.log") + fi + + if [[ "$NR_CLI_SKIP_LOGS" == "true" ]] ; then + target_log_files=() + target_discovered_log_files=() + fi + + target_log_files+=({{.NEW_RELIC_CLI_LOG_FILE_PATH}}) + + echo "logs:" | tee /etc/newrelic-infra/logging.d/logging.yml > /dev/null + for log_file in "${target_log_files[@]}" + do + if [ "$log_file" == "/var/lib/docker/containers/*/*.log" ]; then + echo -e " - name: containers\n file: /var/lib/docker/containers/*/*.log" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null + else + NAME=$(basename $log_file) + echo -e " - name: $NAME" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null + echo -e " file: $log_file" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null + if [[ "$NAME" == "newrelic-cli.log" ]]; then + echo -e " attributes:\n newrelic-cli: true" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null + echo -e " logtype: newrelic-cli" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null + fi + if [[ "$NAME" == "alternatives.log" ]]; then + echo -e " attributes:\n logtype: linux_alternatives" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null + fi + if [[ "$NAME" == "cloud-init.log" ]]; then + echo -e " attributes:\n logtype: linux_cloud-init" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null + fi + if [[ "$NAME" == "auth.log" ]]; then + echo -e " attributes:\n logtype: linux_auth" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null + fi + if [[ "$NAME" == "dpkg.log" ]]; then + echo -e " attributes:\n logtype: linux_dpkg" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null + fi + if [[ "$NAME" == "syslog" ]]; then + echo -e " attributes:\n logtype: linux_syslog" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null + fi + if [[ "$NAME" == "messages" ]]; then + echo -e " attributes:\n logtype: linux_messages" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null + fi + if [[ "$NAME" == "secure" ]]; then + echo -e " attributes:\n logtype: linux_secure" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null + fi + if [[ "$NAME" == "yum.log" ]]; then + echo -e " attributes:\n logtype: linux_yum" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null + fi + fi + done + + if [ ${#target_discovered_log_files[@]} -gt 0 ]; then + echo "logs:" | tee /etc/newrelic-infra/logging.d/discovered.yml > /dev/null + + # index is incremented to facilitate dynamic name values for each discovered log file path + index=0 + for filePath in $(echo -n $discoveredLogFiles | sed "s/,/ /g"); do + + echo -e " - name: configured-logs-$index" | tee -a /etc/newrelic-infra/logging.d/discovered.yml > /dev/null + echo -e " file: $filePath" | tee -a /etc/newrelic-infra/logging.d/discovered.yml > /dev/null + + if [[ $filePath == *"nginx/error"* ]]; then + echo -e " attributes:\n logtype: nginx-error" | tee -a /etc/newrelic-infra/logging.d/discovered.yml > /dev/null + fi + if [[ $filePath == *"nginx/access"* ]]; then + echo -e " attributes:\n logtype: nginx" | tee -a /etc/newrelic-infra/logging.d/discovered.yml > /dev/null + fi + + if [[ $filePath == *"mysql/error"* ]]; then + echo -e " attributes:\n logtype: mysql-error" | tee -a /etc/newrelic-infra/logging.d/discovered.yml > /dev/null + fi + + index=$((index+1)) + done + fi + fi + + logEvent: + cmds: + # Wait to give the services time to get going with the new configuration and plugin startup + - | + sleep 10 + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_HOST_MONITORING_SOURCE}}" != "otel" ]; then + echo "Log configuration:" | tee -a {{.NEW_RELIC_CLI_LOG_FILE_PATH}} > /dev/null + cat /etc/newrelic-infra/logging.d/logging.yml | tee -a {{.NEW_RELIC_CLI_LOG_FILE_PATH}} > /dev/null + echo "Log installation completed" | tee -a {{.NEW_RELIC_CLI_LOG_FILE_PATH}} > /dev/null + fi + +postInstall: + info: |2 + ⚙️ If NEW_RELIC_AGENT_CONTROL_HOST_MONITORING_SOURCE was set to 'newrelic': + ⚙️ The Logs configuration file (base configuration) can be found in /etc/newrelic-infra/logging.d/logging.yml + ⚙️ The Logs configuration file for discovered processes can be found in /etc/newrelic-infra/logging.d/discovered.yml + Edit these files to make changes or configure advanced features for the Logs integration. See the docs for options: + https://docs.newrelic.com/docs/logs/enable-log-management-new-relic/enable-log-monitoring-new-relic/forward-your-logs-using-infrastructure-agent#parameters diff --git a/recipes/newrelic/infrastructure/agent-control/rhel.yml b/recipes/newrelic/infrastructure/agent-control/rhel.yml new file mode 100644 index 00000000..d8a5a92d --- /dev/null +++ b/recipes/newrelic/infrastructure/agent-control/rhel.yml @@ -0,0 +1,673 @@ +# Visit our schema definition for additional information on this file format. +# https://github.com/newrelic/open-install-library/blob/main/docs/recipe-spec/recipe-spec.md#schema-definition + +name: agent-control +displayName: Agent Control +description: New Relic install recipe for Agent Control +repository: https://github.com/newrelic/newrelic-agent-control + +installTargets: + - type: host + os: linux + platform: amazon + - type: host + os: linux + platform: amazon + platformVersion: "2" + - type: host + os: linux + platform: amazon + platformVersion: "2023" + - type: host + os: linux + platform: centos + platformVersion: "(7|8|9)\\.*" + - type: host + os: linux + platform: oracle + platformVersion: "(7|8|9)\\.*" + - type: host + os: linux + platform: redhat + platformVersion: "(7|8|9)\\.*" + +keywords: + - AgentControl + - OpenTelemetry + - OTel + - Infrastructure + - Agent + - Linux + - CentOS 7 + - CentOS 8 + - RHEL 7 + - RHEL 8 + - RHEL 9 + - Amazon Linux + - Amazon Linux AMI + - Amazon Linux 2 + - Amazon Linux 2023 + +processMatch: [] + +preInstall: + requireAtDiscovery: | + IS_DOCKER_CONTAINER_CGROUP=$(grep 'docker\|lxc' /proc/1/cgroup | wc -l) + if [ $IS_DOCKER_CONTAINER_CGROUP -gt 0 ] ; then + echo "docker detected with cgroup, unsupported" >&2 + exit 131 + fi + IS_DOCKER_CONTAINER_ENVIRON=$(grep container=lxc /proc/1/environ | wc -l) + if [ $IS_DOCKER_CONTAINER_ENVIRON -gt 0 ] ; then + echo "docker detected with environ, unsupported" >&2 + exit 131 + fi + if [ -f /.dockerenv ] ; then + echo "docker detected with .dockerenv, unsupported" >&2 + exit 131 + fi + IS_WSL_CONTAINER=$(grep -i 'Microsoft' /proc/version | wc -l) + if [ $IS_WSL_CONTAINER -gt 0 ] ; then + echo "microsoft Windows Subsystem for Linux for infra detected, unsupported" >&2 + exit 131 + fi + exit 0 + + discoveryMode: + - targeted + +install: + version: "3" + silent: true + + vars: + AMAZON_LINUX_VERSION: + sh: awk -F= '/VERSION_ID/ {print $2}' /etc/os-release + REPO_DIR: + sh: if [ {{.AMAZON_LINUX_VERSION}} = "2" ] || [ {{.AMAZON_LINUX_VERSION}} = "2023" ]; then echo "amazonlinux"; else echo "el"; fi + ARCH: + sh: uname -m + IS_SYSTEMCTL: + sh: command -v systemctl | wc -l + IS_INITCTL: + sh: command -v initctl | wc -l + + tasks: + default: + cmds: + - task: write_recipe_metadata + - task: detect_previous_install + - task: assert_pre_req + - task: cleanup + - task: setup_infra_license + - task: setup_infra_proxy + - task: install_agent_control + - task: update_otel_license_key + - task: config_supervisors + - task: config_fleet_id + - task: config_fleet_control + - task: config_agent_control_auth + - task: config_host_monitoring + - task: update_otel_mem_limit + - task: update_otel_end_point + - task: migrate_newrelic_infra_config + - task: restart_agent_control + - task: assert_agent_control_status_ok + - task: signal_recipe_applied + - task: post_install + + write_recipe_metadata: + cmds: + - | + echo '{"Metadata":{"CapturedCliOutput":"true"}}' | tee {{.NR_CLI_OUTPUT}} > /dev/null + + detect_previous_install: + cmds: + - | + if [ -f /etc/newrelic-agent-control/.nr-cli ] ; then + echo "A previous execution of this installation was detected. Some installation tasks will be skipped." + echo "If you would like to run all the tasks, please remove the /etc/newrelic-agent-control/.nr-cli file and re-run the installation." + fi + + assert_pre_req: + cmds: + - | + IS_ROOT_OR_SUDO=$([ ! -z "$SUDO_USER" ] || [ $(whoami) = "root" ] && echo "true" || echo "false") # Assert root or sudo user + if [ "$IS_ROOT_OR_SUDO" = "false" ]; then + echo "This newrelic install must be run under sudo or root" >&2 + exit 3 + fi + - | + IS_GREP_INSTALLED=$(which grep | wc -l) + if [ $IS_GREP_INSTALLED -eq 0 ] ; then + echo "grep is required to run the newrelic install. Please install grep and re-run the installation." >&2 + exit 10 + fi + - | + IS_SED_INSTALLED=$(which sed | wc -l) + if [ $IS_SED_INSTALLED -eq 0 ] ; then + echo "sed is required to run the newrelic install. Please install sed and re-run the installation." >&2 + exit 11 + fi + - | + IS_AWK_INSTALLED=$(which awk | wc -l) + if [ $IS_AWK_INSTALLED -eq 0 ] ; then + echo "awk is required to run the newrelic install. Please install awk and re-run the installation." >&2 + exit 12 + fi + - | + IS_CAT_INSTALLED=$(which cat | wc -l) + if [ $IS_CAT_INSTALLED -eq 0 ] ; then + echo "cat is required to run the newrelic install. Please install cat and re-run the installation." >&2 + exit 13 + fi + - | + IS_TEE_INSTALLED=$(which tee | wc -l) + if [ $IS_TEE_INSTALLED -eq 0 ] ; then + echo "tee is required to run the newrelic install. Please install tee and re-run the installation." >&2 + exit 14 + fi + - | + IS_TOUCH_INSTALLED=$(which touch | wc -l) + if [ $IS_TOUCH_INSTALLED -eq 0 ] ; then + echo "touch is required to run the newrelic install. Please install touch and re-run the installation." >&2 + exit 15 + fi + - | + IS_CURL_INSTALLED=$(which curl | wc -l) + if [ $IS_CURL_INSTALLED -eq 0 ] ; then + echo "curl is required to run the newrelic install. Please install curl and re-run the installation." >&2 + exit 16 + fi + - | + IS_OPENSSL_INSTALLED=$(which openssl | wc -l) + if [ $IS_OPENSSL_INSTALLED -eq 0 ] ; then + echo "openssl is required to run the newrelic install. Please install openssl and re-run the installation." >&2 + exit 17 + fi + - | + IS_MKTEMP_INSTALLED=$(which mktemp | wc -l) + if [ $IS_MKTEMP_INSTALLED -eq 0 ] ; then + echo "mktemp is required to run the newrelic install. Please install coreutils and re-run the installation." >&2 + exit 18 + fi + - | + if [ "{{.AMAZON_LINUX_VERSION}}" != "2" ] && [ "{{.AMAZON_LINUX_VERSION}}" != "2023" ] ; then + REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/yum/{{.REPO_DIR}}/{{.DISTRO_VERSION}}/{{.ARCH}}/newrelic-infra.repo") + else + REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/yum/{{.REPO_DIR}}/{{.AMAZON_LINUX_VERSION}}/{{.ARCH}}/newrelic-infra.repo") + fi + IS_NEWRELIC_AVAILABLE=$(curl -Ls $REPO_URL | grep "\[newrelic-infra\]" | wc -l) + if [ $IS_NEWRELIC_AVAILABLE -eq 0 ] ; then + echo "there is no New Relic Agent Control available for the distribution '{{.DISTRO_VERSION}}'." >&2 + exit 21 + fi + vars: + DISTRO_VERSION: + sh: | + rpm -E %{rhel} + + cleanup: + # skipping this task if .nr-cli exists + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then + rm -rf /var/db/newrelic-infra/data 2>/dev/null + fi + + setup_infra_license: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then + if [ -f /etc/newrelic-infra.yml ]; then + printf "\nAn existing newrelic-infra configuration file was detected. Updating where needed." + + sed -i "/^staging/d" /etc/newrelic-infra.yml + sed -i "/^enable_process_metrics/d" /etc/newrelic-infra.yml + sed -i "/^status_server_enabled/d" /etc/newrelic-infra.yml + sed -i "/^status_server_port/d" /etc/newrelic-infra.yml + sed -i "/^license_key/d" /etc/newrelic-infra.yml + sed -i '/^custom_attributes:/,/^\S/{ /^\S/!d }' /etc/newrelic-infra.yml + sed -i '/^custom_attributes:/d' /etc/newrelic-infra.yml + sed -i "/^is_integrations_only/d" /etc/newrelic-infra.yml + + if [ "{{.NR_AC_MIGRATE_INFRA_CONFIG}}" == "true" ] || [ "{{.NEW_RELIC_ASSUME_YES}}" == "true" ] ; then + touch /etc/newrelic-infra-do-migrate + else + printf "\nWould you like to migrate this newrelic-infra config to use it with New Relic Agent Control? (y/N): " + read -r MIGRATE_NEWRELIC_INFRA_CONFIG + MIGRATE_NEWRELIC_INFRA_CONFIG=${MIGRATE_NEWRELIC_INFRA_CONFIG:-N} + + if [ "$MIGRATE_NEWRELIC_INFRA_CONFIG" == "y" ] ; then + touch /etc/newrelic-infra-do-migrate + fi + fi + else + touch /etc/newrelic-infra.yml + # If we are creating a new file, perform the migration as well + touch /etc/newrelic-infra-do-migrate + fi + fi + - | + if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then + if [ $(echo {{.NEW_RELIC_REGION}} | grep -i staging | wc -l) -gt 0 ]; then + echo 'staging: true' >> /etc/newrelic-infra.yml + fi + + 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 '{{.NRIA_CUSTOM_ATTRIBUTES}}' >> /etc/newrelic-infra.yml + fi + + setup_infra_proxy: + cmds: + - | + if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] && [ ! -z "$HTTPS_PROXY" ]; then + sed -i "/^proxy/d" /etc/newrelic-infra.yml + echo 'proxy: {{.HTTPS_PROXY}}' >> /etc/newrelic-infra.yml + + if ! grep -q '^proxy=' /etc/dnf/dnf.conf; then + echo "************************************************************" + echo "WARNING: proxy settings not detected in your dnf config" + echo "If installation fails with a timeout, add the following line to /etc/dnf/dnf.conf and retry:" + echo "proxy={{.HTTPS_PROXY}}" + echo "************************************************************" + fi + fi + + install_agent_control: + cmds: + - | + if [ "{{.AMAZON_LINUX_VERSION}}" != "2" ] && [ "{{.AMAZON_LINUX_VERSION}}" != "2023" ] ; then + AGENT_CONTROL_REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/yum/{{.REPO_DIR}}/{{.DISTRO_VERSION}}/{{.ARCH}}/newrelic-infra.repo") + INFRA_REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/linux/yum/{{.REPO_DIR}}/{{.DISTRO_VERSION}}/{{.ARCH}}/newrelic-infra.repo") + else + AGENT_CONTROL_REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/yum/{{.REPO_DIR}}/{{.AMAZON_LINUX_VERSION}}/{{.ARCH}}/newrelic-infra.repo") + INFRA_REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/linux/yum/{{.REPO_DIR}}/{{.AMAZON_LINUX_VERSION}}/{{.ARCH}}/newrelic-infra.repo") + fi + IS_NEWRELIC_AVAILABLE=$(curl -Ls $AGENT_CONTROL_REPO_URL | grep "\[newrelic-infra\]" | wc -l) + if [ $IS_NEWRELIC_AVAILABLE -eq 0 ] ; then + echo "New Relic Agent Control is not available for this architecture {{.ARCH}}. See our documentation for installing manually https://docs.newrelic.com/docs/using-new-relic/cross-product-functions/install-configure/install-new-relic" >&2 + exit 131 + fi + + curl -s $INFRA_REPO_URL -o /etc/yum.repos.d/newrelic-infra.repo + curl -s $AGENT_CONTROL_REPO_URL | sed 's/\[newrelic-infra]/\n[newrelic-agent-control]/g' >> /etc/yum.repos.d/newrelic-infra.repo + + yum -y -q makecache --disablerepo='*' --enablerepo='newrelic-infra' --enablerepo='newrelic-agent-control' + yum -y -q install newrelic-agent-control + + if [ "{{.AMAZON_LINUX_VERSION}}" == "2" ] || [ "{{.AMAZON_LINUX_VERSION}}" == "2023" ] ; then + yum -y -q install fluent-bit + fi + vars: + DISTRO_VERSION: + sh: | + rpm -E %{rhel} + silent: true + + # If configured to do so, migrate the newrelic-infra configuration for usage with New Relic Agent Control + migrate_newrelic_infra_config: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ -f /etc/newrelic-infra-do-migrate ]; then + rm /etc/newrelic-infra-do-migrate + newrelic-config-migrate + fi + + update_otel_license_key: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + sed -i "/^NEW_RELIC_LICENSE_KEY/d" /etc/newrelic-agent-control/newrelic-agent-control.conf + echo 'NEW_RELIC_LICENSE_KEY="{{.NEW_RELIC_LICENSE_KEY}}"' >> /etc/newrelic-agent-control/newrelic-agent-control.conf + + update_otel_mem_limit: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then + sed -i "s/limit_mib: .*$/limit_mib: 100/g" /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + fi + + # Add OTLP Endpoint as ENV Var for the agent-control Systemd service + update_otel_end_point: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then + if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then + sed -i "s/endpoint: .*$/endpoint: https:\/\/staging-otlp.nr-data.net:4317/g" /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then + sed -i "s/endpoint: .*$/endpoint: https:\/\/otlp.eu01.nr-data.net:4317/g" /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + else + sed -i "s/endpoint: .*$/endpoint: https:\/\/otlp.nr-data.net:4317/g" /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + fi + fi + + config_supervisors: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ]; then + cp /etc/newrelic-agent-control/examples/agent-control-config-no-agents.yaml /etc/newrelic-agent-control/config.yaml + elif [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ]; then + cp /etc/newrelic-agent-control/examples/agent-control-config-nr-otel-collector.yaml /etc/newrelic-agent-control/config.yaml + elif [ "{{.NR_CLI_NRDOT}}" = "false" ]; then + cp /etc/newrelic-agent-control/examples/agent-control-config-nr-infra-agent.yaml /etc/newrelic-agent-control/config.yaml + else + cp /etc/newrelic-agent-control/examples/agent-control-config-all-agents.yaml /etc/newrelic-agent-control/config.yaml + fi + + config_fleet_id: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ ! -z "{{.NR_CLI_FLEET_ID}}" ] ; then + sed -i 's/^#\s*fleet_id:/fleet_id:/g' /etc/newrelic-agent-control/config.yaml + sed -i 's/fleet_id: FLEET_ID_HERE/fleet_id: {{.NR_CLI_FLEET_ID}}/g' /etc/newrelic-agent-control/config.yaml + fi + + config_fleet_control: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_FLEET_ENABLED}}" = "false" ]; then + sed -i '/^\s*fleet_control:/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*endpoint: https:\/\/opamp/s/^/#/' /etc/newrelic-agent-control/config.yaml + else + sed -i 's/s*#\s*fleet_control:/fleet_control:/g' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*endpoint: https:\/\/opamp/s/# //' /etc/newrelic-agent-control/config.yaml + fi + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_FLEET_ENABLED}}" = "false" ]; then + sed -i '/^\s*api-key:/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*headers:/s/^/#/' /etc/newrelic-agent-control/config.yaml + else + sed -i '/^\s*#\s*api-key:/s/# //' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*headers:/s/# //' /etc/newrelic-agent-control/config.yaml + fi + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_FLEET_ENABLED}}" != "false" ] ; then + sed -i 's/api-key: API_KEY_HERE/api-key: {{ .NEW_RELIC_LICENSE_KEY }}/g' /etc/newrelic-agent-control/config.yaml + fi + - | + if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then + sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"staging-service.newrelic.com\/v1\/opamp"'/' /etc/newrelic-agent-control/config.yaml + elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then + sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"service.eu.newrelic.com\/v1\/opamp"'/' /etc/newrelic-agent-control/config.yaml + else + sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"service.newrelic.com\/v1\/opamp"'/' /etc/newrelic-agent-control/config.yaml + fi + + config_agent_control_auth: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_FLEET_ENABLED}}" != "false" ] && [ "{{ .NEW_RELIC_ORGANIZATION }}" != "" ]; then + sed -i '/^\s*#\s*auth_config:\s*$/s/# //' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*token_url: PLACEHOLDER/s/# //' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*client_id: PLACEHOLDER/s/# //' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*provider: PLACEHOLDER/s/# //' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*private_key_path: PLACEHOLDER/s/# //' /etc/newrelic-agent-control/config.yaml + else + sed -i '/^\s*auth_config:/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*token_url: PLACEHOLDER/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*client_id: PLACEHOLDER/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*provider: PLACEHOLDER/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*private_key_path: PLACEHOLDER/s/^/#/' /etc/newrelic-agent-control/config.yaml + fi + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_FLEET_ENABLED}}" != "false" ] && [ "{{ .NEW_RELIC_ORGANIZATION }}" != "" ]; then + set -uo pipefail + + mkdir -p /etc/newrelic-agent-control/keys + chown root:root /etc/newrelic-agent-control/keys + chmod 700 /etc/newrelic-agent-control/keys + + TEMPORAL_FOLDER=$(mktemp -d newrelic-agent-control.XXXXXXXXXX) + chown root:root "${TEMPORAL_FOLDER}" + chmod 700 "${TEMPORAL_FOLDER}" + trap "rm -rf $TEMPORAL_FOLDER" EXIT + openssl genrsa -out "$TEMPORAL_FOLDER/key" 4096 + openssl rsa -in "$TEMPORAL_FOLDER/key" -pubout -out "$TEMPORAL_FOLDER/pub" + + if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then + REGISTRATION_ENDPOINT=https://staging-api.newrelic.com/graphql + TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.staging-service.newrelic.com/oauth2/token + IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.staging-service.nr-ops.net/system-identity/graphql + elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then + REGISTRATION_ENDPOINT=https://api.eu.newrelic.com/graphql + TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.service.newrelic.com/oauth2/token + IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.service.eu.nr-ops.net/system-identity/graphql + else + REGISTRATION_ENDPOINT=https://api.newrelic.com/graphql + TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.service.newrelic.com/oauth2/token + IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.service.nr-ops.net/system-identity/graphql + fi + + ############################################################ + # Get the L1 Access Token + ############################################################ + if [ "{{.NEW_RELIC_AUTH_CLIENT_ID}}" != "" ] && [ "{{.NEW_RELIC_AUTH_CLIENT_SECRET}}" != "" ]; then + RESPONSE_FILE=$TEMPORAL_FOLDER/response_token.json + for RETRY in 1 2 3; do + HTTP_CODE=$(echo '{"client_id": "{{.NEW_RELIC_AUTH_CLIENT_ID}}", "client_secret": "{{.NEW_RELIC_AUTH_CLIENT_SECRET}}", "grant_type": "client_credentials"}' | tr -d $'\n' | curl \ + -s -w "%{http_code}" \ + -H "Content-Type: application/json" \ + -o "$RESPONSE_FILE" \ + --data-binary @- \ + "$TOKEN_RENEWAL_ENDPOINT" + ) + + if [ $HTTP_CODE -eq 200 ]; then + break + fi + + ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.error_description // "invalid_request"' < "$TEMPORAL_FOLDER/response_token.json" | tr -d '"') + + echo "Error getting system identity auth token. The API endpoint returned $HTTP_CODE: $ERROR_MESSAGE. Retrying ($RETRY/3)..." + sleep 2 + done + + if [ $HTTP_CODE -ne 200 ]; then + echo "Error getting system identity auth token" + exit 99 + fi + + ACCESS_TOKEN=$(/usr/local/bin/newrelic utils jq '.access_token' < "$RESPONSE_FILE" | tr -d '"' ) + + ############################################################ + # Create System Identity + ############################################################ + DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + NAME="System Identity for $(hostname) - $DATE" + + for RETRY in 1 2 3; do + HTTP_CODE=$(echo '{ "query": + "mutation { + create( + name: \"'$NAME'\", + organizationId: \"{{ .NEW_RELIC_ORGANIZATION }}\", + publicKey: \"'$(openssl enc -base64 -A -in "$TEMPORAL_FOLDER/pub")'\" + ) { + clientId, + name + } + }" + }' | tr -d $'\n' | curl \ + -s -w "%{http_code}" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $ACCESS_TOKEN" \ + -o "$TEMPORAL_FOLDER/response.json" \ + --data-binary @- \ + "$IDENTITY_CREATION_ENDPOINT" + ) + + if [ $HTTP_CODE -eq 200 ]; then + break + fi + + echo "Error creating L2 system identity. The API endpoint returned $HTTP_CODE. Retrying ($RETRY/3)..." + sleep 2 + done + + if [ $HTTP_CODE -ne 200 ]; then + exit 99 + fi + + ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.errors[0].message // "NOERROR"' < "$TEMPORAL_FOLDER/response.json" | tr -d '"') + if [ "$ERROR_MESSAGE" != "NOERROR" ]; then + echo "Failed to create a New Relic System Identity for Fleet Control communication authentication. Please verify that your User Key is valid and that your Account Organization has the necessary permissions to create a System Identity: $ERROR_MESSAGE" + exit 100 + fi + + CLIENT_ID=$(/usr/local/bin/newrelic utils jq '.data.create.clientId' < "$TEMPORAL_FOLDER/response.json" | tr -d '"' ) + else + ############################################################ + # Create System Identity (Legacy) + ############################################################ + DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + NAME="System Identity for $(hostname) - $DATE" + + for RETRY in 1 2 3; do + HTTP_CODE=$(echo '{ "query": + "mutation { + systemIdentityCreate( + name: \"'$NAME'\", + organizationId: \"{{ .NEW_RELIC_ORGANIZATION }}\", + publicKey: \"'$(openssl enc -base64 -A -in "$TEMPORAL_FOLDER/pub")'\" + ) { + clientId, + name + } + }" + }' | tr -d $'\n' | curl \ + -s -w "%{http_code}" \ + -H "Content-Type: application/json" \ + -H "API-Key: {{ .NEW_RELIC_API_KEY }}" \ + -o "$TEMPORAL_FOLDER/response.json" \ + --data-binary @- \ + "$REGISTRATION_ENDPOINT" + ) + + if [ $HTTP_CODE -eq 200 ]; then + break + fi + + echo "Error creating the new system identity. The API endpoint returned $HTTP_CODE. Retrying ($RETRY/3)..." + sleep 2 + done + + if [ $HTTP_CODE -ne 200 ]; then + exit 99 + fi + + ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.errors[0].message // "NOERROR"' < "$TEMPORAL_FOLDER/response.json" | tr -d '"') + if [ "$ERROR_MESSAGE" != "NOERROR" ]; then + echo "Failed to create a New Relic System Identity for Fleet Control communication authentication. Please verify that your User Key is valid and that your Account Organization has the necessary permissions to create a System Identity: $ERROR_MESSAGE" + exit 100 + fi + + CLIENT_ID=$(/usr/local/bin/newrelic utils jq '.data.systemIdentityCreate.clientId' < "$TEMPORAL_FOLDER/response.json" | tr -d '"' ) + fi + + mv "$TEMPORAL_FOLDER/key" "/etc/newrelic-agent-control/keys/$CLIENT_ID.key" + sed -i 's~token_url: PLACEHOLDER~token_url: '"$TOKEN_RENEWAL_ENDPOINT"'~g' /etc/newrelic-agent-control/config.yaml + sed -i 's/client_id: PLACEHOLDER/client_id: '"$CLIENT_ID"'/g' /etc/newrelic-agent-control/config.yaml + sed -i 's/provider: PLACEHOLDER/provider: local/g' /etc/newrelic-agent-control/config.yaml + sed -i 's~private_key_path: PLACEHOLDER~private_key_path: '"/etc/newrelic-agent-control/keys/$CLIENT_ID.key"'~g' /etc/newrelic-agent-control/config.yaml + fi + + config_host_monitoring: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_HOST_MONITORING_SOURCE}}" = "otel" ]; then + echo 'is_integrations_only: true' >> /etc/newrelic-infra.yml + mkdir -p /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values + cp /etc/newrelic-agent-control/examples/values-nr-otel-collector-agent-linux.yaml /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + else + if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then + mkdir -p /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values + cp /etc/newrelic-agent-control/examples/values-nr-otel-collector-gateway.yaml /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + fi + fi + + restart_agent_control: + cmds: + - | + if [ {{.IS_SYSTEMCTL}} -gt 0 ]; then + systemctl restart newrelic-agent-control + else + if [ {{.IS_INITCTL}} -gt 0 ]; then + initctl restart newrelic-agent-control + else + /etc/init.d/newrelic-agent-control restart + fi + fi + + assert_agent_control_status_ok: + cmds: + - | + MAX_RETRIES=150 + TRIES=0 + echo "Running agent status check attempt..." + # wait for status endpoint to be ready + while [ $TRIES -lt $MAX_RETRIES ]; do + ((TRIES++)) + statusCheckOutput=$(curl -s http://localhost:51200/status) + if [ -z "$statusCheckOutput" ]; then + # so jq doesn't fail if empty + statusCheckOutput="{}" + fi + STATUS=$(echo $statusCheckOutput | /usr/local/bin/newrelic utils jq '.agent_control.healthy') + if [ "$STATUS" == "true" ]; then + echo "Agent status check ok." + break + else + if [ "$TRIES" -eq "$MAX_RETRIES" ]; then + # Process-based validation attempt + IS_AGENT_INSTALLED=$(ps aux | grep newrelic-agent-control | grep -v grep | wc -l) + if [ $IS_AGENT_INSTALLED -gt 0 ] ; then + echo "detected newrelic-agent-control process running" + exit 0 + fi + + 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 + + if [ {{.IS_SYSTEMCTL}} -gt 0 ]; then + journalctl -u newrelic-agent-control --no-pager + fi + + exit 31 + fi + fi + + sleep 2 + done + + signal_recipe_applied: + cmds: + - | + touch /etc/newrelic-agent-control/.nr-cli + + post_install: + info: |2 + ⚙️ New Relic Agent Control configuration file can be found in /etc/newrelic-agent-control/config.yaml diff --git a/recipes/newrelic/infrastructure/agent-control/suse.yml b/recipes/newrelic/infrastructure/agent-control/suse.yml new file mode 100644 index 00000000..d293d026 --- /dev/null +++ b/recipes/newrelic/infrastructure/agent-control/suse.yml @@ -0,0 +1,620 @@ +# Visit our schema definition for additional information on this file format. +# https://github.com/newrelic/open-install-library/blob/main/docs/recipe-spec/recipe-spec.md#schema-definition + +name: agent-control +displayName: Agent Control +description: New Relic install recipe for Agent Control +repository: https://github.com/newrelic/newrelic-agent-control + +installTargets: + - type: host + os: linux + platformFamily: suse + platformVersion: "(12|15)\\.*" + +keywords: + - AgentControl + - OpenTelemetry + - OTel + - Infrastructure + - Agent + - Linux + - Suse + - SLES + +processMatch: [] + +preInstall: + requireAtDiscovery: | + IS_DOCKER_CONTAINER_CGROUP=$(grep 'docker\|lxc' /proc/1/cgroup | wc -l) + if [ $IS_DOCKER_CONTAINER_CGROUP -gt 0 ] ; then + echo "docker detected with cgroup, unsupported" >&2 + exit 131 + fi + IS_DOCKER_CONTAINER_ENVIRON=$(grep container=lxc /proc/1/environ | wc -l) + if [ $IS_DOCKER_CONTAINER_ENVIRON -gt 0 ] ; then + echo "docker detected with environ, unsupported" >&2 + exit 131 + fi + if [ -f /.dockerenv ] ; then + echo "docker detected with .dockerenv, unsupported" >&2 + exit 131 + fi + IS_WSL_CONTAINER=$(grep -i 'Microsoft' /proc/version | wc -l) + if [ $IS_WSL_CONTAINER -gt 0 ] ; then + echo "microsoft Windows Subsystem for Linux for infra detected, unsupported" >&2 + exit 131 + fi + exit 0 + + discoveryMode: + - targeted + +install: + version: "3" + silent: true + vars: + IS_SYSTEMCTL: + sh: command -v systemctl | wc -l + IS_INITCTL: + sh: command -v initctl | wc -l + tasks: + default: + cmds: + - task: write_recipe_metadata + - task: detect_previous_install + - task: assert_pre_req + - task: cleanup + - task: setup_infra_license + - task: setup_infra_proxy + - task: install_agent_control + - task: update_otel_license_key + - task: config_supervisors + - task: config_fleet_id + - task: config_fleet_control + - task: config_agent_control_auth + - task: config_host_monitoring + - task: update_otel_mem_limit + - task: update_otel_end_point + - task: migrate_newrelic_infra_config + - task: restart_agent_control + - task: assert_agent_control_status_ok + - task: signal_recipe_applied + - task: post_install + + write_recipe_metadata: + cmds: + - | + echo '{"Metadata":{"CapturedCliOutput":"true"}}' | tee {{.NR_CLI_OUTPUT}} > /dev/null + + detect_previous_install: + cmds: + - | + if [ -f /etc/newrelic-agent-control/.nr-cli ] ; then + echo "A previous execution of this installation was detected. Some installation tasks will be skipped." + echo "If you would like to run all the tasks, please remove the /etc/newrelic-agent-control/.nr-cli file and re-run the installation." + fi + + assert_pre_req: + cmds: + - | + IS_ROOT_OR_SUDO=$([ ! -z "$SUDO_USER" ] || [ $(whoami) = "root" ] && echo "true" || echo "false") # Assert root or sudo user + if [ "$IS_ROOT_OR_SUDO" = "false" ]; then + echo "This newrelic install must be run under sudo or root" >&2 + exit 3 + fi + - | + IS_GREP_INSTALLED=$(which grep | wc -l) + if [ $IS_GREP_INSTALLED -eq 0 ] ; then + echo "grep is required to run the newrelic install. Please install grep and re-run the installation." >&2 + exit 10 + fi + - | + IS_SED_INSTALLED=$(which sed | wc -l) + if [ $IS_SED_INSTALLED -eq 0 ] ; then + echo "sed is required to run the newrelic install. Please install sed and re-run the installation." >&2 + exit 11 + fi + - | + IS_AWK_INSTALLED=$(which awk | wc -l) + if [ $IS_AWK_INSTALLED -eq 0 ] ; then + echo "awk is required to run the newrelic install. Please install awk and re-run the installation." >&2 + exit 12 + fi + - | + IS_CAT_INSTALLED=$(which cat | wc -l) + if [ $IS_CAT_INSTALLED -eq 0 ] ; then + echo "cat is required to run the newrelic install. Please install cat and re-run the installation." >&2 + exit 13 + fi + - | + IS_TEE_INSTALLED=$(which tee | wc -l) + if [ $IS_TEE_INSTALLED -eq 0 ] ; then + echo "tee is required to run the newrelic install. Please install tee and re-run the installation." >&2 + exit 14 + fi + - | + IS_TOUCH_INSTALLED=$(which touch | wc -l) + if [ $IS_TOUCH_INSTALLED -eq 0 ] ; then + echo "touch is required to run the newrelic install. Please install touch and re-run the installation." >&2 + exit 15 + fi + - | + IS_CURL_INSTALLED=$(which curl | wc -l) + if [ $IS_CURL_INSTALLED -eq 0 ] ; then + echo "curl is required to run the newrelic install. Please install curl and re-run the installation." >&2 + exit 16 + fi + - | + IS_OPENSSL_INSTALLED=$(which openssl | wc -l) + if [ $IS_OPENSSL_INSTALLED -eq 0 ] ; then + echo "openssl is required to run the newrelic install. Please install openssl and re-run the installation." >&2 + exit 17 + fi + - | + IS_MKTEMP_INSTALLED=$(which mktemp | wc -l) + if [ $IS_MKTEMP_INSTALLED -eq 0 ] ; then + echo "mktemp is required to run the newrelic install. Please install coreutils and re-run the installation." >&2 + exit 18 + fi + - | + IS_INFRA_AVAILABLE=$(curl -Is {{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/zypp/sles/{{.SLES_VERSION}}/x86_64/newrelic-infra.repo | grep " 2[0-9][0-9] " | wc -l) + if [ $IS_INFRA_AVAILABLE -eq 0 ] ; then + echo "there is no New Relic Agent Control available for the distribution '{{.SLES_VERSION}}'." >&2 + exit 131 + fi + vars: + SLES_VERSION: + sh: awk -F= '/VERSION_ID/ {print $2}' /etc/os-release + + cleanup: + # skipping this task if .nr-cli exists + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + rm -rf /var/db/newrelic-infra/data 2>/dev/null + + setup_infra_license: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then + if [ -f /etc/newrelic-infra.yml ]; then + printf "\nAn existing newrelic-infra configuration file was detected. Updating where needed." + + sed -i "/^staging/d" /etc/newrelic-infra.yml + sed -i "/^enable_process_metrics/d" /etc/newrelic-infra.yml + sed -i "/^status_server_enabled/d" /etc/newrelic-infra.yml + sed -i "/^status_server_port/d" /etc/newrelic-infra.yml + sed -i "/^license_key/d" /etc/newrelic-infra.yml + sed -i '/^custom_attributes:/,/^\S/{ /^\S/!d }' /etc/newrelic-infra.yml + sed -i '/^custom_attributes:/d' /etc/newrelic-infra.yml + sed -i "/^is_integrations_only/d" /etc/newrelic-infra.yml + + if [ "{{.NR_AC_MIGRATE_INFRA_CONFIG}}" == "true" ] || [ "{{.NEW_RELIC_ASSUME_YES}}" == "true" ] ; then + touch /etc/newrelic-infra-do-migrate + else + printf "\nWould you like to migrate this newrelic-infra config to use it with New Relic Agent Control? (y/N): " + read -r MIGRATE_NEWRELIC_INFRA_CONFIG + MIGRATE_NEWRELIC_INFRA_CONFIG=${MIGRATE_NEWRELIC_INFRA_CONFIG:-N} + + if [ "$MIGRATE_NEWRELIC_INFRA_CONFIG" == "y" ] ; then + touch /etc/newrelic-infra-do-migrate + fi + fi + else + touch /etc/newrelic-infra.yml + # If we are creating a new file, perform the migration as well + touch /etc/newrelic-infra-do-migrate + fi + fi + - | + if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then + if [ $(echo {{.NEW_RELIC_REGION}} | grep -i staging | wc -l) -gt 0 ]; then + echo 'staging: true' >> /etc/newrelic-infra.yml + fi + + 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 '{{.NRIA_CUSTOM_ATTRIBUTES}}' >> /etc/newrelic-infra.yml + fi + + setup_infra_proxy: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] && [ ! -z "$HTTPS_PROXY" ]; then + sed -i "/^proxy/d" /etc/newrelic-infra.yml + echo 'proxy: {{.HTTPS_PROXY}}' >> /etc/newrelic-infra.yml + fi + + install_agent_control: + cmds: + - | + ARCH=$(uname -m) + AGENT_CONTROL_REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/zypp/sles/{{.SLES_VERSION}}/$ARCH/newrelic-infra.repo") + IS_NEWRELIC_AVAILABLE=$(curl -Ls $AGENT_CONTROL_REPO_URL | grep "\[newrelic-infra\]" | wc -l) + if [ $IS_NEWRELIC_AVAILABLE -eq 0 ] ; then + echo "New Relic Agent Control is not available for this architecture "$ARCH". See our documentation for installing manually https://docs.newrelic.com/docs/using-new-relic/cross-product-functions/install-configure/install-new-relic" >&2 + exit 131 + fi + INFRA_REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/linux/zypp/sles/{{.SLES_VERSION}}/$ARCH/newrelic-infra.repo") + + curl -s $INFRA_REPO_URL -o /etc/zypp/repos.d/newrelic-infra.repo + curl -s $AGENT_CONTROL_REPO_URL | sed 's/\[newrelic-infra]/\n[newrelic-agent-control]/g' >> /etc/zypp/repos.d/newrelic-infra.repo + + - curl -s -L {{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/keys/newrelic_rpm_key_current.gpg > newrelic_rpm_key_current.gpg + - rpm --import newrelic_rpm_key_current.gpg + - zypper -n --quiet ref -r newrelic-infra + - zypper -n --quiet ref -r newrelic-agent-control + - zypper -n --quiet install newrelic-agent-control + - rm newrelic_rpm_key_current.gpg + vars: + SLES_VERSION: + sh: awk -F= '/VERSION_ID/ {print $2}' /etc/os-release + silent: true + + # If configured to do so, migrate the newrelic-infra configuration for usage with New Relic Agent Control + migrate_newrelic_infra_config: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ -f /etc/newrelic-infra-do-migrate ]; then + rm /etc/newrelic-infra-do-migrate + newrelic-config-migrate + fi + + update_otel_license_key: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + sed -i "/^NEW_RELIC_LICENSE_KEY/d" /etc/newrelic-agent-control/newrelic-agent-control.conf + echo 'NEW_RELIC_LICENSE_KEY="{{.NEW_RELIC_LICENSE_KEY}}"' >> /etc/newrelic-agent-control/newrelic-agent-control.conf + + update_otel_mem_limit: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then + sed -i "s/limit_mib: .*$/limit_mib: 100/g" /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + fi + + # Add OTLP Endpoint as ENV Var for the agent-control Systemd service + update_otel_end_point: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then + if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then + sed -i "s/endpoint: .*$/endpoint: https:\/\/staging-otlp.nr-data.net:4317/g" /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then + sed -i "s/endpoint: .*$/endpoint: https:\/\/otlp.eu01.nr-data.net:4317/g" /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + else + sed -i "s/endpoint: .*$/endpoint: https:\/\/otlp.nr-data.net:4317/g" /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + fi + fi + + config_supervisors: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ]; then + cp /etc/newrelic-agent-control/examples/agent-control-config-no-agents.yaml /etc/newrelic-agent-control/config.yaml + elif [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ]; then + cp /etc/newrelic-agent-control/examples/agent-control-config-nr-otel-collector.yaml /etc/newrelic-agent-control/config.yaml + elif [ "{{.NR_CLI_NRDOT}}" = "false" ]; then + cp /etc/newrelic-agent-control/examples/agent-control-config-nr-infra-agent.yaml /etc/newrelic-agent-control/config.yaml + else + cp /etc/newrelic-agent-control/examples/agent-control-config-all-agents.yaml /etc/newrelic-agent-control/config.yaml + fi + + config_fleet_id: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ ! -z "{{.NR_CLI_FLEET_ID}}" ] ; then + sed -i 's/^#\s*fleet_id:/fleet_id:/g' /etc/newrelic-agent-control/config.yaml + sed -i 's/fleet_id: FLEET_ID_HERE/fleet_id: {{.NR_CLI_FLEET_ID}}/g' /etc/newrelic-agent-control/config.yaml + fi + + config_fleet_control: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_FLEET_ENABLED}}" = "false" ]; then + sed -i '/^\s*fleet_control:/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*endpoint: https:\/\/opamp/s/^/#/' /etc/newrelic-agent-control/config.yaml + else + sed -i 's/s*#\s*fleet_control:/fleet_control:/g' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*endpoint: https:\/\/opamp/s/# //' /etc/newrelic-agent-control/config.yaml + fi + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_FLEET_ENABLED}}" = "false" ]; then + sed -i '/^\s*api-key:/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*headers:/s/^/#/' /etc/newrelic-agent-control/config.yaml + else + sed -i '/^\s*#\s*api-key:/s/# //' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*headers:/s/# //' /etc/newrelic-agent-control/config.yaml + fi + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_FLEET_ENABLED}}" != "false" ] ; then + sed -i 's/api-key: API_KEY_HERE/api-key: {{ .NEW_RELIC_LICENSE_KEY }}/g' /etc/newrelic-agent-control/config.yaml + fi + - | + if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then + sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"staging-service.newrelic.com\/v1\/opamp"'/' /etc/newrelic-agent-control/config.yaml + elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then + sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"service.eu.newrelic.com\/v1\/opamp"'/' /etc/newrelic-agent-control/config.yaml + else + sed -i 's/\(endpoint: https:\/\/opamp.\).*/\1'"service.newrelic.com\/v1\/opamp"'/' /etc/newrelic-agent-control/config.yaml + fi + + config_agent_control_auth: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_FLEET_ENABLED}}" != "false" ] && [ "{{ .NEW_RELIC_ORGANIZATION }}" != "" ]; then + sed -i '/^\s*#\s*auth_config:\s*$/s/# //' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*token_url: PLACEHOLDER/s/# //' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*client_id: PLACEHOLDER/s/# //' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*provider: PLACEHOLDER/s/# //' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*private_key_path: PLACEHOLDER/s/# //' /etc/newrelic-agent-control/config.yaml + else + sed -i '/^\s*auth_config:/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*token_url: PLACEHOLDER/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*client_id: PLACEHOLDER/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*provider: PLACEHOLDER/s/^/#/' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*private_key_path: PLACEHOLDER/s/^/#/' /etc/newrelic-agent-control/config.yaml + fi + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_FLEET_ENABLED}}" != "false" ] && [ "{{ .NEW_RELIC_ORGANIZATION }}" != "" ]; then + set -uo pipefail + + mkdir -p /etc/newrelic-agent-control/keys + chown root:root /etc/newrelic-agent-control/keys + chmod 700 /etc/newrelic-agent-control/keys + + TEMPORAL_FOLDER=$(mktemp -d newrelic-agent-control.XXXXXXXXXX) + chown root:root "${TEMPORAL_FOLDER}" + chmod 700 "${TEMPORAL_FOLDER}" + trap "rm -rf $TEMPORAL_FOLDER" EXIT + openssl genrsa -out "$TEMPORAL_FOLDER/key" 4096 + openssl rsa -in "$TEMPORAL_FOLDER/key" -pubout -out "$TEMPORAL_FOLDER/pub" + + if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then + REGISTRATION_ENDPOINT=https://staging-api.newrelic.com/graphql + TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.staging-service.newrelic.com/oauth2/token + IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.staging-service.nr-ops.net/system-identity/graphql + elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then + REGISTRATION_ENDPOINT=https://api.eu.newrelic.com/graphql + TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.service.newrelic.com/oauth2/token + IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.service.eu.nr-ops.net/system-identity/graphql + else + REGISTRATION_ENDPOINT=https://api.newrelic.com/graphql + TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.service.newrelic.com/oauth2/token + IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.service.nr-ops.net/system-identity/graphql + fi + + ############################################################ + # Get the L1 Access Token + ############################################################ + if [ "{{.NEW_RELIC_AUTH_CLIENT_ID}}" != "" ] && [ "{{.NEW_RELIC_AUTH_CLIENT_SECRET}}" != "" ]; then + RESPONSE_FILE=$TEMPORAL_FOLDER/response_token.json + for RETRY in 1 2 3; do + HTTP_CODE=$(echo '{"client_id": "{{.NEW_RELIC_AUTH_CLIENT_ID}}", "client_secret": "{{.NEW_RELIC_AUTH_CLIENT_SECRET}}", "grant_type": "client_credentials"}' | tr -d $'\n' | curl \ + -s -w "%{http_code}" \ + -H "Content-Type: application/json" \ + -o "$RESPONSE_FILE" \ + --data-binary @- \ + "$TOKEN_RENEWAL_ENDPOINT" + ) + + if [ $HTTP_CODE -eq 200 ]; then + break + fi + + ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.error_description // "invalid_request"' < "$TEMPORAL_FOLDER/response_token.json" | tr -d '"') + + echo "Error getting system identity auth token. The API endpoint returned $HTTP_CODE: $ERROR_MESSAGE. Retrying ($RETRY/3)..." + sleep 2 + done + + if [ $HTTP_CODE -ne 200 ]; then + echo "Error getting system identity auth token" + exit 99 + fi + + ACCESS_TOKEN=$(/usr/local/bin/newrelic utils jq '.access_token' < "$RESPONSE_FILE" | tr -d '"' ) + + ############################################################ + # Create System Identity + ############################################################ + DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + NAME="System Identity for $(hostname) - $DATE" + + for RETRY in 1 2 3; do + HTTP_CODE=$(echo '{ "query": + "mutation { + create( + name: \"'$NAME'\", + organizationId: \"{{ .NEW_RELIC_ORGANIZATION }}\", + publicKey: \"'$(openssl enc -base64 -A -in "$TEMPORAL_FOLDER/pub")'\" + ) { + clientId, + name + } + }" + }' | tr -d $'\n' | curl \ + -s -w "%{http_code}" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $ACCESS_TOKEN" \ + -o "$TEMPORAL_FOLDER/response.json" \ + --data-binary @- \ + "$IDENTITY_CREATION_ENDPOINT" + ) + + if [ $HTTP_CODE -eq 200 ]; then + break + fi + + echo "Error creating L2 system identity. The API endpoint returned $HTTP_CODE. Retrying ($RETRY/3)..." + sleep 2 + done + + if [ $HTTP_CODE -ne 200 ]; then + exit 99 + fi + + ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.errors[0].message // "NOERROR"' < "$TEMPORAL_FOLDER/response.json" | tr -d '"') + if [ "$ERROR_MESSAGE" != "NOERROR" ]; then + echo "Failed to create a New Relic System Identity for Fleet Control communication authentication. Please verify that your User Key is valid and that your Account Organization has the necessary permissions to create a System Identity: $ERROR_MESSAGE" + exit 100 + fi + + CLIENT_ID=$(/usr/local/bin/newrelic utils jq '.data.create.clientId' < "$TEMPORAL_FOLDER/response.json" | tr -d '"' ) + else + ############################################################ + # Create System Identity (Legacy) + ############################################################ + DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + NAME="System Identity for $(hostname) - $DATE" + + for RETRY in 1 2 3; do + HTTP_CODE=$(echo '{ "query": + "mutation { + systemIdentityCreate( + name: \"'$NAME'\", + organizationId: \"{{ .NEW_RELIC_ORGANIZATION }}\", + publicKey: \"'$(openssl enc -base64 -A -in "$TEMPORAL_FOLDER/pub")'\" + ) { + clientId, + name + } + }" + }' | tr -d $'\n' | curl \ + -s -w "%{http_code}" \ + -H "Content-Type: application/json" \ + -H "API-Key: {{ .NEW_RELIC_API_KEY }}" \ + -o "$TEMPORAL_FOLDER/response.json" \ + --data-binary @- \ + "$REGISTRATION_ENDPOINT" + ) + + if [ $HTTP_CODE -eq 200 ]; then + break + fi + + echo "Error creating the new system identity. The API endpoint returned $HTTP_CODE. Retrying ($RETRY/3)..." + sleep 2 + done + + if [ $HTTP_CODE -ne 200 ]; then + exit 99 + fi + + ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.errors[0].message // "NOERROR"' < "$TEMPORAL_FOLDER/response.json" | tr -d '"') + if [ "$ERROR_MESSAGE" != "NOERROR" ]; then + echo "Failed to create a New Relic System Identity for Fleet Control communication authentication. Please verify that your User Key is valid and that your Account Organization has the necessary permissions to create a System Identity: $ERROR_MESSAGE" + exit 100 + fi + + CLIENT_ID=$(/usr/local/bin/newrelic utils jq '.data.systemIdentityCreate.clientId' < "$TEMPORAL_FOLDER/response.json" | tr -d '"' ) + fi + + mv "$TEMPORAL_FOLDER/key" "/etc/newrelic-agent-control/keys/$CLIENT_ID.key" + sed -i 's~token_url: PLACEHOLDER~token_url: '"$TOKEN_RENEWAL_ENDPOINT"'~g' /etc/newrelic-agent-control/config.yaml + sed -i 's/client_id: PLACEHOLDER/client_id: '"$CLIENT_ID"'/g' /etc/newrelic-agent-control/config.yaml + sed -i 's/provider: PLACEHOLDER/provider: local/g' /etc/newrelic-agent-control/config.yaml + sed -i 's~private_key_path: PLACEHOLDER~private_key_path: '"/etc/newrelic-agent-control/keys/$CLIENT_ID.key"'~g' /etc/newrelic-agent-control/config.yaml + fi + + config_host_monitoring: + status: + - test -f /etc/newrelic-agent-control/.nr-cli + cmds: + - | + if [ "{{.NEW_RELIC_AGENT_CONTROL_HOST_MONITORING_SOURCE}}" = "otel" ]; then + echo 'is_integrations_only: true' >> /etc/newrelic-infra.yml + mkdir -p /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values + cp /etc/newrelic-agent-control/examples/values-nr-otel-collector-agent-linux.yaml /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + else + if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then + mkdir -p /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values + cp /etc/newrelic-agent-control/examples/values-nr-otel-collector-gateway.yaml /etc/newrelic-agent-control/fleet/agents.d/nr-otel-collector/values/values.yaml + fi + fi + + restart_agent_control: + cmds: + - | + if [ {{.IS_SYSTEMCTL}} -gt 0 ]; then + systemctl restart newrelic-agent-control + else + if [ {{.IS_INITCTL}} -gt 0 ]; then + initctl restart newrelic-agent-control + else + /etc/init.d/newrelic-agent-control restart + fi + fi + + assert_agent_control_status_ok: + cmds: + - | + MAX_RETRIES=150 + TRIES=0 + echo "Running agent status check attempt..." + # wait for status endpoint to be ready + while [ $TRIES -lt $MAX_RETRIES ]; do + ((TRIES++)) + statusCheckOutput=$(curl -s http://localhost:51200/status) + if [ -z "$statusCheckOutput" ]; then + # so jq doesn't fail if empty + statusCheckOutput="{}" + fi + STATUS=$(echo $statusCheckOutput | /usr/local/bin/newrelic utils jq '.agent_control.healthy') + if [ "$STATUS" == "true" ]; then + echo "Agent status check ok." + break + else + if [ "$TRIES" -eq "$MAX_RETRIES" ]; then + # Process-based validation attempt + IS_AGENT_INSTALLED=$(ps aux | grep newrelic-agent-control | grep -v grep | wc -l) + if [ $IS_AGENT_INSTALLED -gt 0 ] ; then + echo "detected newrelic-agent-control process running" + exit 0 + fi + + 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 + + if [ {{.IS_SYSTEMCTL}} -gt 0 ]; then + journalctl -u newrelic-agent-control --no-pager + fi + + exit 31 + fi + fi + + sleep 2 + done + + signal_recipe_applied: + cmds: + - | + touch /etc/newrelic-agent-control/.nr-cli + + post_install: + info: |2 + ⚙️ New Relic Agent Control configuration file can be found in /etc/newrelic-agent-control/config.yaml diff --git a/recipes/newrelic/infrastructure/ohi/mysql/debian.yml b/recipes/newrelic/infrastructure/ohi/mysql/debian.yml index ad820728..cd423fe1 100644 --- a/recipes/newrelic/infrastructure/ohi/mysql/debian.yml +++ b/recipes/newrelic/infrastructure/ohi/mysql/debian.yml @@ -7,7 +7,7 @@ description: New Relic install recipe for default MySQL Open Source on-host inte repository: https://github.com/newrelic/nri-mysql dependencies: - - infrastructure-agent-installer || super-agent + - infrastructure-agent-installer || agent-control installTargets: - type: host @@ -82,9 +82,9 @@ install: cmds: - | IS_INFRA_INSTALLED=$(sudo ps aux | grep newrelic-infra-service | grep -v grep | wc -l) - IS_SUPER_AGENT_INSTALLED=$(sudo ps aux | grep newrelic-super-agent | grep -v grep | wc -l) - if [ $IS_INFRA_INSTALLED -eq 0 ] && [ $IS_SUPER_AGENT_INSTALLED -eq 0 ] ; then - echo "The infrastructure agent or the super agent is required to install this integration. We recommend going through our guided install path for this pre-requisite which can be found at: https://docs.newrelic.com/docs/full-stack-observability/observe-everything/get-started/new-relic-guided-install-overview" >&2 + IS_AGENT_CONTROL_INSTALLED=$(sudo ps aux | grep newrelic-agent-control | grep -v grep | wc -l) + if [ $IS_INFRA_INSTALLED -eq 0 ] && [ $IS_AGENT_CONTROL_INSTALLED -eq 0 ] ; then + echo "The infrastructure agent or the agent control is required to install this integration. We recommend going through our guided install path for this pre-requisite which can be found at: https://docs.newrelic.com/docs/full-stack-observability/observe-everything/get-started/new-relic-guided-install-overview" >&2 exit 1 fi diff --git a/test/definitions-eu/agent-control/debians/debian11-agent-control-eu.json b/test/definitions-eu/agent-control/debians/debian11-agent-control-eu.json new file mode 100644 index 00000000..9b332dfd --- /dev/null +++ b/test/definitions-eu/agent-control/debians/debian11-agent-control-eu.json @@ -0,0 +1,35 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.nano", + "ami_name": "debian-11-amd64-daily-202?????-*", + "user_name": "admin" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/debian.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/debians/ubuntu16-agent-control-eu.json b/test/definitions-eu/agent-control/debians/ubuntu16-agent-control-eu.json new file mode 100644 index 00000000..6aab949b --- /dev/null +++ b/test/definitions-eu/agent-control/debians/ubuntu16-agent-control-eu.json @@ -0,0 +1,35 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "ubuntu16-super-eu", + "provider": "aws", + "type": "ec2", + "size": "t3.small", + "ami_name": "ubuntu-pro-server/images/hvm-ssd/ubuntu-xenial-16.04-amd64-pro-server-????????", + "user_name": "ubuntu" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["ubuntu16-super-eu"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/debian.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/debians/ubuntu18-agent-control-eu.json b/test/definitions-eu/agent-control/debians/ubuntu18-agent-control-eu.json new file mode 100644 index 00000000..dc1f9512 --- /dev/null +++ b/test/definitions-eu/agent-control/debians/ubuntu18-agent-control-eu.json @@ -0,0 +1,35 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.nano", + "ami_name": "ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-????????", + "user_name": "ubuntu" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/debian.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/debians/ubuntu20-agent-control-eu.json b/test/definitions-eu/agent-control/debians/ubuntu20-agent-control-eu.json new file mode 100644 index 00000000..e45cd262 --- /dev/null +++ b/test/definitions-eu/agent-control/debians/ubuntu20-agent-control-eu.json @@ -0,0 +1,37 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.nano", + "ami_name": "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-2023*", + "user_name": "ubuntu" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/debian.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/debians/ubuntu20arm64-agent-control-eu.json b/test/definitions-eu/agent-control/debians/ubuntu20arm64-agent-control-eu.json new file mode 100644 index 00000000..c3de0032 --- /dev/null +++ b/test/definitions-eu/agent-control/debians/ubuntu20arm64-agent-control-eu.json @@ -0,0 +1,37 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t4g.nano", + "ami_name": "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-arm64-server-????????-*", + "user_name": "ubuntu" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/debian.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/debians/ubuntu22-agent-control-eu.json b/test/definitions-eu/agent-control/debians/ubuntu22-agent-control-eu.json new file mode 100644 index 00000000..a2add3c7 --- /dev/null +++ b/test/definitions-eu/agent-control/debians/ubuntu22-agent-control-eu.json @@ -0,0 +1,37 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.micro", + "ami_name": "ubuntu/images/hvm-ssd/ubuntu-jammy-22.??-amd64-server-????????", + "user_name": "ubuntu" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/debian.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/logs/amazonlinux2-agent-control-logs-eu.json b/test/definitions-eu/agent-control/logs/amazonlinux2-agent-control-logs-eu.json new file mode 100644 index 00000000..3cdf1cd1 --- /dev/null +++ b/test/definitions-eu/agent-control/logs/amazonlinux2-agent-control-logs-eu.json @@ -0,0 +1,37 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "ami_name": "amzn2-ami-hvm-2.0.????????.?-x86_64-gp2", + "type": "ec2", + "size": "t3.micro" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/logs/amazonlinux2023-agent-control-logs-eu.json b/test/definitions-eu/agent-control/logs/amazonlinux2023-agent-control-logs-eu.json new file mode 100644 index 00000000..309d21f8 --- /dev/null +++ b/test/definitions-eu/agent-control/logs/amazonlinux2023-agent-control-logs-eu.json @@ -0,0 +1,38 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.small", + "ami_name": "al2023-ami-2023.*-x86_64", + "user_name": "ec2-user" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/logs/debian11-agent-control-logs-eu.json b/test/definitions-eu/agent-control/logs/debian11-agent-control-logs-eu.json new file mode 100644 index 00000000..c89d1c97 --- /dev/null +++ b/test/definitions-eu/agent-control/logs/debian11-agent-control-logs-eu.json @@ -0,0 +1,38 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.nano", + "ami_name": "debian-11-amd64-daily-*", + "user_name": "admin" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/logs/redhat8-agent-control-logs-eu.json b/test/definitions-eu/agent-control/logs/redhat8-agent-control-logs-eu.json new file mode 100644 index 00000000..044039d6 --- /dev/null +++ b/test/definitions-eu/agent-control/logs/redhat8-agent-control-logs-eu.json @@ -0,0 +1,37 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.micro", + "ami_name": "RHEL_HA-8.4.?_HVM-????????-x86_64-??-Hourly2-GP2" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/logs/redhat9-agent-control-logs-eu.json b/test/definitions-eu/agent-control/logs/redhat9-agent-control-logs-eu.json new file mode 100644 index 00000000..426ca9ab --- /dev/null +++ b/test/definitions-eu/agent-control/logs/redhat9-agent-control-logs-eu.json @@ -0,0 +1,37 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.micro", + "ami_name": "RHEL_HA-9.0.?_HVM-????????-x86_64-?-Hourly2-GP2" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/logs/suse154-agent-control-logs-eu.json b/test/definitions-eu/agent-control/logs/suse154-agent-control-logs-eu.json new file mode 100644 index 00000000..ce68e909 --- /dev/null +++ b/test/definitions-eu/agent-control/logs/suse154-agent-control-logs-eu.json @@ -0,0 +1,35 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.nano", + "ami_name": "suse-sles-15-sp4-chost-byos-v????????-hvm-ssd-x86_64" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/logs/ubuntu20-agent-control-logs-eu.json b/test/definitions-eu/agent-control/logs/ubuntu20-agent-control-logs-eu.json new file mode 100644 index 00000000..e03dbb5a --- /dev/null +++ b/test/definitions-eu/agent-control/logs/ubuntu20-agent-control-logs-eu.json @@ -0,0 +1,38 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.micro", + "ami_name": "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*", + "user_name": "ubuntu" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/logs/ubuntu22-agent-control-logs-eu.json b/test/definitions-eu/agent-control/logs/ubuntu22-agent-control-logs-eu.json new file mode 100644 index 00000000..0b24b229 --- /dev/null +++ b/test/definitions-eu/agent-control/logs/ubuntu22-agent-control-logs-eu.json @@ -0,0 +1,38 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.micro", + "ami_name": "ubuntu/images/hvm-ssd/ubuntu-jammy-22.??-amd64-server-????????", + "user_name": "ubuntu" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/rhel/awslinux23-agent-control-eu.json b/test/definitions-eu/agent-control/rhel/awslinux23-agent-control-eu.json new file mode 100644 index 00000000..28f09890 --- /dev/null +++ b/test/definitions-eu/agent-control/rhel/awslinux23-agent-control-eu.json @@ -0,0 +1,35 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "ami_name": "al2023-ami-2023.*-x86_64", + "type": "ec2", + "size": "t3.nano", + "user_name": "ec2-user" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/rhel.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/rhel/awslinuxarm64-agent-control-eu.json b/test/definitions-eu/agent-control/rhel/awslinuxarm64-agent-control-eu.json new file mode 100644 index 00000000..d7b4c25d --- /dev/null +++ b/test/definitions-eu/agent-control/rhel/awslinuxarm64-agent-control-eu.json @@ -0,0 +1,34 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "ami_name": "amzn2-ami-hvm-2.0.????????.?-arm64-gp2", + "type": "ec2", + "size": "t4g.nano" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/rhel.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/rhel/redhat8arm64-agent-control-eu.json b/test/definitions-eu/agent-control/rhel/redhat8arm64-agent-control-eu.json new file mode 100644 index 00000000..579b78d3 --- /dev/null +++ b/test/definitions-eu/agent-control/rhel/redhat8arm64-agent-control-eu.json @@ -0,0 +1,34 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t4g.micro", + "ami_name": "RHEL-8.*_HVM-????????-arm64-*-Hourly2-GP2" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/rhel.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/suse/suse125-agent-control-eu.json b/test/definitions-eu/agent-control/suse/suse125-agent-control-eu.json new file mode 100644 index 00000000..25cb1220 --- /dev/null +++ b/test/definitions-eu/agent-control/suse/suse125-agent-control-eu.json @@ -0,0 +1,34 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.micro", + "ami_name": "suse-sles-12-sp5-v????????-hvm-*" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/suse.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions-eu/agent-control/suse/suse154-agent-control-eu.json b/test/definitions-eu/agent-control/suse/suse154-agent-control-eu.json new file mode 100644 index 00000000..423d32a7 --- /dev/null +++ b/test/definitions-eu/agent-control/suse/suse154-agent-control-eu.json @@ -0,0 +1,34 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.nano", + "ami_name": "suse-sles-15-sp4-chost-byos-v????????-hvm-ssd-x86_64" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/suse.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/debians/debian11-agent-control.json b/test/definitions/agent-control/debians/debian11-agent-control.json new file mode 100644 index 00000000..9b332dfd --- /dev/null +++ b/test/definitions/agent-control/debians/debian11-agent-control.json @@ -0,0 +1,35 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.nano", + "ami_name": "debian-11-amd64-daily-202?????-*", + "user_name": "admin" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/debian.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/debians/ubuntu16-agent-control.json b/test/definitions/agent-control/debians/ubuntu16-agent-control.json new file mode 100644 index 00000000..f18aad7e --- /dev/null +++ b/test/definitions/agent-control/debians/ubuntu16-agent-control.json @@ -0,0 +1,35 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "ubuntu16-super", + "provider": "aws", + "type": "ec2", + "size": "t3.nano", + "ami_name": "ubuntu-pro-server/images/hvm-ssd/ubuntu-xenial-16.04-amd64-pro-server-????????", + "user_name": "ubuntu" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["ubuntu16-super"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/debian.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/debians/ubuntu18-agent-control.json b/test/definitions/agent-control/debians/ubuntu18-agent-control.json new file mode 100644 index 00000000..dc1f9512 --- /dev/null +++ b/test/definitions/agent-control/debians/ubuntu18-agent-control.json @@ -0,0 +1,35 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.nano", + "ami_name": "ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-????????", + "user_name": "ubuntu" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/debian.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/debians/ubuntu20-agent-control.json b/test/definitions/agent-control/debians/ubuntu20-agent-control.json new file mode 100644 index 00000000..e45cd262 --- /dev/null +++ b/test/definitions/agent-control/debians/ubuntu20-agent-control.json @@ -0,0 +1,37 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.nano", + "ami_name": "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-2023*", + "user_name": "ubuntu" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/debian.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/debians/ubuntu20arm64-agent-control.json b/test/definitions/agent-control/debians/ubuntu20arm64-agent-control.json new file mode 100644 index 00000000..c3de0032 --- /dev/null +++ b/test/definitions/agent-control/debians/ubuntu20arm64-agent-control.json @@ -0,0 +1,37 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t4g.nano", + "ami_name": "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-arm64-server-????????-*", + "user_name": "ubuntu" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/debian.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/debians/ubuntu22-agent-control.json b/test/definitions/agent-control/debians/ubuntu22-agent-control.json new file mode 100644 index 00000000..a2add3c7 --- /dev/null +++ b/test/definitions/agent-control/debians/ubuntu22-agent-control.json @@ -0,0 +1,37 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.micro", + "ami_name": "ubuntu/images/hvm-ssd/ubuntu-jammy-22.??-amd64-server-????????", + "user_name": "ubuntu" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/debian.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/logs/amazonlinux2-agent-control-logs.json b/test/definitions/agent-control/logs/amazonlinux2-agent-control-logs.json new file mode 100644 index 00000000..3cdf1cd1 --- /dev/null +++ b/test/definitions/agent-control/logs/amazonlinux2-agent-control-logs.json @@ -0,0 +1,37 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "ami_name": "amzn2-ami-hvm-2.0.????????.?-x86_64-gp2", + "type": "ec2", + "size": "t3.micro" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/logs/amazonlinux2023-aarch64-agent-control-logs.json b/test/definitions/agent-control/logs/amazonlinux2023-aarch64-agent-control-logs.json new file mode 100644 index 00000000..79a4a935 --- /dev/null +++ b/test/definitions/agent-control/logs/amazonlinux2023-aarch64-agent-control-logs.json @@ -0,0 +1,39 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t4g.nano", + "ami_name": "al2023-ami-2023.*-arm64", + "user_name": "ec2-user" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } + } + \ No newline at end of file diff --git a/test/definitions/agent-control/logs/amazonlinux2023-x86-agent-control-logs.json b/test/definitions/agent-control/logs/amazonlinux2023-x86-agent-control-logs.json new file mode 100644 index 00000000..309d21f8 --- /dev/null +++ b/test/definitions/agent-control/logs/amazonlinux2023-x86-agent-control-logs.json @@ -0,0 +1,38 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.small", + "ami_name": "al2023-ami-2023.*-x86_64", + "user_name": "ec2-user" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/logs/debian11-agent-control-logs.json b/test/definitions/agent-control/logs/debian11-agent-control-logs.json new file mode 100644 index 00000000..c89d1c97 --- /dev/null +++ b/test/definitions/agent-control/logs/debian11-agent-control-logs.json @@ -0,0 +1,38 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.nano", + "ami_name": "debian-11-amd64-daily-*", + "user_name": "admin" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/logs/redhat8-agent-control-logs.json b/test/definitions/agent-control/logs/redhat8-agent-control-logs.json new file mode 100644 index 00000000..044039d6 --- /dev/null +++ b/test/definitions/agent-control/logs/redhat8-agent-control-logs.json @@ -0,0 +1,37 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.micro", + "ami_name": "RHEL_HA-8.4.?_HVM-????????-x86_64-??-Hourly2-GP2" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/logs/redhat9-agent-control-logs.json b/test/definitions/agent-control/logs/redhat9-agent-control-logs.json new file mode 100644 index 00000000..426ca9ab --- /dev/null +++ b/test/definitions/agent-control/logs/redhat9-agent-control-logs.json @@ -0,0 +1,37 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.micro", + "ami_name": "RHEL_HA-9.0.?_HVM-????????-x86_64-?-Hourly2-GP2" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/logs/suse154-agent-control-logs.json b/test/definitions/agent-control/logs/suse154-agent-control-logs.json new file mode 100644 index 00000000..ce68e909 --- /dev/null +++ b/test/definitions/agent-control/logs/suse154-agent-control-logs.json @@ -0,0 +1,35 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.nano", + "ami_name": "suse-sles-15-sp4-chost-byos-v????????-hvm-ssd-x86_64" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/logs/suse155-agent-control-logs.json b/test/definitions/agent-control/logs/suse155-agent-control-logs.json new file mode 100644 index 00000000..a2aadc09 --- /dev/null +++ b/test/definitions/agent-control/logs/suse155-agent-control-logs.json @@ -0,0 +1,37 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.micro", + "ami_name": "suse-sles-sap-15-sp5-v*-hvm-ssd-x86_64-*" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": [ + "host1" + ], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/suse.yml", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "local_recipes": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/logs/ubuntu20-agent-control-logs.json b/test/definitions/agent-control/logs/ubuntu20-agent-control-logs.json new file mode 100644 index 00000000..e03dbb5a --- /dev/null +++ b/test/definitions/agent-control/logs/ubuntu20-agent-control-logs.json @@ -0,0 +1,38 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.micro", + "ami_name": "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*", + "user_name": "ubuntu" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/logs/ubuntu22-agent-control-logs.json b/test/definitions/agent-control/logs/ubuntu22-agent-control-logs.json new file mode 100644 index 00000000..0b24b229 --- /dev/null +++ b/test/definitions/agent-control/logs/ubuntu22-agent-control-logs.json @@ -0,0 +1,38 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.micro", + "ami_name": "ubuntu/images/hvm-ssd/ubuntu-jammy-22.??-amd64-server-????????", + "user_name": "ubuntu" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control_logs", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", + "newrelic_cli_option": "-n agent-control,logs-integration-agent-control", + "validate_output": "Logs Integration\\s+\\(installed\\)", + "local_recipes": true, + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/rhel/awslinux23-agent-control.json b/test/definitions/agent-control/rhel/awslinux23-agent-control.json new file mode 100644 index 00000000..28f09890 --- /dev/null +++ b/test/definitions/agent-control/rhel/awslinux23-agent-control.json @@ -0,0 +1,35 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "ami_name": "al2023-ami-2023.*-x86_64", + "type": "ec2", + "size": "t3.nano", + "user_name": "ec2-user" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/rhel.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/rhel/awslinuxarm64-agent-control.json b/test/definitions/agent-control/rhel/awslinuxarm64-agent-control.json new file mode 100644 index 00000000..d7b4c25d --- /dev/null +++ b/test/definitions/agent-control/rhel/awslinuxarm64-agent-control.json @@ -0,0 +1,34 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "ami_name": "amzn2-ami-hvm-2.0.????????.?-arm64-gp2", + "type": "ec2", + "size": "t4g.nano" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/rhel.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/rhel/redhat8arm64-agent-control.json b/test/definitions/agent-control/rhel/redhat8arm64-agent-control.json new file mode 100644 index 00000000..579b78d3 --- /dev/null +++ b/test/definitions/agent-control/rhel/redhat8arm64-agent-control.json @@ -0,0 +1,34 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t4g.micro", + "ami_name": "RHEL-8.*_HVM-????????-arm64-*-Hourly2-GP2" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/rhel.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/suse/suse125-agent-control.json b/test/definitions/agent-control/suse/suse125-agent-control.json new file mode 100644 index 00000000..25cb1220 --- /dev/null +++ b/test/definitions/agent-control/suse/suse125-agent-control.json @@ -0,0 +1,34 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.micro", + "ami_name": "suse-sles-12-sp5-v????????-hvm-*" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/suse.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} diff --git a/test/definitions/agent-control/suse/suse154-agent-control.json b/test/definitions/agent-control/suse/suse154-agent-control.json new file mode 100644 index 00000000..423d32a7 --- /dev/null +++ b/test/definitions/agent-control/suse/suse154-agent-control.json @@ -0,0 +1,34 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.nano", + "ami_name": "suse-sles-15-sp4-chost-byos-v????????-hvm-ssd-x86_64" + } + ], + "instrumentations": { + "resources": [ + { + "id": "nr_agent_control", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/agent-control/suse.yml", + "validate_output": "Agent Control\\s+\\(installed\\)", + "recipe_targeted": "agent-control", + "use_organization_id": true + } + } + ] + } +} From efa5337d3795aaa578fa797ae462ef39b161525f Mon Sep 17 00:00:00 2001 From: Ruben Ruiz de Gauna Date: Wed, 18 Dec 2024 10:46:51 +0100 Subject: [PATCH 4/6] fix(agent-control): fleet_id properly idented in config --- recipes/newrelic/infrastructure/agent-control/debian.yml | 2 +- recipes/newrelic/infrastructure/agent-control/rhel.yml | 2 +- recipes/newrelic/infrastructure/agent-control/suse.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/newrelic/infrastructure/agent-control/debian.yml b/recipes/newrelic/infrastructure/agent-control/debian.yml index 5a16c762..df699b00 100644 --- a/recipes/newrelic/infrastructure/agent-control/debian.yml +++ b/recipes/newrelic/infrastructure/agent-control/debian.yml @@ -434,7 +434,7 @@ install: cmds: - | if [ ! -z "{{.NR_CLI_FLEET_ID}}" ] ; then - sed -i 's/^#\s*fleet_id:/fleet_id:/g' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*fleet_id:/s/# //' /etc/newrelic-agent-control/config.yaml sed -i 's/fleet_id: FLEET_ID_HERE/fleet_id: {{.NR_CLI_FLEET_ID}}/g' /etc/newrelic-agent-control/config.yaml fi diff --git a/recipes/newrelic/infrastructure/agent-control/rhel.yml b/recipes/newrelic/infrastructure/agent-control/rhel.yml index d8a5a92d..c008907a 100644 --- a/recipes/newrelic/infrastructure/agent-control/rhel.yml +++ b/recipes/newrelic/infrastructure/agent-control/rhel.yml @@ -377,7 +377,7 @@ install: cmds: - | if [ ! -z "{{.NR_CLI_FLEET_ID}}" ] ; then - sed -i 's/^#\s*fleet_id:/fleet_id:/g' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*fleet_id:/s/# //' /etc/newrelic-agent-control/config.yaml sed -i 's/fleet_id: FLEET_ID_HERE/fleet_id: {{.NR_CLI_FLEET_ID}}/g' /etc/newrelic-agent-control/config.yaml fi diff --git a/recipes/newrelic/infrastructure/agent-control/suse.yml b/recipes/newrelic/infrastructure/agent-control/suse.yml index d293d026..43e77135 100644 --- a/recipes/newrelic/infrastructure/agent-control/suse.yml +++ b/recipes/newrelic/infrastructure/agent-control/suse.yml @@ -324,7 +324,7 @@ install: cmds: - | if [ ! -z "{{.NR_CLI_FLEET_ID}}" ] ; then - sed -i 's/^#\s*fleet_id:/fleet_id:/g' /etc/newrelic-agent-control/config.yaml + sed -i '/^\s*#\s*fleet_id:/s/# //' /etc/newrelic-agent-control/config.yaml sed -i 's/fleet_id: FLEET_ID_HERE/fleet_id: {{.NR_CLI_FLEET_ID}}/g' /etc/newrelic-agent-control/config.yaml fi From 0db58e51cc836ece9a78b7183cfe128cd1dbd7ec Mon Sep 17 00:00:00 2001 From: Ruben Ruiz de Gauna Date: Wed, 18 Dec 2024 11:04:17 +0100 Subject: [PATCH 5/6] fix(agent-control): rename opamp to fleet_control --- recipes/newrelic/infrastructure/agent-control/debian.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/newrelic/infrastructure/agent-control/debian.yml b/recipes/newrelic/infrastructure/agent-control/debian.yml index df699b00..704251af 100644 --- a/recipes/newrelic/infrastructure/agent-control/debian.yml +++ b/recipes/newrelic/infrastructure/agent-control/debian.yml @@ -447,7 +447,7 @@ install: sed -i '/^\s*fleet_control:/s/^/#/' /etc/newrelic-agent-control/config.yaml sed -i '/^\s*endpoint: https:\/\/opamp/s/^/#/' /etc/newrelic-agent-control/config.yaml else - sed -i 's/s*#\s*opamp:/opamp:/g' /etc/newrelic-agent-control/config.yaml + sed -i 's/s*#\s*fleet_control:/fleet_control:/g' /etc/newrelic-agent-control/config.yaml sed -i '/^\s*#\s*endpoint: https:\/\/opamp/s/# //' /etc/newrelic-agent-control/config.yaml fi - | From f3dea423766ac35e04e828bbd879d57745c5e99e Mon Sep 17 00:00:00 2001 From: Ruben Ruiz de Gauna Date: Wed, 18 Dec 2024 14:38:33 +0100 Subject: [PATCH 6/6] fix(agent-control): delete super agent recipe --- .../infrastructure/super-agent/debian.yml | 730 ------------------ .../super-agent/logs/linux-logs.yml | 274 ------- .../infrastructure/super-agent/rhel.yml | 673 ---------------- .../infrastructure/super-agent/suse.yml | 620 --------------- .../debians/debian11-super-agent-eu.json | 35 - .../debians/ubuntu16-super-agent-eu.json | 35 - .../debians/ubuntu18-super-agent-eu.json | 35 - .../debians/ubuntu20-super-agent-eu.json | 37 - .../debians/ubuntu20arm64-super-agent-eu.json | 37 - .../debians/ubuntu22-super-agent-eu.json | 37 - .../amazonlinux2-super-agent-logs-eu.json | 37 - .../amazonlinux2023-super-agent-logs-eu.json | 38 - .../logs/debian11-super-agent-logs-eu.json | 38 - .../logs/redhat8-super-agent-logs-eu.json | 37 - .../logs/redhat9-super-agent-logs-eu.json | 37 - .../logs/suse154-super-agent-logs-eu.json | 35 - .../logs/ubuntu20-super-agent-logs-eu.json | 38 - .../logs/ubuntu22-super-agent-logs-eu.json | 38 - .../rhel/awslinux23-super-agent-eu.json | 35 - .../rhel/awslinuxarm64-super-agent-eu.json | 34 - .../rhel/redhat8arm64-super-agent-eu.json | 34 - .../suse/suse125-super-agent-eu.json | 34 - .../suse/suse154-super-agent-eu.json | 34 - .../debians/debian11-super-agent.json | 35 - .../debians/ubuntu16-super-agent.json | 35 - .../debians/ubuntu18-super-agent.json | 35 - .../debians/ubuntu20-super-agent.json | 37 - .../debians/ubuntu20arm64-super-agent.json | 37 - .../debians/ubuntu22-super-agent.json | 37 - .../logs/amazonlinux2-super-agent-logs.json | 37 - ...zonlinux2023-aarch64-super-agent-logs.json | 39 - .../amazonlinux2023-x86-super-agent-logs.json | 38 - .../logs/debian11-super-agent-logs.json | 38 - .../logs/redhat8-super-agent-logs.json | 37 - .../logs/redhat9-super-agent-logs.json | 37 - .../logs/suse154-super-agent-logs.json | 35 - .../logs/suse155-super-agent-logs.json | 37 - .../logs/ubuntu20-super-agent-logs.json | 38 - .../logs/ubuntu22-super-agent-logs.json | 38 - .../rhel/awslinux23-super-agent.json | 35 - .../rhel/awslinuxarm64-super-agent.json | 34 - .../rhel/redhat8arm64-super-agent.json | 34 - .../super-agent/suse/suse125-super-agent.json | 34 - .../super-agent/suse/suse154-super-agent.json | 34 - 44 files changed, 3743 deletions(-) delete mode 100644 recipes/newrelic/infrastructure/super-agent/debian.yml delete mode 100644 recipes/newrelic/infrastructure/super-agent/logs/linux-logs.yml delete mode 100644 recipes/newrelic/infrastructure/super-agent/rhel.yml delete mode 100644 recipes/newrelic/infrastructure/super-agent/suse.yml delete mode 100644 test/definitions-eu/super-agent/debians/debian11-super-agent-eu.json delete mode 100644 test/definitions-eu/super-agent/debians/ubuntu16-super-agent-eu.json delete mode 100644 test/definitions-eu/super-agent/debians/ubuntu18-super-agent-eu.json delete mode 100644 test/definitions-eu/super-agent/debians/ubuntu20-super-agent-eu.json delete mode 100644 test/definitions-eu/super-agent/debians/ubuntu20arm64-super-agent-eu.json delete mode 100644 test/definitions-eu/super-agent/debians/ubuntu22-super-agent-eu.json delete mode 100644 test/definitions-eu/super-agent/logs/amazonlinux2-super-agent-logs-eu.json delete mode 100644 test/definitions-eu/super-agent/logs/amazonlinux2023-super-agent-logs-eu.json delete mode 100644 test/definitions-eu/super-agent/logs/debian11-super-agent-logs-eu.json delete mode 100644 test/definitions-eu/super-agent/logs/redhat8-super-agent-logs-eu.json delete mode 100644 test/definitions-eu/super-agent/logs/redhat9-super-agent-logs-eu.json delete mode 100644 test/definitions-eu/super-agent/logs/suse154-super-agent-logs-eu.json delete mode 100644 test/definitions-eu/super-agent/logs/ubuntu20-super-agent-logs-eu.json delete mode 100644 test/definitions-eu/super-agent/logs/ubuntu22-super-agent-logs-eu.json delete mode 100644 test/definitions-eu/super-agent/rhel/awslinux23-super-agent-eu.json delete mode 100644 test/definitions-eu/super-agent/rhel/awslinuxarm64-super-agent-eu.json delete mode 100644 test/definitions-eu/super-agent/rhel/redhat8arm64-super-agent-eu.json delete mode 100644 test/definitions-eu/super-agent/suse/suse125-super-agent-eu.json delete mode 100644 test/definitions-eu/super-agent/suse/suse154-super-agent-eu.json delete mode 100644 test/definitions/super-agent/debians/debian11-super-agent.json delete mode 100644 test/definitions/super-agent/debians/ubuntu16-super-agent.json delete mode 100644 test/definitions/super-agent/debians/ubuntu18-super-agent.json delete mode 100644 test/definitions/super-agent/debians/ubuntu20-super-agent.json delete mode 100644 test/definitions/super-agent/debians/ubuntu20arm64-super-agent.json delete mode 100644 test/definitions/super-agent/debians/ubuntu22-super-agent.json delete mode 100644 test/definitions/super-agent/logs/amazonlinux2-super-agent-logs.json delete mode 100644 test/definitions/super-agent/logs/amazonlinux2023-aarch64-super-agent-logs.json delete mode 100644 test/definitions/super-agent/logs/amazonlinux2023-x86-super-agent-logs.json delete mode 100644 test/definitions/super-agent/logs/debian11-super-agent-logs.json delete mode 100644 test/definitions/super-agent/logs/redhat8-super-agent-logs.json delete mode 100644 test/definitions/super-agent/logs/redhat9-super-agent-logs.json delete mode 100644 test/definitions/super-agent/logs/suse154-super-agent-logs.json delete mode 100644 test/definitions/super-agent/logs/suse155-super-agent-logs.json delete mode 100644 test/definitions/super-agent/logs/ubuntu20-super-agent-logs.json delete mode 100644 test/definitions/super-agent/logs/ubuntu22-super-agent-logs.json delete mode 100644 test/definitions/super-agent/rhel/awslinux23-super-agent.json delete mode 100644 test/definitions/super-agent/rhel/awslinuxarm64-super-agent.json delete mode 100644 test/definitions/super-agent/rhel/redhat8arm64-super-agent.json delete mode 100644 test/definitions/super-agent/suse/suse125-super-agent.json delete mode 100644 test/definitions/super-agent/suse/suse154-super-agent.json diff --git a/recipes/newrelic/infrastructure/super-agent/debian.yml b/recipes/newrelic/infrastructure/super-agent/debian.yml deleted file mode 100644 index 6dec4eae..00000000 --- a/recipes/newrelic/infrastructure/super-agent/debian.yml +++ /dev/null @@ -1,730 +0,0 @@ -# Visit our schema definition for additional information on this file format. -# https://github.com/newrelic/open-install-library/blob/main/docs/recipe-spec/recipe-spec.md#schema-definition - -name: super-agent -displayName: Agent Control -description: New Relic install recipe for Agent Control -repository: https://github.com/newrelic/newrelic-super-agent - -installTargets: - - type: host - os: linux - platformFamily: debian - platformVersion: "(10|11|12)\\.*" # Buster, Bullseye, Bookworm # - - type: host - os: linux - platform: ubuntu - platformVersion: "(16|18|20|22|24)\\.04" - -keywords: - - SuperAgent - - OpenTelemetry - - OTel - - Infrastructure - - Agent - - Linux - - Debian - - jammy - - focal - - bionic - - xenial - - bullseye - - buster - -processMatch: [] - -preInstall: - requireAtDiscovery: | - IS_DOCKER_CONTAINER_CGROUP=$(grep 'docker\|lxc' /proc/1/cgroup | wc -l) - if [ $IS_DOCKER_CONTAINER_CGROUP -gt 0 ] ; then - echo "docker detected with cgroup, unsupported" >&2 - exit 131 - fi - IS_DOCKER_CONTAINER_ENVIRON=$(grep container=lxc /proc/1/environ | wc -l) - if [ $IS_DOCKER_CONTAINER_ENVIRON -gt 0 ] ; then - echo "docker detected with environ, unsupported" >&2 - exit 131 - fi - if [ -f /.dockerenv ] ; then - echo "docker detected with .dockerenv, unsupported" >&2 - exit 131 - fi - IS_WSL_CONTAINER=$(grep -i 'Microsoft' /proc/version | wc -l) - if [ $IS_WSL_CONTAINER -gt 0 ] ; then - echo "microsoft Windows Subsystem for Linux for infra detected, unsupported" >&2 - exit 131 - fi - exit 0 - - discoveryMode: - - targeted -install: - version: "3" - silent: true - vars: - IS_SYSTEMCTL: - sh: command -v systemctl | wc -l - IS_INITCTL: - sh: command -v initctl | wc -l - tasks: - default: - cmds: - - task: write_recipe_metadata - - task: detect_previous_install - - task: assert_pre_req - - task: cleanup - - task: setup_infra_license - - task: setup_infra_proxy - - task: log_ssl_ciphers - - task: update_apt - - task: install_gnupg - - task: add_gpg_key - - task: add_nr_source - - task: update_apt_nr_source - - task: install_super_agent - - task: update_otel_license_key - - task: config_supervisors - - task: config_fleet_id - - task: config_fleet_control - - task: config_super_agent_auth - - task: config_host_monitoring - - task: update_otel_mem_limit - - task: update_otel_end_point - - task: migrate_newrelic_infra_config - - task: restart_super_agent - - task: assert_super_agent_status_ok - - task: signal_recipe_applied - - task: post_install - - write_recipe_metadata: - cmds: - - | - echo '{"Metadata":{"CapturedCliOutput":"true"}}' | tee {{.NR_CLI_OUTPUT}} > /dev/null - - detect_previous_install: - cmds: - - | - if [ -f /etc/newrelic-super-agent/.nr-cli ] ; then - echo "A previous execution of this installation was detected. Some installation tasks will be skipped." - echo "If you would like to run all the tasks, please remove the /etc/newrelic-super-agent/.nr-cli file and re-run the installation." - fi - - assert_pre_req: - cmds: - - | - IS_ROOT_OR_SUDO=$([ ! -z "$SUDO_USER" ] || [ $(whoami) = "root" ] && echo "true" || echo "false") # Assert root or sudo user - if [ "$IS_ROOT_OR_SUDO" = "false" ]; then - echo "This newrelic install must be run under sudo or root" >&2 - exit 3 - fi - - | - IS_GREP_INSTALLED=$(which grep | wc -l) - if [ $IS_GREP_INSTALLED -eq 0 ] ; then - echo "grep is required to run the newrelic install. Please install grep and re-run the installation." >&2 - exit 10 - fi - - | - IS_SED_INSTALLED=$(which sed | wc -l) - if [ $IS_SED_INSTALLED -eq 0 ] ; then - echo "sed is required to run the newrelic install. Please install sed and re-run the installation." >&2 - exit 11 - fi - - | - IS_AWK_INSTALLED=$(which awk | wc -l) - if [ $IS_AWK_INSTALLED -eq 0 ] ; then - echo "awk is required to run the newrelic install. Please install awk and re-run the installation." >&2 - exit 12 - fi - - | - IS_CAT_INSTALLED=$(which cat | wc -l) - if [ $IS_CAT_INSTALLED -eq 0 ] ; then - echo "cat is required to run the newrelic install. Please install cat and re-run the installation." >&2 - exit 13 - fi - - | - IS_TEE_INSTALLED=$(which tee | wc -l) - if [ $IS_TEE_INSTALLED -eq 0 ] ; then - echo "tee is required to run the newrelic install. Please install tee and re-run the installation." >&2 - exit 14 - fi - - | - IS_TOUCH_INSTALLED=$(which touch | wc -l) - if [ $IS_TOUCH_INSTALLED -eq 0 ] ; then - echo "touch is required to run the newrelic install. Please install touch and re-run the installation." >&2 - exit 15 - fi - - | - IS_CURL_INSTALLED=$(which curl | wc -l) - if [ $IS_CURL_INSTALLED -eq 0 ] ; then - echo "curl is required to run the newrelic install. Please install curl and re-run the installation." >&2 - exit 16 - fi - - | - IS_OPENSSL_INSTALLED=$(which openssl | wc -l) - if [ $IS_OPENSSL_INSTALLED -eq 0 ] ; then - echo "openssl is required to run the newrelic install. Please install openssl and re-run the installation." >&2 - exit 17 - fi - - | - IS_MKTEMP_INSTALLED=$(which mktemp | wc -l) - if [ $IS_MKTEMP_INSTALLED -eq 0 ] ; then - echo "mktemp is required to run the newrelic install. Please install coreutils and re-run the installation." >&2 - exit 18 - fi - - | - if [ -n "{{.DEBIAN_CODENAME}}" ]; then - IS_AGENT_AVAILABLE=$(curl -Is {{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/apt/dists/{{.DEBIAN_CODENAME}}/InRelease | grep " 2[0-9][0-9] " | wc -l) - if [ $IS_AGENT_AVAILABLE -eq 0 ] ; then - echo "there is no New Relic Agent Control available for the distribution with codename '{{.DEBIAN_CODENAME}}'." >&2 - exit 131 - fi - else - if [ -n "{{.DEBIAN_VERSION_CODENAME}}" ]; then - 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) - if [ $IS_INFRA_AVAILABLE -eq 0 ] ; then - echo "there is no New Relic Agent Control available for the distribution with version codename '{{.DEBIAN_VERSION_CODENAME}}'." >&2 - exit 131 - fi - else - echo "there is no New Relic Agent Control available for the distribution, no version codename was found." >&2 - exit 131 - fi - fi - vars: - DEBIAN_CODENAME: - sh: awk -F= '/VERSION_CODENAME/ {print $2}' /etc/os-release - DEBIAN_VERSION_CODENAME: - sh: cat /etc/os-release | grep "VERSION=\"[0-9] " | awk -F " " '{print $2}' | sed 's/[()"]//g' - - cleanup: - # skipping this task if .nr-cli exists - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then - rm -rf /var/db/newrelic-infra/data 2>/dev/null - fi - - setup_infra_license: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then - if [ -f /etc/newrelic-infra.yml ]; then - printf "\nAn existing newrelic-infra configuration file was detected. Updating where needed." - - sed -i "/^staging/d" /etc/newrelic-infra.yml - sed -i "/^enable_process_metrics/d" /etc/newrelic-infra.yml - sed -i "/^status_server_enabled/d" /etc/newrelic-infra.yml - sed -i "/^status_server_port/d" /etc/newrelic-infra.yml - sed -i "/^license_key/d" /etc/newrelic-infra.yml - sed -i '/^custom_attributes:/,/^\S/{ /^\S/!d }' /etc/newrelic-infra.yml - sed -i '/^custom_attributes:/d' /etc/newrelic-infra.yml - sed -i "/^is_integrations_only/d" /etc/newrelic-infra.yml - - if [ "{{.NR_SA_MIGRATE_INFRA_CONFIG}}" == "true" ] || [ "{{.NEW_RELIC_ASSUME_YES}}" == "true" ] ; then - touch /etc/newrelic-infra-do-migrate - else - printf "\nWould you like to migrate this newrelic-infra config to use it with New Relic Agent Control? (y/N): " - read -r MIGRATE_NEWRELIC_INFRA_CONFIG - MIGRATE_NEWRELIC_INFRA_CONFIG=${MIGRATE_NEWRELIC_INFRA_CONFIG:-N} - - if [ "$MIGRATE_NEWRELIC_INFRA_CONFIG" == "y" ] ; then - touch /etc/newrelic-infra-do-migrate - fi - fi - else - touch /etc/newrelic-infra.yml - # If we are creating a new file, perform the migration as well - touch /etc/newrelic-infra-do-migrate - fi - fi - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then - if [ $(echo {{.NEW_RELIC_REGION}} | grep -i staging | wc -l) -gt 0 ]; then - echo 'staging: true' >> /etc/newrelic-infra.yml - fi - 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 '{{.NRIA_CUSTOM_ATTRIBUTES}}' >> /etc/newrelic-infra.yml - fi - setup_infra_proxy: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] && [ ! -z "$HTTPS_PROXY" ]; then - sed -i "/^proxy/d" /etc/newrelic-infra.yml - echo 'proxy: {{.HTTPS_PROXY}}' >> /etc/newrelic-infra.yml - fi - - log_ssl_ciphers: - cmds: - - | - IS_SORT_INSTALLED=$(which sort | wc -l) - IS_UNIQ_INSTALLED=$(which uniq | wc -l) - if [ $IS_SORT_INSTALLED -gt 0 ] && [ $IS_UNIQ_INSTALLED -gt 0 ]; then - echo "Detecting available SSL ciphers..." - openssl ciphers -v | awk '{print " - " $2}' | sort | uniq - fi - ignore_error: true - - update_apt: - cmds: - - | - # Get latest definitions and skip any failure because of deprecation - OPTIONS="-o DPkg::Lock::Timeout=60 -o Acquire::Check-Valid-Until=false" - if [ ! -z "$HTTPS_PROXY" ]; then - OPTIONS="$OPTIONS -o Acquire::Http::Proxy={{.HTTPS_PROXY}}" - fi - apt-get $OPTIONS update -yq - silent: true - # apt will return an error if fails to update any of its sources. Ignore these errors and let the "install_infra" task fail. - ignore_error: true - - install_gnupg: - cmds: - - | - if [ {{.HAS_GPG}} -eq 0 ] ; then - OPTIONS="-o DPkg::Lock::Timeout=60" - if [ ! -z "$HTTPS_PROXY" ]; then - OPTIONS="$OPTIONS -o Acquire::Http::Proxy={{.HTTPS_PROXY}}" - fi - apt-get $OPTIONS install gnupg2 -y - fi - vars: - HAS_GPG: - sh: command -v gpg | wc -l - - add_gpg_key: - cmds: - - | - curl -s {{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/keys/newrelic_apt_key_current.gpg | apt-key add - - silent: true - - add_nr_source: - cmds: - - | - ARCH="amd64" - IS_ARM=$(uname -m | grep -i 'aarch64' | wc -l) - if [ $IS_ARM -gt 0 ] ; then - ARCH="arm64" - fi - - if [ -n "{{.DEBIAN_CODENAME}}" ]; then - printf "deb [arch="$ARCH"] {{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/linux/apt {{.DEBIAN_CODENAME}} main" | tee /etc/apt/sources.list.d/newrelic-infra.list > /dev/null - printf "\ndeb [arch="$ARCH"] {{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/apt {{.DEBIAN_CODENAME}} main" | tee -a /etc/apt/sources.list.d/newrelic-infra.list > /dev/null - else - printf "deb [arch="$ARCH"] {{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/linux/apt {{.DEBIAN_VERSION_CODENAME}} main" | tee /etc/apt/sources.list.d/newrelic-infra.list > /dev/null - printf "\ndeb [arch="$ARCH"] {{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/apt {{.DEBIAN_VERSION_CODENAME}} main" | tee -a /etc/apt/sources.list.d/newrelic-infra.list > /dev/null - fi - vars: - DEBIAN_CODENAME: - sh: awk -F= '/VERSION_CODENAME/ {print $2}' /etc/os-release - DEBIAN_VERSION_CODENAME: - sh: cat /etc/os-release | grep "VERSION=\"[0-9] " | awk -F " " '{print $2}' | sed 's/[()"]//g' - silent: true - - update_apt_nr_source: - cmds: - - | - # Get latest definitions and skip any failure because of deprecation - OPTIONS="-o DPkg::Lock::Timeout=60 -o Acquire::Check-Valid-Until=false" - if [ ! -z "$HTTPS_PROXY" ]; then - OPTIONS="$OPTIONS -o Acquire::Http::Proxy={{.HTTPS_PROXY}}" - fi - apt-get $OPTIONS update -yq - # apt will return an error if fails to update any of its sources. Ignore these errors and let the "install_infra" task fail. Just to trigger the pipeline - ignore_error: true - - install_super_agent: - cmds: - - | - OPTIONS="-o DPkg::Lock::Timeout=60" - if [ ! -z "$HTTPS_PROXY" ]; then - OPTIONS="$OPTIONS -o Acquire::Http::Proxy={{.HTTPS_PROXY}}" - fi - apt-get $OPTIONS install newrelic-super-agent -y -qq - # Check the exit status of the previous command - if [ $? -ne 0 ]; then - echo "Error: newrelic-super-agent installation failed" - echo "Attempting to configure the packages again" - dpkg --configure -a - # Check if there was an error - if [ $? -ne 0 ]; then - echo "Error found while reconfiguring dpkg database" - # Force-Install the Software - echo "Attempting to install any missing dependencies or fixes broken packages." - apt-get $OPTIONS install -f - if [ $? -ne 0 ]; then - exit 1 - fi - echo "Installation is successful" - fi - fi - silent: true - - # If configured to do so, migrate the newrelic-infra configuration for usage with New Relic Agent Control - migrate_newrelic_infra_config: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ -f /etc/newrelic-infra-do-migrate ]; then - rm /etc/newrelic-infra-do-migrate - newrelic-config-migrate - fi - - # Add NR Ingest Key as ENV Var for the super-agent Systemd service (used by Infra Agent and Otel) - update_otel_license_key: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - 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: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - 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: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then - if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then - sed -i "s/endpoint: .*$/endpoint: https:\/\/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: https:\/\/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: https:\/\/otlp.nr-data.net:4317/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml - fi - fi - - config_supervisors: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ]; then - cp /etc/newrelic-super-agent/examples/super-agent-config-no-agents.yaml /etc/newrelic-super-agent/config.yaml - elif [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ]; then - cp /etc/newrelic-super-agent/examples/super-agent-config-nr-otel-collector.yaml /etc/newrelic-super-agent/config.yaml - elif [ "{{.NR_CLI_NRDOT}}" = "false" ]; then - cp /etc/newrelic-super-agent/examples/super-agent-config-nr-infra-agent.yaml /etc/newrelic-super-agent/config.yaml - else - cp /etc/newrelic-super-agent/examples/super-agent-config-all-agents.yaml /etc/newrelic-super-agent/config.yaml - fi - - config_fleet_id: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ ! -z "{{.NR_CLI_FLEET_ID}}" ] ; then - sed -i 's/^#\s*fleet_id:/fleet_id:/g' /etc/newrelic-super-agent/config.yaml - sed -i 's/fleet_id: FLEET_ID_HERE/fleet_id: {{.NR_CLI_FLEET_ID}}/g' /etc/newrelic-super-agent/config.yaml - fi - - config_fleet_control: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" = "false" ]; then - sed -i '/^\s*fleet_control:/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*endpoint: https:\/\/opamp/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 - fi - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" = "false" ]; then - 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*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_SUPER_AGENT_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 - - | - 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 - - config_super_agent_auth: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" != "false" ] && [ "{{ .NEW_RELIC_ORGANIZATION }}" != "" ]; then - sed -i '/^\s*#\s*auth_config:\s*$/s/# //' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*token_url: PLACEHOLDER/s/# //' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*client_id: PLACEHOLDER/s/# //' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*provider: PLACEHOLDER/s/# //' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*private_key_path: PLACEHOLDER/s/# //' /etc/newrelic-super-agent/config.yaml - else - sed -i '/^\s*auth_config:/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*token_url: PLACEHOLDER/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*client_id: PLACEHOLDER/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*provider: PLACEHOLDER/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*private_key_path: PLACEHOLDER/s/^/#/' /etc/newrelic-super-agent/config.yaml - fi - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" != "false" ] && [ "{{ .NEW_RELIC_ORGANIZATION }}" != "" ]; then - set -uo pipefail - - mkdir -p /etc/newrelic-super-agent/keys - chown root:root /etc/newrelic-super-agent/keys - chmod 700 /etc/newrelic-super-agent/keys - - TEMPORAL_FOLDER=$(mktemp -d newrelic-super-agent.XXXXXXXXXX) - chown root:root "${TEMPORAL_FOLDER}" - chmod 700 "${TEMPORAL_FOLDER}" - trap "rm -rf $TEMPORAL_FOLDER" EXIT - openssl genrsa -out "$TEMPORAL_FOLDER/key" 4096 - openssl rsa -in "$TEMPORAL_FOLDER/key" -pubout -out "$TEMPORAL_FOLDER/pub" - - if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then - REGISTRATION_ENDPOINT=https://staging-api.newrelic.com/graphql - TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.staging-service.newrelic.com/oauth2/token - IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.staging-service.nr-ops.net/system-identity/graphql - elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then - REGISTRATION_ENDPOINT=https://api.eu.newrelic.com/graphql - TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.service.newrelic.com/oauth2/token - IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.service.eu.nr-ops.net/system-identity/graphql - else - REGISTRATION_ENDPOINT=https://api.newrelic.com/graphql - TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.service.newrelic.com/oauth2/token - IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.service.nr-ops.net/system-identity/graphql - fi - - ############################################################ - # Get the L1 Access Token - ############################################################ - if [ "{{.NEW_RELIC_AUTH_CLIENT_ID}}" != "" ] && [ "{{.NEW_RELIC_AUTH_CLIENT_SECRET}}" != "" ]; then - RESPONSE_FILE=$TEMPORAL_FOLDER/response_token.json - for RETRY in 1 2 3; do - HTTP_CODE=$(echo '{"client_id": "{{.NEW_RELIC_AUTH_CLIENT_ID}}", "client_secret": "{{.NEW_RELIC_AUTH_CLIENT_SECRET}}", "grant_type": "client_credentials"}' | tr -d $'\n' | curl \ - -s -w "%{http_code}" \ - -H "Content-Type: application/json" \ - -o "$RESPONSE_FILE" \ - --data-binary @- \ - "$TOKEN_RENEWAL_ENDPOINT" - ) - - if [ $HTTP_CODE -eq 200 ]; then - break - fi - - ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.error_description // "invalid_request"' < "$TEMPORAL_FOLDER/response_token.json" | tr -d '"') - - echo "Error getting system identity auth token. The API endpoint returned $HTTP_CODE: $ERROR_MESSAGE. Retrying ($RETRY/3)..." - sleep 2 - done - - if [ $HTTP_CODE -ne 200 ]; then - echo "Error getting system identity auth token" - exit 99 - fi - - ACCESS_TOKEN=$(/usr/local/bin/newrelic utils jq '.access_token' < "$RESPONSE_FILE" | tr -d '"' ) - - ############################################################ - # Create System Identity - ############################################################ - DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") - NAME="System Identity for $(hostname) - $DATE" - - for RETRY in 1 2 3; do - HTTP_CODE=$(echo '{ "query": - "mutation { - create( - name: \"'$NAME'\", - organizationId: \"{{ .NEW_RELIC_ORGANIZATION }}\", - publicKey: \"'$(openssl enc -base64 -A -in "$TEMPORAL_FOLDER/pub")'\" - ) { - clientId, - name - } - }" - }' | tr -d $'\n' | curl \ - -s -w "%{http_code}" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $ACCESS_TOKEN" \ - -o "$TEMPORAL_FOLDER/response.json" \ - --data-binary @- \ - "$IDENTITY_CREATION_ENDPOINT" - ) - - if [ $HTTP_CODE -eq 200 ]; then - break - fi - - echo "Error creating L2 system identity. The API endpoint returned $HTTP_CODE. Retrying ($RETRY/3)..." - sleep 2 - done - - if [ $HTTP_CODE -ne 200 ]; then - exit 99 - fi - - ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.errors[0].message // "NOERROR"' < "$TEMPORAL_FOLDER/response.json" | tr -d '"') - if [ "$ERROR_MESSAGE" != "NOERROR" ]; then - echo "Failed to create a New Relic System Identity for Fleet Control communication authentication. Please verify that your User Key is valid and that your Account Organization has the necessary permissions to create a System Identity: $ERROR_MESSAGE" - exit 100 - fi - - CLIENT_ID=$(/usr/local/bin/newrelic utils jq '.data.create.clientId' < "$TEMPORAL_FOLDER/response.json" | tr -d '"' ) - else - ############################################################ - # Create System Identity (Legacy) - ############################################################ - DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") - NAME="System Identity for $(hostname) - $DATE" - - for RETRY in 1 2 3; do - HTTP_CODE=$(echo '{ "query": - "mutation { - systemIdentityCreate( - name: \"'$NAME'\", - organizationId: \"{{ .NEW_RELIC_ORGANIZATION }}\", - publicKey: \"'$(openssl enc -base64 -A -in "$TEMPORAL_FOLDER/pub")'\" - ) { - clientId, - name - } - }" - }' | tr -d $'\n' | curl \ - -s -w "%{http_code}" \ - -H "Content-Type: application/json" \ - -H "API-Key: {{ .NEW_RELIC_API_KEY }}" \ - -o "$TEMPORAL_FOLDER/response.json" \ - --data-binary @- \ - "$REGISTRATION_ENDPOINT" - ) - - if [ $HTTP_CODE -eq 200 ]; then - break - fi - - echo "Error creating the new system identity. The API endpoint returned $HTTP_CODE. Retrying ($RETRY/3)..." - sleep 2 - done - - if [ $HTTP_CODE -ne 200 ]; then - exit 99 - fi - - ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.errors[0].message // "NOERROR"' < "$TEMPORAL_FOLDER/response.json" | tr -d '"') - if [ "$ERROR_MESSAGE" != "NOERROR" ]; then - echo "Failed to create a New Relic System Identity for Fleet Control communication authentication. Please verify that your User Key is valid and that your Account Organization has the necessary permissions to create a System Identity: $ERROR_MESSAGE" - exit 100 - fi - - CLIENT_ID=$(/usr/local/bin/newrelic utils jq '.data.systemIdentityCreate.clientId' < "$TEMPORAL_FOLDER/response.json" | tr -d '"' ) - fi - - mv "$TEMPORAL_FOLDER/key" "/etc/newrelic-super-agent/keys/$CLIENT_ID.key" - sed -i 's~token_url: PLACEHOLDER~token_url: '"$TOKEN_RENEWAL_ENDPOINT"'~g' /etc/newrelic-super-agent/config.yaml - sed -i 's/client_id: PLACEHOLDER/client_id: '"$CLIENT_ID"'/g' /etc/newrelic-super-agent/config.yaml - sed -i 's/provider: PLACEHOLDER/provider: local/g' /etc/newrelic-super-agent/config.yaml - sed -i 's~private_key_path: PLACEHOLDER~private_key_path: '"/etc/newrelic-super-agent/keys/$CLIENT_ID.key"'~g' /etc/newrelic-super-agent/config.yaml - fi - - config_host_monitoring: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_HOST_MONITORING_SOURCE}}" = "otel" ]; then - echo 'is_integrations_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.yaml /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml - else - 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.yaml /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml - fi - fi - - restart_super_agent: - cmds: - - | - if [ {{.IS_SYSTEMCTL}} -gt 0 ]; then - systemctl restart newrelic-super-agent - else - if [ {{.IS_INITCTL}} -gt 0 ]; then - initctl restart newrelic-super-agent - else - /etc/init.d/newrelic-super-agent restart - fi - fi - - assert_super_agent_status_ok: - cmds: - - | - MAX_RETRIES=150 - TRIES=0 - echo "Running agent status check attempt..." - # wait for status endpoint to be ready - while [ $TRIES -lt $MAX_RETRIES ]; do - ((TRIES++)) - statusCheckOutput=$(curl -s http://localhost:51200/status) - if [ -z "$statusCheckOutput" ]; then - # so jq doesn't fail if empty - statusCheckOutput="{}" - fi - STATUS=$(echo $statusCheckOutput | /usr/local/bin/newrelic utils jq '.super_agent.healthy') - if [ "$STATUS" == "true" ]; then - echo "Agent status check ok." - break - else - if [ "$TRIES" -eq "$MAX_RETRIES" ]; then - # Process-based validation attempt - IS_AGENT_INSTALLED=$(ps aux | grep newrelic-super-agent | grep -v grep | wc -l) - if [ $IS_AGENT_INSTALLED -gt 0 ] ; then - echo "detected newrelic-super-agent process running" - exit 0 - fi - - 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 - - if [ {{.IS_SYSTEMCTL}} -gt 0 ]; then - journalctl -u newrelic-super-agent --no-pager - fi - - exit 31 - fi - fi - - sleep 2 - done - - signal_recipe_applied: - cmds: - - | - touch /etc/newrelic-super-agent/.nr-cli - - post_install: - info: |2 - ⚙️ New Relic Agent Control configuration file can be found in /etc/newrelic-super-agent/config.yaml diff --git a/recipes/newrelic/infrastructure/super-agent/logs/linux-logs.yml b/recipes/newrelic/infrastructure/super-agent/logs/linux-logs.yml deleted file mode 100644 index 2ecfc142..00000000 --- a/recipes/newrelic/infrastructure/super-agent/logs/linux-logs.yml +++ /dev/null @@ -1,274 +0,0 @@ -# Visit our schema definition for additional information on this file format -# https://github.com/newrelic/open-install-library/blob/main/docs/recipe-spec/recipe-spec.md#schema-definition - -name: logs-integration-super-agent -displayName: Logs Integration -description: New Relic install recipe for Logging in super-agent -repository: https://github.com/newrelic/infrastructure-agent/tree/master/assets/examples/logging - -installTargets: - - type: host - os: linux - platform: amazon - platformVersion: "2" # Required to override linux-unsupported - kernelArch: x86_64 - - type: host - os: linux - platform: amazon - platformVersion: "2022" - kernelArch: x86_64 - - type: host - os: linux - platform: amazon - platformVersion: "(2023\\.*)" - kernelArch: x86_64 - - type: host - os: linux - platform: "debian" - platformVersion: "((8|9|10|11|12)\\.?.*)" # Jessie, Buster, Strecht - kernelArch: x86_64 - - type: host - os: linux - platform: "ubuntu" - platformVersion: "(((16|18|20|21|22|24)\\.04)|(20.10))" # Xenial, Bionic, Focal, Hirsute, Jammy, Groovy - - type: host - os: linux - platform: "redhat" - platformFamily: rhel - platformVersion: "((7|8|9)\\.?.*)" - - type: host - os: linux - platform: "centos" - platformFamily: rhel - platformVersion: "((7|8|9)\\.?.*)" - - type: host - os: linux - platformFamily: suse - platformVersion: "(15\\.[1-5]|15-SP[1-5])" - kernelArch: x86_64 - # ARM supported - - type: host - os: linux - platform: amazon - platformVersion: "2" - kernelArch: aarch64 - - type: host - os: linux - platform: "debian" - platformVersion: "((8|9|10|11|12)\\.?.*)" # Jessie, Buster, Strecht - kernelArch: aarch64 - - type: host - os: linux - platform: "ubuntu" - platformVersion: "(((16|18|20|21|22)\\.04)|(20.10))" # Xenial, Bionic, Focal, Hirsute, Jammy, Groovy - kernelArch: aarch64 - - type: host - os: linux - platform: "centos" - platformFamily: rhel - platformVersion: "((7|8)\\.?.*)" - kernelArch: aarch64 - - type: host - os: linux - platform: amazon - platformVersion: "(2023\\.*)" - kernelArch: aarch64 - # Fluent Bit supported is not available for Suse aarch64 - # - type: host - # os: linux - # platformFamily: suse - # platformVersion: "(15\\.[1-5]|15-SP[1-5])" - # kernelArch: aarch64 - -keywords: - - Logs - -processMatch: [] - -preInstall: - discoveryMode: - - targeted - -install: - version: "3" - silent: true - - tasks: - default: - cmds: - - task: assert_pre_req - - task: init - - task: setup - - task: logEvent - - assert_pre_req: - cmds: - - | - IS_ROOT_OR_SUDO=$([ ! -z "$SUDO_USER" ] || [ $(whoami) = "root" ] && echo "true" || echo "false") # Assert root or sudo user - if [ "$IS_ROOT_OR_SUDO" = "false" ]; then - echo "This newrelic install must be run under sudo or root" >&2 - exit 3 - fi - - | - # Map of tool names to the associated error code - required_tools_and_error_codes="grep:10 sed:11 tee:14 touch:15" - - for tuple in $required_tools_and_error_codes; do - tool=$(echo ${tuple} |cut -d':' -f1) - code=$(echo ${tuple} |cut -d':' -f2) - - IS_TOOL_INSTALLED=$(which ${tool} | wc -l) - if [ "$IS_TOOL_INSTALLED" -eq 0 ]; then - echo "This installation recipe on Linux requires '${tool}' to be installed." >&2 - exit ${code} - fi - done - - init: - cmds: - - | - if [ -f /etc/newrelic-infra/logging.d/logging.yml ]; then - rm /etc/newrelic-infra/logging.d/logging.yml; - fi - - | - if [ -f /etc/newrelic-infra/logging.d/discovered.yml ]; then - rm /etc/newrelic-infra/logging.d/discovered.yml; - fi - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_HOST_MONITORING_SOURCE}}" != "otel" ]; then - mkdir -p "/etc/newrelic-infra/logging.d" - touch /etc/newrelic-infra/logging.d/logging.yml; - touch /etc/newrelic-infra/logging.d/discovered.yml; - fi - - setup: - cmds: - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_HOST_MONITORING_SOURCE}}" != "otel" ]; then - NR_CLI_SKIP_LOGS={{.NR_CLI_SKIP_LOGS}} - target_log_files=() - target_discovered_log_files=() - source_log_files=("/var/log/alternatives.log") - source_log_files+=("/var/log/cloud-init.log") - source_log_files+=("/var/log/auth.log") - source_log_files+=("/var/log/dpkg.log") - source_log_files+=("/var/log/syslog") - source_log_files+=("/var/log/messages") - source_log_files+=("/var/log/secure") - source_log_files+=("/var/log/yum.log") - - for log_file in "${source_log_files[@]}" - do - file_exist=$(ls $log_file 2>1 | wc -l) - if [ $file_exist -gt 0 ]; then - target_log_files+=($log_file) - fi - done - - discoveredLogFiles=$(echo -n "{{.NR_DISCOVERED_LOG_FILES | trim}}") - discoveredLogsStringLength=${#discoveredLogFiles} - # Disable glob expansion (necessary for discovered logs) - set -f - if [ $discoveredLogsStringLength -gt 0 ]; then - for filePath in $(echo -n $discoveredLogFiles | sed "s/,/ /g"); do - target_discovered_log_files+=($filePath) - done - fi - - file_exist=$(find /var/lib/docker/containers -name "*.log" 2>1 | wc -l) - if [ $file_exist -gt 0 ]; then - target_log_files+=("/var/lib/docker/containers/*/*.log") - fi - - if [[ "$NR_CLI_SKIP_LOGS" == "true" ]] ; then - target_log_files=() - target_discovered_log_files=() - fi - - target_log_files+=({{.NEW_RELIC_CLI_LOG_FILE_PATH}}) - - echo "logs:" | tee /etc/newrelic-infra/logging.d/logging.yml > /dev/null - for log_file in "${target_log_files[@]}" - do - if [ "$log_file" == "/var/lib/docker/containers/*/*.log" ]; then - echo -e " - name: containers\n file: /var/lib/docker/containers/*/*.log" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null - else - NAME=$(basename $log_file) - echo -e " - name: $NAME" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null - echo -e " file: $log_file" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null - if [[ "$NAME" == "newrelic-cli.log" ]]; then - echo -e " attributes:\n newrelic-cli: true" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null - echo -e " logtype: newrelic-cli" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null - fi - if [[ "$NAME" == "alternatives.log" ]]; then - echo -e " attributes:\n logtype: linux_alternatives" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null - fi - if [[ "$NAME" == "cloud-init.log" ]]; then - echo -e " attributes:\n logtype: linux_cloud-init" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null - fi - if [[ "$NAME" == "auth.log" ]]; then - echo -e " attributes:\n logtype: linux_auth" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null - fi - if [[ "$NAME" == "dpkg.log" ]]; then - echo -e " attributes:\n logtype: linux_dpkg" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null - fi - if [[ "$NAME" == "syslog" ]]; then - echo -e " attributes:\n logtype: linux_syslog" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null - fi - if [[ "$NAME" == "messages" ]]; then - echo -e " attributes:\n logtype: linux_messages" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null - fi - if [[ "$NAME" == "secure" ]]; then - echo -e " attributes:\n logtype: linux_secure" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null - fi - if [[ "$NAME" == "yum.log" ]]; then - echo -e " attributes:\n logtype: linux_yum" | tee -a /etc/newrelic-infra/logging.d/logging.yml > /dev/null - fi - fi - done - - if [ ${#target_discovered_log_files[@]} -gt 0 ]; then - echo "logs:" | tee /etc/newrelic-infra/logging.d/discovered.yml > /dev/null - - # index is incremented to facilitate dynamic name values for each discovered log file path - index=0 - for filePath in $(echo -n $discoveredLogFiles | sed "s/,/ /g"); do - - echo -e " - name: configured-logs-$index" | tee -a /etc/newrelic-infra/logging.d/discovered.yml > /dev/null - echo -e " file: $filePath" | tee -a /etc/newrelic-infra/logging.d/discovered.yml > /dev/null - - if [[ $filePath == *"nginx/error"* ]]; then - echo -e " attributes:\n logtype: nginx-error" | tee -a /etc/newrelic-infra/logging.d/discovered.yml > /dev/null - fi - if [[ $filePath == *"nginx/access"* ]]; then - echo -e " attributes:\n logtype: nginx" | tee -a /etc/newrelic-infra/logging.d/discovered.yml > /dev/null - fi - - if [[ $filePath == *"mysql/error"* ]]; then - echo -e " attributes:\n logtype: mysql-error" | tee -a /etc/newrelic-infra/logging.d/discovered.yml > /dev/null - fi - - index=$((index+1)) - done - fi - fi - - logEvent: - cmds: - # Wait to give the services time to get going with the new configuration and plugin startup - - | - sleep 10 - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_HOST_MONITORING_SOURCE}}" != "otel" ]; then - echo "Log configuration:" | tee -a {{.NEW_RELIC_CLI_LOG_FILE_PATH}} > /dev/null - cat /etc/newrelic-infra/logging.d/logging.yml | tee -a {{.NEW_RELIC_CLI_LOG_FILE_PATH}} > /dev/null - echo "Log installation completed" | tee -a {{.NEW_RELIC_CLI_LOG_FILE_PATH}} > /dev/null - fi - -postInstall: - info: |2 - ⚙️ If NEW_RELIC_SUPER_AGENT_HOST_MONITORING_SOURCE was set to 'newrelic': - ⚙️ The Logs configuration file (base configuration) can be found in /etc/newrelic-infra/logging.d/logging.yml - ⚙️ The Logs configuration file for discovered processes can be found in /etc/newrelic-infra/logging.d/discovered.yml - Edit these files to make changes or configure advanced features for the Logs integration. See the docs for options: - https://docs.newrelic.com/docs/logs/enable-log-management-new-relic/enable-log-monitoring-new-relic/forward-your-logs-using-infrastructure-agent#parameters diff --git a/recipes/newrelic/infrastructure/super-agent/rhel.yml b/recipes/newrelic/infrastructure/super-agent/rhel.yml deleted file mode 100644 index ffbf9be6..00000000 --- a/recipes/newrelic/infrastructure/super-agent/rhel.yml +++ /dev/null @@ -1,673 +0,0 @@ -# Visit our schema definition for additional information on this file format. -# https://github.com/newrelic/open-install-library/blob/main/docs/recipe-spec/recipe-spec.md#schema-definition - -name: super-agent -displayName: Agent Control -description: New Relic install recipe for Agent Control -repository: https://github.com/newrelic/newrelic-super-agent - -installTargets: - - type: host - os: linux - platform: amazon - - type: host - os: linux - platform: amazon - platformVersion: "2" - - type: host - os: linux - platform: amazon - platformVersion: "2023" - - type: host - os: linux - platform: centos - platformVersion: "(7|8|9)\\.*" - - type: host - os: linux - platform: oracle - platformVersion: "(7|8|9)\\.*" - - type: host - os: linux - platform: redhat - platformVersion: "(7|8|9)\\.*" - -keywords: - - SuperAgent - - OpenTelemetry - - OTel - - Infrastructure - - Agent - - Linux - - CentOS 7 - - CentOS 8 - - RHEL 7 - - RHEL 8 - - RHEL 9 - - Amazon Linux - - Amazon Linux AMI - - Amazon Linux 2 - - Amazon Linux 2023 - -processMatch: [] - -preInstall: - requireAtDiscovery: | - IS_DOCKER_CONTAINER_CGROUP=$(grep 'docker\|lxc' /proc/1/cgroup | wc -l) - if [ $IS_DOCKER_CONTAINER_CGROUP -gt 0 ] ; then - echo "docker detected with cgroup, unsupported" >&2 - exit 131 - fi - IS_DOCKER_CONTAINER_ENVIRON=$(grep container=lxc /proc/1/environ | wc -l) - if [ $IS_DOCKER_CONTAINER_ENVIRON -gt 0 ] ; then - echo "docker detected with environ, unsupported" >&2 - exit 131 - fi - if [ -f /.dockerenv ] ; then - echo "docker detected with .dockerenv, unsupported" >&2 - exit 131 - fi - IS_WSL_CONTAINER=$(grep -i 'Microsoft' /proc/version | wc -l) - if [ $IS_WSL_CONTAINER -gt 0 ] ; then - echo "microsoft Windows Subsystem for Linux for infra detected, unsupported" >&2 - exit 131 - fi - exit 0 - - discoveryMode: - - targeted - -install: - version: "3" - silent: true - - vars: - AMAZON_LINUX_VERSION: - sh: awk -F= '/VERSION_ID/ {print $2}' /etc/os-release - REPO_DIR: - sh: if [ {{.AMAZON_LINUX_VERSION}} = "2" ] || [ {{.AMAZON_LINUX_VERSION}} = "2023" ]; then echo "amazonlinux"; else echo "el"; fi - ARCH: - sh: uname -m - IS_SYSTEMCTL: - sh: command -v systemctl | wc -l - IS_INITCTL: - sh: command -v initctl | wc -l - - tasks: - default: - cmds: - - task: write_recipe_metadata - - task: detect_previous_install - - task: assert_pre_req - - task: cleanup - - task: setup_infra_license - - task: setup_infra_proxy - - task: install_super_agent - - task: update_otel_license_key - - task: config_supervisors - - task: config_fleet_id - - task: config_fleet_control - - task: config_super_agent_auth - - task: config_host_monitoring - - task: update_otel_mem_limit - - task: update_otel_end_point - - task: migrate_newrelic_infra_config - - task: restart_super_agent - - task: assert_super_agent_status_ok - - task: signal_recipe_applied - - task: post_install - - write_recipe_metadata: - cmds: - - | - echo '{"Metadata":{"CapturedCliOutput":"true"}}' | tee {{.NR_CLI_OUTPUT}} > /dev/null - - detect_previous_install: - cmds: - - | - if [ -f /etc/newrelic-super-agent/.nr-cli ] ; then - echo "A previous execution of this installation was detected. Some installation tasks will be skipped." - echo "If you would like to run all the tasks, please remove the /etc/newrelic-super-agent/.nr-cli file and re-run the installation." - fi - - assert_pre_req: - cmds: - - | - IS_ROOT_OR_SUDO=$([ ! -z "$SUDO_USER" ] || [ $(whoami) = "root" ] && echo "true" || echo "false") # Assert root or sudo user - if [ "$IS_ROOT_OR_SUDO" = "false" ]; then - echo "This newrelic install must be run under sudo or root" >&2 - exit 3 - fi - - | - IS_GREP_INSTALLED=$(which grep | wc -l) - if [ $IS_GREP_INSTALLED -eq 0 ] ; then - echo "grep is required to run the newrelic install. Please install grep and re-run the installation." >&2 - exit 10 - fi - - | - IS_SED_INSTALLED=$(which sed | wc -l) - if [ $IS_SED_INSTALLED -eq 0 ] ; then - echo "sed is required to run the newrelic install. Please install sed and re-run the installation." >&2 - exit 11 - fi - - | - IS_AWK_INSTALLED=$(which awk | wc -l) - if [ $IS_AWK_INSTALLED -eq 0 ] ; then - echo "awk is required to run the newrelic install. Please install awk and re-run the installation." >&2 - exit 12 - fi - - | - IS_CAT_INSTALLED=$(which cat | wc -l) - if [ $IS_CAT_INSTALLED -eq 0 ] ; then - echo "cat is required to run the newrelic install. Please install cat and re-run the installation." >&2 - exit 13 - fi - - | - IS_TEE_INSTALLED=$(which tee | wc -l) - if [ $IS_TEE_INSTALLED -eq 0 ] ; then - echo "tee is required to run the newrelic install. Please install tee and re-run the installation." >&2 - exit 14 - fi - - | - IS_TOUCH_INSTALLED=$(which touch | wc -l) - if [ $IS_TOUCH_INSTALLED -eq 0 ] ; then - echo "touch is required to run the newrelic install. Please install touch and re-run the installation." >&2 - exit 15 - fi - - | - IS_CURL_INSTALLED=$(which curl | wc -l) - if [ $IS_CURL_INSTALLED -eq 0 ] ; then - echo "curl is required to run the newrelic install. Please install curl and re-run the installation." >&2 - exit 16 - fi - - | - IS_OPENSSL_INSTALLED=$(which openssl | wc -l) - if [ $IS_OPENSSL_INSTALLED -eq 0 ] ; then - echo "openssl is required to run the newrelic install. Please install openssl and re-run the installation." >&2 - exit 17 - fi - - | - IS_MKTEMP_INSTALLED=$(which mktemp | wc -l) - if [ $IS_MKTEMP_INSTALLED -eq 0 ] ; then - echo "mktemp is required to run the newrelic install. Please install coreutils and re-run the installation." >&2 - exit 18 - fi - - | - if [ "{{.AMAZON_LINUX_VERSION}}" != "2" ] && [ "{{.AMAZON_LINUX_VERSION}}" != "2023" ] ; then - REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/yum/{{.REPO_DIR}}/{{.DISTRO_VERSION}}/{{.ARCH}}/newrelic-infra.repo") - else - REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/yum/{{.REPO_DIR}}/{{.AMAZON_LINUX_VERSION}}/{{.ARCH}}/newrelic-infra.repo") - fi - IS_NEWRELIC_AVAILABLE=$(curl -Ls $REPO_URL | grep "\[newrelic-infra\]" | wc -l) - if [ $IS_NEWRELIC_AVAILABLE -eq 0 ] ; then - echo "there is no New Relic Agent Control available for the distribution '{{.DISTRO_VERSION}}'." >&2 - exit 21 - fi - vars: - DISTRO_VERSION: - sh: | - rpm -E %{rhel} - - cleanup: - # skipping this task if .nr-cli exists - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then - rm -rf /var/db/newrelic-infra/data 2>/dev/null - fi - - setup_infra_license: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then - if [ -f /etc/newrelic-infra.yml ]; then - printf "\nAn existing newrelic-infra configuration file was detected. Updating where needed." - - sed -i "/^staging/d" /etc/newrelic-infra.yml - sed -i "/^enable_process_metrics/d" /etc/newrelic-infra.yml - sed -i "/^status_server_enabled/d" /etc/newrelic-infra.yml - sed -i "/^status_server_port/d" /etc/newrelic-infra.yml - sed -i "/^license_key/d" /etc/newrelic-infra.yml - sed -i '/^custom_attributes:/,/^\S/{ /^\S/!d }' /etc/newrelic-infra.yml - sed -i '/^custom_attributes:/d' /etc/newrelic-infra.yml - sed -i "/^is_integrations_only/d" /etc/newrelic-infra.yml - - if [ "{{.NR_SA_MIGRATE_INFRA_CONFIG}}" == "true" ] || [ "{{.NEW_RELIC_ASSUME_YES}}" == "true" ] ; then - touch /etc/newrelic-infra-do-migrate - else - printf "\nWould you like to migrate this newrelic-infra config to use it with New Relic Agent Control? (y/N): " - read -r MIGRATE_NEWRELIC_INFRA_CONFIG - MIGRATE_NEWRELIC_INFRA_CONFIG=${MIGRATE_NEWRELIC_INFRA_CONFIG:-N} - - if [ "$MIGRATE_NEWRELIC_INFRA_CONFIG" == "y" ] ; then - touch /etc/newrelic-infra-do-migrate - fi - fi - else - touch /etc/newrelic-infra.yml - # If we are creating a new file, perform the migration as well - touch /etc/newrelic-infra-do-migrate - fi - fi - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then - if [ $(echo {{.NEW_RELIC_REGION}} | grep -i staging | wc -l) -gt 0 ]; then - echo 'staging: true' >> /etc/newrelic-infra.yml - fi - - 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 '{{.NRIA_CUSTOM_ATTRIBUTES}}' >> /etc/newrelic-infra.yml - fi - - setup_infra_proxy: - cmds: - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] && [ ! -z "$HTTPS_PROXY" ]; then - sed -i "/^proxy/d" /etc/newrelic-infra.yml - echo 'proxy: {{.HTTPS_PROXY}}' >> /etc/newrelic-infra.yml - - if ! grep -q '^proxy=' /etc/dnf/dnf.conf; then - echo "************************************************************" - echo "WARNING: proxy settings not detected in your dnf config" - echo "If installation fails with a timeout, add the following line to /etc/dnf/dnf.conf and retry:" - echo "proxy={{.HTTPS_PROXY}}" - echo "************************************************************" - fi - fi - - install_super_agent: - cmds: - - | - if [ "{{.AMAZON_LINUX_VERSION}}" != "2" ] && [ "{{.AMAZON_LINUX_VERSION}}" != "2023" ] ; then - SUPER_AGENT_REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/yum/{{.REPO_DIR}}/{{.DISTRO_VERSION}}/{{.ARCH}}/newrelic-infra.repo") - INFRA_REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/linux/yum/{{.REPO_DIR}}/{{.DISTRO_VERSION}}/{{.ARCH}}/newrelic-infra.repo") - else - SUPER_AGENT_REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/yum/{{.REPO_DIR}}/{{.AMAZON_LINUX_VERSION}}/{{.ARCH}}/newrelic-infra.repo") - INFRA_REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/linux/yum/{{.REPO_DIR}}/{{.AMAZON_LINUX_VERSION}}/{{.ARCH}}/newrelic-infra.repo") - fi - IS_NEWRELIC_AVAILABLE=$(curl -Ls $SUPER_AGENT_REPO_URL | grep "\[newrelic-infra\]" | wc -l) - if [ $IS_NEWRELIC_AVAILABLE -eq 0 ] ; then - echo "New Relic Agent Control is not available for this architecture {{.ARCH}}. See our documentation for installing manually https://docs.newrelic.com/docs/using-new-relic/cross-product-functions/install-configure/install-new-relic" >&2 - exit 131 - fi - - curl -s $INFRA_REPO_URL -o /etc/yum.repos.d/newrelic-infra.repo - curl -s $SUPER_AGENT_REPO_URL | sed 's/\[newrelic-infra]/\n[newrelic-super-agent]/g' >> /etc/yum.repos.d/newrelic-infra.repo - - yum -y -q makecache --disablerepo='*' --enablerepo='newrelic-infra' --enablerepo='newrelic-super-agent' - yum -y -q install newrelic-super-agent - - if [ "{{.AMAZON_LINUX_VERSION}}" == "2" ] || [ "{{.AMAZON_LINUX_VERSION}}" == "2023" ] ; then - yum -y -q install fluent-bit - fi - vars: - DISTRO_VERSION: - sh: | - rpm -E %{rhel} - silent: true - - # If configured to do so, migrate the newrelic-infra configuration for usage with New Relic Agent Control - migrate_newrelic_infra_config: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ -f /etc/newrelic-infra-do-migrate ]; then - rm /etc/newrelic-infra-do-migrate - newrelic-config-migrate - fi - - update_otel_license_key: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - 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: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - 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: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then - if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then - sed -i "s/endpoint: .*$/endpoint: https:\/\/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: https:\/\/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: https:\/\/otlp.nr-data.net:4317/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml - fi - fi - - config_supervisors: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ]; then - cp /etc/newrelic-super-agent/examples/super-agent-config-no-agents.yaml /etc/newrelic-super-agent/config.yaml - elif [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ]; then - cp /etc/newrelic-super-agent/examples/super-agent-config-nr-otel-collector.yaml /etc/newrelic-super-agent/config.yaml - elif [ "{{.NR_CLI_NRDOT}}" = "false" ]; then - cp /etc/newrelic-super-agent/examples/super-agent-config-nr-infra-agent.yaml /etc/newrelic-super-agent/config.yaml - else - cp /etc/newrelic-super-agent/examples/super-agent-config-all-agents.yaml /etc/newrelic-super-agent/config.yaml - fi - - config_fleet_id: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ ! -z "{{.NR_CLI_FLEET_ID}}" ] ; then - sed -i 's/^#\s*fleet_id:/fleet_id:/g' /etc/newrelic-super-agent/config.yaml - sed -i 's/fleet_id: FLEET_ID_HERE/fleet_id: {{.NR_CLI_FLEET_ID}}/g' /etc/newrelic-super-agent/config.yaml - fi - - config_fleet_control: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" = "false" ]; then - sed -i '/^\s*fleet_control:/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*endpoint: https:\/\/opamp/s/^/#/' /etc/newrelic-super-agent/config.yaml - else - sed -i 's/s*#\s*fleet_control:/fleet_control:/g' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*endpoint: https:\/\/opamp/s/# //' /etc/newrelic-super-agent/config.yaml - fi - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" = "false" ]; then - 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*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_SUPER_AGENT_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 - - | - 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 - - config_super_agent_auth: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" != "false" ] && [ "{{ .NEW_RELIC_ORGANIZATION }}" != "" ]; then - sed -i '/^\s*#\s*auth_config:\s*$/s/# //' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*token_url: PLACEHOLDER/s/# //' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*client_id: PLACEHOLDER/s/# //' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*provider: PLACEHOLDER/s/# //' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*private_key_path: PLACEHOLDER/s/# //' /etc/newrelic-super-agent/config.yaml - else - sed -i '/^\s*auth_config:/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*token_url: PLACEHOLDER/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*client_id: PLACEHOLDER/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*provider: PLACEHOLDER/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*private_key_path: PLACEHOLDER/s/^/#/' /etc/newrelic-super-agent/config.yaml - fi - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" != "false" ] && [ "{{ .NEW_RELIC_ORGANIZATION }}" != "" ]; then - set -uo pipefail - - mkdir -p /etc/newrelic-super-agent/keys - chown root:root /etc/newrelic-super-agent/keys - chmod 700 /etc/newrelic-super-agent/keys - - TEMPORAL_FOLDER=$(mktemp -d newrelic-super-agent.XXXXXXXXXX) - chown root:root "${TEMPORAL_FOLDER}" - chmod 700 "${TEMPORAL_FOLDER}" - trap "rm -rf $TEMPORAL_FOLDER" EXIT - openssl genrsa -out "$TEMPORAL_FOLDER/key" 4096 - openssl rsa -in "$TEMPORAL_FOLDER/key" -pubout -out "$TEMPORAL_FOLDER/pub" - - if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then - REGISTRATION_ENDPOINT=https://staging-api.newrelic.com/graphql - TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.staging-service.newrelic.com/oauth2/token - IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.staging-service.nr-ops.net/system-identity/graphql - elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then - REGISTRATION_ENDPOINT=https://api.eu.newrelic.com/graphql - TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.service.newrelic.com/oauth2/token - IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.service.eu.nr-ops.net/system-identity/graphql - else - REGISTRATION_ENDPOINT=https://api.newrelic.com/graphql - TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.service.newrelic.com/oauth2/token - IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.service.nr-ops.net/system-identity/graphql - fi - - ############################################################ - # Get the L1 Access Token - ############################################################ - if [ "{{.NEW_RELIC_AUTH_CLIENT_ID}}" != "" ] && [ "{{.NEW_RELIC_AUTH_CLIENT_SECRET}}" != "" ]; then - RESPONSE_FILE=$TEMPORAL_FOLDER/response_token.json - for RETRY in 1 2 3; do - HTTP_CODE=$(echo '{"client_id": "{{.NEW_RELIC_AUTH_CLIENT_ID}}", "client_secret": "{{.NEW_RELIC_AUTH_CLIENT_SECRET}}", "grant_type": "client_credentials"}' | tr -d $'\n' | curl \ - -s -w "%{http_code}" \ - -H "Content-Type: application/json" \ - -o "$RESPONSE_FILE" \ - --data-binary @- \ - "$TOKEN_RENEWAL_ENDPOINT" - ) - - if [ $HTTP_CODE -eq 200 ]; then - break - fi - - ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.error_description // "invalid_request"' < "$TEMPORAL_FOLDER/response_token.json" | tr -d '"') - - echo "Error getting system identity auth token. The API endpoint returned $HTTP_CODE: $ERROR_MESSAGE. Retrying ($RETRY/3)..." - sleep 2 - done - - if [ $HTTP_CODE -ne 200 ]; then - echo "Error getting system identity auth token" - exit 99 - fi - - ACCESS_TOKEN=$(/usr/local/bin/newrelic utils jq '.access_token' < "$RESPONSE_FILE" | tr -d '"' ) - - ############################################################ - # Create System Identity - ############################################################ - DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") - NAME="System Identity for $(hostname) - $DATE" - - for RETRY in 1 2 3; do - HTTP_CODE=$(echo '{ "query": - "mutation { - create( - name: \"'$NAME'\", - organizationId: \"{{ .NEW_RELIC_ORGANIZATION }}\", - publicKey: \"'$(openssl enc -base64 -A -in "$TEMPORAL_FOLDER/pub")'\" - ) { - clientId, - name - } - }" - }' | tr -d $'\n' | curl \ - -s -w "%{http_code}" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $ACCESS_TOKEN" \ - -o "$TEMPORAL_FOLDER/response.json" \ - --data-binary @- \ - "$IDENTITY_CREATION_ENDPOINT" - ) - - if [ $HTTP_CODE -eq 200 ]; then - break - fi - - echo "Error creating L2 system identity. The API endpoint returned $HTTP_CODE. Retrying ($RETRY/3)..." - sleep 2 - done - - if [ $HTTP_CODE -ne 200 ]; then - exit 99 - fi - - ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.errors[0].message // "NOERROR"' < "$TEMPORAL_FOLDER/response.json" | tr -d '"') - if [ "$ERROR_MESSAGE" != "NOERROR" ]; then - echo "Failed to create a New Relic System Identity for Fleet Control communication authentication. Please verify that your User Key is valid and that your Account Organization has the necessary permissions to create a System Identity: $ERROR_MESSAGE" - exit 100 - fi - - CLIENT_ID=$(/usr/local/bin/newrelic utils jq '.data.create.clientId' < "$TEMPORAL_FOLDER/response.json" | tr -d '"' ) - else - ############################################################ - # Create System Identity (Legacy) - ############################################################ - DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") - NAME="System Identity for $(hostname) - $DATE" - - for RETRY in 1 2 3; do - HTTP_CODE=$(echo '{ "query": - "mutation { - systemIdentityCreate( - name: \"'$NAME'\", - organizationId: \"{{ .NEW_RELIC_ORGANIZATION }}\", - publicKey: \"'$(openssl enc -base64 -A -in "$TEMPORAL_FOLDER/pub")'\" - ) { - clientId, - name - } - }" - }' | tr -d $'\n' | curl \ - -s -w "%{http_code}" \ - -H "Content-Type: application/json" \ - -H "API-Key: {{ .NEW_RELIC_API_KEY }}" \ - -o "$TEMPORAL_FOLDER/response.json" \ - --data-binary @- \ - "$REGISTRATION_ENDPOINT" - ) - - if [ $HTTP_CODE -eq 200 ]; then - break - fi - - echo "Error creating the new system identity. The API endpoint returned $HTTP_CODE. Retrying ($RETRY/3)..." - sleep 2 - done - - if [ $HTTP_CODE -ne 200 ]; then - exit 99 - fi - - ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.errors[0].message // "NOERROR"' < "$TEMPORAL_FOLDER/response.json" | tr -d '"') - if [ "$ERROR_MESSAGE" != "NOERROR" ]; then - echo "Failed to create a New Relic System Identity for Fleet Control communication authentication. Please verify that your User Key is valid and that your Account Organization has the necessary permissions to create a System Identity: $ERROR_MESSAGE" - exit 100 - fi - - CLIENT_ID=$(/usr/local/bin/newrelic utils jq '.data.systemIdentityCreate.clientId' < "$TEMPORAL_FOLDER/response.json" | tr -d '"' ) - fi - - mv "$TEMPORAL_FOLDER/key" "/etc/newrelic-super-agent/keys/$CLIENT_ID.key" - sed -i 's~token_url: PLACEHOLDER~token_url: '"$TOKEN_RENEWAL_ENDPOINT"'~g' /etc/newrelic-super-agent/config.yaml - sed -i 's/client_id: PLACEHOLDER/client_id: '"$CLIENT_ID"'/g' /etc/newrelic-super-agent/config.yaml - sed -i 's/provider: PLACEHOLDER/provider: local/g' /etc/newrelic-super-agent/config.yaml - sed -i 's~private_key_path: PLACEHOLDER~private_key_path: '"/etc/newrelic-super-agent/keys/$CLIENT_ID.key"'~g' /etc/newrelic-super-agent/config.yaml - fi - - config_host_monitoring: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_HOST_MONITORING_SOURCE}}" = "otel" ]; then - echo 'is_integrations_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.yaml /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml - else - 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.yaml /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml - fi - fi - - restart_super_agent: - cmds: - - | - if [ {{.IS_SYSTEMCTL}} -gt 0 ]; then - systemctl restart newrelic-super-agent - else - if [ {{.IS_INITCTL}} -gt 0 ]; then - initctl restart newrelic-super-agent - else - /etc/init.d/newrelic-super-agent restart - fi - fi - - assert_super_agent_status_ok: - cmds: - - | - MAX_RETRIES=150 - TRIES=0 - echo "Running agent status check attempt..." - # wait for status endpoint to be ready - while [ $TRIES -lt $MAX_RETRIES ]; do - ((TRIES++)) - statusCheckOutput=$(curl -s http://localhost:51200/status) - if [ -z "$statusCheckOutput" ]; then - # so jq doesn't fail if empty - statusCheckOutput="{}" - fi - STATUS=$(echo $statusCheckOutput | /usr/local/bin/newrelic utils jq '.super_agent.healthy') - if [ "$STATUS" == "true" ]; then - echo "Agent status check ok." - break - else - if [ "$TRIES" -eq "$MAX_RETRIES" ]; then - # Process-based validation attempt - IS_AGENT_INSTALLED=$(ps aux | grep newrelic-super-agent | grep -v grep | wc -l) - if [ $IS_AGENT_INSTALLED -gt 0 ] ; then - echo "detected newrelic-super-agent process running" - exit 0 - fi - - 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 - - if [ {{.IS_SYSTEMCTL}} -gt 0 ]; then - journalctl -u newrelic-super-agent --no-pager - fi - - exit 31 - fi - fi - - sleep 2 - done - - signal_recipe_applied: - cmds: - - | - touch /etc/newrelic-super-agent/.nr-cli - - post_install: - info: |2 - ⚙️ New Relic Agent Control configuration file can be found in /etc/newrelic-super-agent/config.yaml diff --git a/recipes/newrelic/infrastructure/super-agent/suse.yml b/recipes/newrelic/infrastructure/super-agent/suse.yml deleted file mode 100644 index 43451a9b..00000000 --- a/recipes/newrelic/infrastructure/super-agent/suse.yml +++ /dev/null @@ -1,620 +0,0 @@ -# Visit our schema definition for additional information on this file format. -# https://github.com/newrelic/open-install-library/blob/main/docs/recipe-spec/recipe-spec.md#schema-definition - -name: super-agent -displayName: Agent Control -description: New Relic install recipe for Agent Control -repository: https://github.com/newrelic/newrelic-super-agent - -installTargets: - - type: host - os: linux - platformFamily: suse - platformVersion: "(12|15)\\.*" - -keywords: - - SuperAgent - - OpenTelemetry - - OTel - - Infrastructure - - Agent - - Linux - - Suse - - SLES - -processMatch: [] - -preInstall: - requireAtDiscovery: | - IS_DOCKER_CONTAINER_CGROUP=$(grep 'docker\|lxc' /proc/1/cgroup | wc -l) - if [ $IS_DOCKER_CONTAINER_CGROUP -gt 0 ] ; then - echo "docker detected with cgroup, unsupported" >&2 - exit 131 - fi - IS_DOCKER_CONTAINER_ENVIRON=$(grep container=lxc /proc/1/environ | wc -l) - if [ $IS_DOCKER_CONTAINER_ENVIRON -gt 0 ] ; then - echo "docker detected with environ, unsupported" >&2 - exit 131 - fi - if [ -f /.dockerenv ] ; then - echo "docker detected with .dockerenv, unsupported" >&2 - exit 131 - fi - IS_WSL_CONTAINER=$(grep -i 'Microsoft' /proc/version | wc -l) - if [ $IS_WSL_CONTAINER -gt 0 ] ; then - echo "microsoft Windows Subsystem for Linux for infra detected, unsupported" >&2 - exit 131 - fi - exit 0 - - discoveryMode: - - targeted - -install: - version: "3" - silent: true - vars: - IS_SYSTEMCTL: - sh: command -v systemctl | wc -l - IS_INITCTL: - sh: command -v initctl | wc -l - tasks: - default: - cmds: - - task: write_recipe_metadata - - task: detect_previous_install - - task: assert_pre_req - - task: cleanup - - task: setup_infra_license - - task: setup_infra_proxy - - task: install_super_agent - - task: update_otel_license_key - - task: config_supervisors - - task: config_fleet_id - - task: config_fleet_control - - task: config_super_agent_auth - - task: config_host_monitoring - - task: update_otel_mem_limit - - task: update_otel_end_point - - task: migrate_newrelic_infra_config - - task: restart_super_agent - - task: assert_super_agent_status_ok - - task: signal_recipe_applied - - task: post_install - - write_recipe_metadata: - cmds: - - | - echo '{"Metadata":{"CapturedCliOutput":"true"}}' | tee {{.NR_CLI_OUTPUT}} > /dev/null - - detect_previous_install: - cmds: - - | - if [ -f /etc/newrelic-super-agent/.nr-cli ] ; then - echo "A previous execution of this installation was detected. Some installation tasks will be skipped." - echo "If you would like to run all the tasks, please remove the /etc/newrelic-super-agent/.nr-cli file and re-run the installation." - fi - - assert_pre_req: - cmds: - - | - IS_ROOT_OR_SUDO=$([ ! -z "$SUDO_USER" ] || [ $(whoami) = "root" ] && echo "true" || echo "false") # Assert root or sudo user - if [ "$IS_ROOT_OR_SUDO" = "false" ]; then - echo "This newrelic install must be run under sudo or root" >&2 - exit 3 - fi - - | - IS_GREP_INSTALLED=$(which grep | wc -l) - if [ $IS_GREP_INSTALLED -eq 0 ] ; then - echo "grep is required to run the newrelic install. Please install grep and re-run the installation." >&2 - exit 10 - fi - - | - IS_SED_INSTALLED=$(which sed | wc -l) - if [ $IS_SED_INSTALLED -eq 0 ] ; then - echo "sed is required to run the newrelic install. Please install sed and re-run the installation." >&2 - exit 11 - fi - - | - IS_AWK_INSTALLED=$(which awk | wc -l) - if [ $IS_AWK_INSTALLED -eq 0 ] ; then - echo "awk is required to run the newrelic install. Please install awk and re-run the installation." >&2 - exit 12 - fi - - | - IS_CAT_INSTALLED=$(which cat | wc -l) - if [ $IS_CAT_INSTALLED -eq 0 ] ; then - echo "cat is required to run the newrelic install. Please install cat and re-run the installation." >&2 - exit 13 - fi - - | - IS_TEE_INSTALLED=$(which tee | wc -l) - if [ $IS_TEE_INSTALLED -eq 0 ] ; then - echo "tee is required to run the newrelic install. Please install tee and re-run the installation." >&2 - exit 14 - fi - - | - IS_TOUCH_INSTALLED=$(which touch | wc -l) - if [ $IS_TOUCH_INSTALLED -eq 0 ] ; then - echo "touch is required to run the newrelic install. Please install touch and re-run the installation." >&2 - exit 15 - fi - - | - IS_CURL_INSTALLED=$(which curl | wc -l) - if [ $IS_CURL_INSTALLED -eq 0 ] ; then - echo "curl is required to run the newrelic install. Please install curl and re-run the installation." >&2 - exit 16 - fi - - | - IS_OPENSSL_INSTALLED=$(which openssl | wc -l) - if [ $IS_OPENSSL_INSTALLED -eq 0 ] ; then - echo "openssl is required to run the newrelic install. Please install openssl and re-run the installation." >&2 - exit 17 - fi - - | - IS_MKTEMP_INSTALLED=$(which mktemp | wc -l) - if [ $IS_MKTEMP_INSTALLED -eq 0 ] ; then - echo "mktemp is required to run the newrelic install. Please install coreutils and re-run the installation." >&2 - exit 18 - fi - - | - IS_INFRA_AVAILABLE=$(curl -Is {{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/zypp/sles/{{.SLES_VERSION}}/x86_64/newrelic-infra.repo | grep " 2[0-9][0-9] " | wc -l) - if [ $IS_INFRA_AVAILABLE -eq 0 ] ; then - echo "there is no New Relic Agent Control available for the distribution '{{.SLES_VERSION}}'." >&2 - exit 131 - fi - vars: - SLES_VERSION: - sh: awk -F= '/VERSION_ID/ {print $2}' /etc/os-release - - cleanup: - # skipping this task if .nr-cli exists - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - rm -rf /var/db/newrelic-infra/data 2>/dev/null - - setup_infra_license: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then - if [ -f /etc/newrelic-infra.yml ]; then - printf "\nAn existing newrelic-infra configuration file was detected. Updating where needed." - - sed -i "/^staging/d" /etc/newrelic-infra.yml - sed -i "/^enable_process_metrics/d" /etc/newrelic-infra.yml - sed -i "/^status_server_enabled/d" /etc/newrelic-infra.yml - sed -i "/^status_server_port/d" /etc/newrelic-infra.yml - sed -i "/^license_key/d" /etc/newrelic-infra.yml - sed -i '/^custom_attributes:/,/^\S/{ /^\S/!d }' /etc/newrelic-infra.yml - sed -i '/^custom_attributes:/d' /etc/newrelic-infra.yml - sed -i "/^is_integrations_only/d" /etc/newrelic-infra.yml - - if [ "{{.NR_SA_MIGRATE_INFRA_CONFIG}}" == "true" ] || [ "{{.NEW_RELIC_ASSUME_YES}}" == "true" ] ; then - touch /etc/newrelic-infra-do-migrate - else - printf "\nWould you like to migrate this newrelic-infra config to use it with New Relic Agent Control? (y/N): " - read -r MIGRATE_NEWRELIC_INFRA_CONFIG - MIGRATE_NEWRELIC_INFRA_CONFIG=${MIGRATE_NEWRELIC_INFRA_CONFIG:-N} - - if [ "$MIGRATE_NEWRELIC_INFRA_CONFIG" == "y" ] ; then - touch /etc/newrelic-infra-do-migrate - fi - fi - else - touch /etc/newrelic-infra.yml - # If we are creating a new file, perform the migration as well - touch /etc/newrelic-infra-do-migrate - fi - fi - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] ; then - if [ $(echo {{.NEW_RELIC_REGION}} | grep -i staging | wc -l) -gt 0 ]; then - echo 'staging: true' >> /etc/newrelic-infra.yml - fi - - 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 '{{.NRIA_CUSTOM_ATTRIBUTES}}' >> /etc/newrelic-infra.yml - fi - - setup_infra_proxy: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" ] && [ ! -z "$HTTPS_PROXY" ]; then - sed -i "/^proxy/d" /etc/newrelic-infra.yml - echo 'proxy: {{.HTTPS_PROXY}}' >> /etc/newrelic-infra.yml - fi - - install_super_agent: - cmds: - - | - ARCH=$(uname -m) - SUPER_AGENT_REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/zypp/sles/{{.SLES_VERSION}}/$ARCH/newrelic-infra.repo") - IS_NEWRELIC_AVAILABLE=$(curl -Ls $SUPER_AGENT_REPO_URL | grep "\[newrelic-infra\]" | wc -l) - if [ $IS_NEWRELIC_AVAILABLE -eq 0 ] ; then - echo "New Relic Agent Control is not available for this architecture "$ARCH". See our documentation for installing manually https://docs.newrelic.com/docs/using-new-relic/cross-product-functions/install-configure/install-new-relic" >&2 - exit 131 - fi - INFRA_REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/linux/zypp/sles/{{.SLES_VERSION}}/$ARCH/newrelic-infra.repo") - - curl -s $INFRA_REPO_URL -o /etc/zypp/repos.d/newrelic-infra.repo - curl -s $SUPER_AGENT_REPO_URL | sed 's/\[newrelic-infra]/\n[newrelic-super-agent]/g' >> /etc/zypp/repos.d/newrelic-infra.repo - - - curl -s -L {{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/keys/newrelic_rpm_key_current.gpg > newrelic_rpm_key_current.gpg - - rpm --import newrelic_rpm_key_current.gpg - - zypper -n --quiet ref -r newrelic-infra - - zypper -n --quiet ref -r newrelic-super-agent - - zypper -n --quiet install newrelic-super-agent - - rm newrelic_rpm_key_current.gpg - vars: - SLES_VERSION: - sh: awk -F= '/VERSION_ID/ {print $2}' /etc/os-release - silent: true - - # If configured to do so, migrate the newrelic-infra configuration for usage with New Relic Agent Control - migrate_newrelic_infra_config: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ -f /etc/newrelic-infra-do-migrate ]; then - rm /etc/newrelic-infra-do-migrate - newrelic-config-migrate - fi - - update_otel_license_key: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - 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: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - 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: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NR_CLI_NRDOT}}" != "false" ]; then - if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then - sed -i "s/endpoint: .*$/endpoint: https:\/\/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: https:\/\/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: https:\/\/otlp.nr-data.net:4317/g" /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml - fi - fi - - config_supervisors: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ]; then - cp /etc/newrelic-super-agent/examples/super-agent-config-no-agents.yaml /etc/newrelic-super-agent/config.yaml - elif [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ]; then - cp /etc/newrelic-super-agent/examples/super-agent-config-nr-otel-collector.yaml /etc/newrelic-super-agent/config.yaml - elif [ "{{.NR_CLI_NRDOT}}" = "false" ]; then - cp /etc/newrelic-super-agent/examples/super-agent-config-nr-infra-agent.yaml /etc/newrelic-super-agent/config.yaml - else - cp /etc/newrelic-super-agent/examples/super-agent-config-all-agents.yaml /etc/newrelic-super-agent/config.yaml - fi - - config_fleet_id: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ ! -z "{{.NR_CLI_FLEET_ID}}" ] ; then - sed -i 's/^#\s*fleet_id:/fleet_id:/g' /etc/newrelic-super-agent/config.yaml - sed -i 's/fleet_id: FLEET_ID_HERE/fleet_id: {{.NR_CLI_FLEET_ID}}/g' /etc/newrelic-super-agent/config.yaml - fi - - config_fleet_control: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" = "false" ]; then - sed -i '/^\s*fleet_control:/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*endpoint: https:\/\/opamp/s/^/#/' /etc/newrelic-super-agent/config.yaml - else - sed -i 's/s*#\s*fleet_control:/fleet_control:/g' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*endpoint: https:\/\/opamp/s/# //' /etc/newrelic-super-agent/config.yaml - fi - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" = "false" ]; then - 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*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_SUPER_AGENT_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 - - | - 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 - - config_super_agent_auth: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" != "false" ] && [ "{{ .NEW_RELIC_ORGANIZATION }}" != "" ]; then - sed -i '/^\s*#\s*auth_config:\s*$/s/# //' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*token_url: PLACEHOLDER/s/# //' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*client_id: PLACEHOLDER/s/# //' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*provider: PLACEHOLDER/s/# //' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*private_key_path: PLACEHOLDER/s/# //' /etc/newrelic-super-agent/config.yaml - else - sed -i '/^\s*auth_config:/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*token_url: PLACEHOLDER/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*client_id: PLACEHOLDER/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*provider: PLACEHOLDER/s/^/#/' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*private_key_path: PLACEHOLDER/s/^/#/' /etc/newrelic-super-agent/config.yaml - fi - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_FLEET_ENABLED}}" != "false" ] && [ "{{ .NEW_RELIC_ORGANIZATION }}" != "" ]; then - set -uo pipefail - - mkdir -p /etc/newrelic-super-agent/keys - chown root:root /etc/newrelic-super-agent/keys - chmod 700 /etc/newrelic-super-agent/keys - - TEMPORAL_FOLDER=$(mktemp -d newrelic-super-agent.XXXXXXXXXX) - chown root:root "${TEMPORAL_FOLDER}" - chmod 700 "${TEMPORAL_FOLDER}" - trap "rm -rf $TEMPORAL_FOLDER" EXIT - openssl genrsa -out "$TEMPORAL_FOLDER/key" 4096 - openssl rsa -in "$TEMPORAL_FOLDER/key" -pubout -out "$TEMPORAL_FOLDER/pub" - - if [ "{{.NEW_RELIC_REGION}}" = "STAGING" ]; then - REGISTRATION_ENDPOINT=https://staging-api.newrelic.com/graphql - TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.staging-service.newrelic.com/oauth2/token - IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.staging-service.nr-ops.net/system-identity/graphql - elif [ "{{.NEW_RELIC_REGION}}" = "EU" ]; then - REGISTRATION_ENDPOINT=https://api.eu.newrelic.com/graphql - TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.service.newrelic.com/oauth2/token - IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.service.eu.nr-ops.net/system-identity/graphql - else - REGISTRATION_ENDPOINT=https://api.newrelic.com/graphql - TOKEN_RENEWAL_ENDPOINT=https://system-identity-oauth.service.newrelic.com/oauth2/token - IDENTITY_CREATION_ENDPOINT=https://ng-iam-service.service.nr-ops.net/system-identity/graphql - fi - - ############################################################ - # Get the L1 Access Token - ############################################################ - if [ "{{.NEW_RELIC_AUTH_CLIENT_ID}}" != "" ] && [ "{{.NEW_RELIC_AUTH_CLIENT_SECRET}}" != "" ]; then - RESPONSE_FILE=$TEMPORAL_FOLDER/response_token.json - for RETRY in 1 2 3; do - HTTP_CODE=$(echo '{"client_id": "{{.NEW_RELIC_AUTH_CLIENT_ID}}", "client_secret": "{{.NEW_RELIC_AUTH_CLIENT_SECRET}}", "grant_type": "client_credentials"}' | tr -d $'\n' | curl \ - -s -w "%{http_code}" \ - -H "Content-Type: application/json" \ - -o "$RESPONSE_FILE" \ - --data-binary @- \ - "$TOKEN_RENEWAL_ENDPOINT" - ) - - if [ $HTTP_CODE -eq 200 ]; then - break - fi - - ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.error_description // "invalid_request"' < "$TEMPORAL_FOLDER/response_token.json" | tr -d '"') - - echo "Error getting system identity auth token. The API endpoint returned $HTTP_CODE: $ERROR_MESSAGE. Retrying ($RETRY/3)..." - sleep 2 - done - - if [ $HTTP_CODE -ne 200 ]; then - echo "Error getting system identity auth token" - exit 99 - fi - - ACCESS_TOKEN=$(/usr/local/bin/newrelic utils jq '.access_token' < "$RESPONSE_FILE" | tr -d '"' ) - - ############################################################ - # Create System Identity - ############################################################ - DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") - NAME="System Identity for $(hostname) - $DATE" - - for RETRY in 1 2 3; do - HTTP_CODE=$(echo '{ "query": - "mutation { - create( - name: \"'$NAME'\", - organizationId: \"{{ .NEW_RELIC_ORGANIZATION }}\", - publicKey: \"'$(openssl enc -base64 -A -in "$TEMPORAL_FOLDER/pub")'\" - ) { - clientId, - name - } - }" - }' | tr -d $'\n' | curl \ - -s -w "%{http_code}" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $ACCESS_TOKEN" \ - -o "$TEMPORAL_FOLDER/response.json" \ - --data-binary @- \ - "$IDENTITY_CREATION_ENDPOINT" - ) - - if [ $HTTP_CODE -eq 200 ]; then - break - fi - - echo "Error creating L2 system identity. The API endpoint returned $HTTP_CODE. Retrying ($RETRY/3)..." - sleep 2 - done - - if [ $HTTP_CODE -ne 200 ]; then - exit 99 - fi - - ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.errors[0].message // "NOERROR"' < "$TEMPORAL_FOLDER/response.json" | tr -d '"') - if [ "$ERROR_MESSAGE" != "NOERROR" ]; then - echo "Failed to create a New Relic System Identity for Fleet Control communication authentication. Please verify that your User Key is valid and that your Account Organization has the necessary permissions to create a System Identity: $ERROR_MESSAGE" - exit 100 - fi - - CLIENT_ID=$(/usr/local/bin/newrelic utils jq '.data.create.clientId' < "$TEMPORAL_FOLDER/response.json" | tr -d '"' ) - else - ############################################################ - # Create System Identity (Legacy) - ############################################################ - DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") - NAME="System Identity for $(hostname) - $DATE" - - for RETRY in 1 2 3; do - HTTP_CODE=$(echo '{ "query": - "mutation { - systemIdentityCreate( - name: \"'$NAME'\", - organizationId: \"{{ .NEW_RELIC_ORGANIZATION }}\", - publicKey: \"'$(openssl enc -base64 -A -in "$TEMPORAL_FOLDER/pub")'\" - ) { - clientId, - name - } - }" - }' | tr -d $'\n' | curl \ - -s -w "%{http_code}" \ - -H "Content-Type: application/json" \ - -H "API-Key: {{ .NEW_RELIC_API_KEY }}" \ - -o "$TEMPORAL_FOLDER/response.json" \ - --data-binary @- \ - "$REGISTRATION_ENDPOINT" - ) - - if [ $HTTP_CODE -eq 200 ]; then - break - fi - - echo "Error creating the new system identity. The API endpoint returned $HTTP_CODE. Retrying ($RETRY/3)..." - sleep 2 - done - - if [ $HTTP_CODE -ne 200 ]; then - exit 99 - fi - - ERROR_MESSAGE=$(/usr/local/bin/newrelic utils jq '.errors[0].message // "NOERROR"' < "$TEMPORAL_FOLDER/response.json" | tr -d '"') - if [ "$ERROR_MESSAGE" != "NOERROR" ]; then - echo "Failed to create a New Relic System Identity for Fleet Control communication authentication. Please verify that your User Key is valid and that your Account Organization has the necessary permissions to create a System Identity: $ERROR_MESSAGE" - exit 100 - fi - - CLIENT_ID=$(/usr/local/bin/newrelic utils jq '.data.systemIdentityCreate.clientId' < "$TEMPORAL_FOLDER/response.json" | tr -d '"' ) - fi - - mv "$TEMPORAL_FOLDER/key" "/etc/newrelic-super-agent/keys/$CLIENT_ID.key" - sed -i 's~token_url: PLACEHOLDER~token_url: '"$TOKEN_RENEWAL_ENDPOINT"'~g' /etc/newrelic-super-agent/config.yaml - sed -i 's/client_id: PLACEHOLDER/client_id: '"$CLIENT_ID"'/g' /etc/newrelic-super-agent/config.yaml - sed -i 's/provider: PLACEHOLDER/provider: local/g' /etc/newrelic-super-agent/config.yaml - sed -i 's~private_key_path: PLACEHOLDER~private_key_path: '"/etc/newrelic-super-agent/keys/$CLIENT_ID.key"'~g' /etc/newrelic-super-agent/config.yaml - fi - - config_host_monitoring: - status: - - test -f /etc/newrelic-super-agent/.nr-cli - cmds: - - | - if [ "{{.NEW_RELIC_SUPER_AGENT_HOST_MONITORING_SOURCE}}" = "otel" ]; then - echo 'is_integrations_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.yaml /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml - else - 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.yaml /etc/newrelic-super-agent/fleet/agents.d/nr-otel-collector/values/values.yaml - fi - fi - - restart_super_agent: - cmds: - - | - if [ {{.IS_SYSTEMCTL}} -gt 0 ]; then - systemctl restart newrelic-super-agent - else - if [ {{.IS_INITCTL}} -gt 0 ]; then - initctl restart newrelic-super-agent - else - /etc/init.d/newrelic-super-agent restart - fi - fi - - assert_super_agent_status_ok: - cmds: - - | - MAX_RETRIES=150 - TRIES=0 - echo "Running agent status check attempt..." - # wait for status endpoint to be ready - while [ $TRIES -lt $MAX_RETRIES ]; do - ((TRIES++)) - statusCheckOutput=$(curl -s http://localhost:51200/status) - if [ -z "$statusCheckOutput" ]; then - # so jq doesn't fail if empty - statusCheckOutput="{}" - fi - STATUS=$(echo $statusCheckOutput | /usr/local/bin/newrelic utils jq '.super_agent.healthy') - if [ "$STATUS" == "true" ]; then - echo "Agent status check ok." - break - else - if [ "$TRIES" -eq "$MAX_RETRIES" ]; then - # Process-based validation attempt - IS_AGENT_INSTALLED=$(ps aux | grep newrelic-super-agent | grep -v grep | wc -l) - if [ $IS_AGENT_INSTALLED -gt 0 ] ; then - echo "detected newrelic-super-agent process running" - exit 0 - fi - - 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 - - if [ {{.IS_SYSTEMCTL}} -gt 0 ]; then - journalctl -u newrelic-super-agent --no-pager - fi - - exit 31 - fi - fi - - sleep 2 - done - - signal_recipe_applied: - cmds: - - | - touch /etc/newrelic-super-agent/.nr-cli - - post_install: - info: |2 - ⚙️ New Relic Agent Control configuration file can be found in /etc/newrelic-super-agent/config.yaml diff --git a/test/definitions-eu/super-agent/debians/debian11-super-agent-eu.json b/test/definitions-eu/super-agent/debians/debian11-super-agent-eu.json deleted file mode 100644 index d2bd3199..00000000 --- a/test/definitions-eu/super-agent/debians/debian11-super-agent-eu.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.nano", - "ami_name": "debian-11-amd64-daily-202?????-*", - "user_name": "admin" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/debian.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/debians/ubuntu16-super-agent-eu.json b/test/definitions-eu/super-agent/debians/ubuntu16-super-agent-eu.json deleted file mode 100644 index c2c68a6e..00000000 --- a/test/definitions-eu/super-agent/debians/ubuntu16-super-agent-eu.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "ubuntu16-super-eu", - "provider": "aws", - "type": "ec2", - "size": "t3.small", - "ami_name": "ubuntu-pro-server/images/hvm-ssd/ubuntu-xenial-16.04-amd64-pro-server-????????", - "user_name": "ubuntu" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["ubuntu16-super-eu"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/debian.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/debians/ubuntu18-super-agent-eu.json b/test/definitions-eu/super-agent/debians/ubuntu18-super-agent-eu.json deleted file mode 100644 index dc8f2438..00000000 --- a/test/definitions-eu/super-agent/debians/ubuntu18-super-agent-eu.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.nano", - "ami_name": "ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-????????", - "user_name": "ubuntu" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/debian.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/debians/ubuntu20-super-agent-eu.json b/test/definitions-eu/super-agent/debians/ubuntu20-super-agent-eu.json deleted file mode 100644 index 16898390..00000000 --- a/test/definitions-eu/super-agent/debians/ubuntu20-super-agent-eu.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.nano", - "ami_name": "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-2023*", - "user_name": "ubuntu" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/debian.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/debians/ubuntu20arm64-super-agent-eu.json b/test/definitions-eu/super-agent/debians/ubuntu20arm64-super-agent-eu.json deleted file mode 100644 index 2786f7de..00000000 --- a/test/definitions-eu/super-agent/debians/ubuntu20arm64-super-agent-eu.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t4g.nano", - "ami_name": "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-arm64-server-????????-*", - "user_name": "ubuntu" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/debian.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/debians/ubuntu22-super-agent-eu.json b/test/definitions-eu/super-agent/debians/ubuntu22-super-agent-eu.json deleted file mode 100644 index 18c253e8..00000000 --- a/test/definitions-eu/super-agent/debians/ubuntu22-super-agent-eu.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.micro", - "ami_name": "ubuntu/images/hvm-ssd/ubuntu-jammy-22.??-amd64-server-????????", - "user_name": "ubuntu" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/debian.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/logs/amazonlinux2-super-agent-logs-eu.json b/test/definitions-eu/super-agent/logs/amazonlinux2-super-agent-logs-eu.json deleted file mode 100644 index 5d58a554..00000000 --- a/test/definitions-eu/super-agent/logs/amazonlinux2-super-agent-logs-eu.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "ami_name": "amzn2-ami-hvm-2.0.????????.?-x86_64-gp2", - "type": "ec2", - "size": "t3.micro" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/logs/amazonlinux2023-super-agent-logs-eu.json b/test/definitions-eu/super-agent/logs/amazonlinux2023-super-agent-logs-eu.json deleted file mode 100644 index 6c607204..00000000 --- a/test/definitions-eu/super-agent/logs/amazonlinux2023-super-agent-logs-eu.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.small", - "ami_name": "al2023-ami-2023.*-x86_64", - "user_name": "ec2-user" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/logs/debian11-super-agent-logs-eu.json b/test/definitions-eu/super-agent/logs/debian11-super-agent-logs-eu.json deleted file mode 100644 index d0346c2a..00000000 --- a/test/definitions-eu/super-agent/logs/debian11-super-agent-logs-eu.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.nano", - "ami_name": "debian-11-amd64-daily-*", - "user_name": "admin" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/logs/redhat8-super-agent-logs-eu.json b/test/definitions-eu/super-agent/logs/redhat8-super-agent-logs-eu.json deleted file mode 100644 index e9765939..00000000 --- a/test/definitions-eu/super-agent/logs/redhat8-super-agent-logs-eu.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.micro", - "ami_name": "RHEL_HA-8.4.?_HVM-????????-x86_64-??-Hourly2-GP2" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/logs/redhat9-super-agent-logs-eu.json b/test/definitions-eu/super-agent/logs/redhat9-super-agent-logs-eu.json deleted file mode 100644 index 6de6e556..00000000 --- a/test/definitions-eu/super-agent/logs/redhat9-super-agent-logs-eu.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.micro", - "ami_name": "RHEL_HA-9.0.?_HVM-????????-x86_64-?-Hourly2-GP2" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/logs/suse154-super-agent-logs-eu.json b/test/definitions-eu/super-agent/logs/suse154-super-agent-logs-eu.json deleted file mode 100644 index c9f248aa..00000000 --- a/test/definitions-eu/super-agent/logs/suse154-super-agent-logs-eu.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.nano", - "ami_name": "suse-sles-15-sp4-chost-byos-v????????-hvm-ssd-x86_64" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/logs/ubuntu20-super-agent-logs-eu.json b/test/definitions-eu/super-agent/logs/ubuntu20-super-agent-logs-eu.json deleted file mode 100644 index 52ff036c..00000000 --- a/test/definitions-eu/super-agent/logs/ubuntu20-super-agent-logs-eu.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.micro", - "ami_name": "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*", - "user_name": "ubuntu" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/logs/ubuntu22-super-agent-logs-eu.json b/test/definitions-eu/super-agent/logs/ubuntu22-super-agent-logs-eu.json deleted file mode 100644 index 2f82f89f..00000000 --- a/test/definitions-eu/super-agent/logs/ubuntu22-super-agent-logs-eu.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.micro", - "ami_name": "ubuntu/images/hvm-ssd/ubuntu-jammy-22.??-amd64-server-????????", - "user_name": "ubuntu" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/rhel/awslinux23-super-agent-eu.json b/test/definitions-eu/super-agent/rhel/awslinux23-super-agent-eu.json deleted file mode 100644 index 940abed1..00000000 --- a/test/definitions-eu/super-agent/rhel/awslinux23-super-agent-eu.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "ami_name": "al2023-ami-2023.*-x86_64", - "type": "ec2", - "size": "t3.nano", - "user_name": "ec2-user" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/rhel.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/rhel/awslinuxarm64-super-agent-eu.json b/test/definitions-eu/super-agent/rhel/awslinuxarm64-super-agent-eu.json deleted file mode 100644 index 9073b814..00000000 --- a/test/definitions-eu/super-agent/rhel/awslinuxarm64-super-agent-eu.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "ami_name": "amzn2-ami-hvm-2.0.????????.?-arm64-gp2", - "type": "ec2", - "size": "t4g.nano" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/rhel.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/rhel/redhat8arm64-super-agent-eu.json b/test/definitions-eu/super-agent/rhel/redhat8arm64-super-agent-eu.json deleted file mode 100644 index ddde59bd..00000000 --- a/test/definitions-eu/super-agent/rhel/redhat8arm64-super-agent-eu.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t4g.micro", - "ami_name": "RHEL-8.*_HVM-????????-arm64-*-Hourly2-GP2" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/rhel.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/suse/suse125-super-agent-eu.json b/test/definitions-eu/super-agent/suse/suse125-super-agent-eu.json deleted file mode 100644 index 689e9b19..00000000 --- a/test/definitions-eu/super-agent/suse/suse125-super-agent-eu.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.micro", - "ami_name": "suse-sles-12-sp5-v????????-hvm-*" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/suse.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions-eu/super-agent/suse/suse154-super-agent-eu.json b/test/definitions-eu/super-agent/suse/suse154-super-agent-eu.json deleted file mode 100644 index 460ac1fa..00000000 --- a/test/definitions-eu/super-agent/suse/suse154-super-agent-eu.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.nano", - "ami_name": "suse-sles-15-sp4-chost-byos-v????????-hvm-ssd-x86_64" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/suse.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/debians/debian11-super-agent.json b/test/definitions/super-agent/debians/debian11-super-agent.json deleted file mode 100644 index d2bd3199..00000000 --- a/test/definitions/super-agent/debians/debian11-super-agent.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.nano", - "ami_name": "debian-11-amd64-daily-202?????-*", - "user_name": "admin" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/debian.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/debians/ubuntu16-super-agent.json b/test/definitions/super-agent/debians/ubuntu16-super-agent.json deleted file mode 100644 index 23d7df2c..00000000 --- a/test/definitions/super-agent/debians/ubuntu16-super-agent.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "ubuntu16-super", - "provider": "aws", - "type": "ec2", - "size": "t3.nano", - "ami_name": "ubuntu-pro-server/images/hvm-ssd/ubuntu-xenial-16.04-amd64-pro-server-????????", - "user_name": "ubuntu" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["ubuntu16-super"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/debian.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/debians/ubuntu18-super-agent.json b/test/definitions/super-agent/debians/ubuntu18-super-agent.json deleted file mode 100644 index dc8f2438..00000000 --- a/test/definitions/super-agent/debians/ubuntu18-super-agent.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.nano", - "ami_name": "ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-????????", - "user_name": "ubuntu" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/debian.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/debians/ubuntu20-super-agent.json b/test/definitions/super-agent/debians/ubuntu20-super-agent.json deleted file mode 100644 index 16898390..00000000 --- a/test/definitions/super-agent/debians/ubuntu20-super-agent.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.nano", - "ami_name": "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-2023*", - "user_name": "ubuntu" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/debian.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/debians/ubuntu20arm64-super-agent.json b/test/definitions/super-agent/debians/ubuntu20arm64-super-agent.json deleted file mode 100644 index 2786f7de..00000000 --- a/test/definitions/super-agent/debians/ubuntu20arm64-super-agent.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t4g.nano", - "ami_name": "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-arm64-server-????????-*", - "user_name": "ubuntu" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/debian.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/debians/ubuntu22-super-agent.json b/test/definitions/super-agent/debians/ubuntu22-super-agent.json deleted file mode 100644 index 18c253e8..00000000 --- a/test/definitions/super-agent/debians/ubuntu22-super-agent.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.micro", - "ami_name": "ubuntu/images/hvm-ssd/ubuntu-jammy-22.??-amd64-server-????????", - "user_name": "ubuntu" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/debian.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/logs/amazonlinux2-super-agent-logs.json b/test/definitions/super-agent/logs/amazonlinux2-super-agent-logs.json deleted file mode 100644 index 5d58a554..00000000 --- a/test/definitions/super-agent/logs/amazonlinux2-super-agent-logs.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "ami_name": "amzn2-ami-hvm-2.0.????????.?-x86_64-gp2", - "type": "ec2", - "size": "t3.micro" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/logs/amazonlinux2023-aarch64-super-agent-logs.json b/test/definitions/super-agent/logs/amazonlinux2023-aarch64-super-agent-logs.json deleted file mode 100644 index a98094f3..00000000 --- a/test/definitions/super-agent/logs/amazonlinux2023-aarch64-super-agent-logs.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t4g.nano", - "ami_name": "al2023-ami-2023.*-arm64", - "user_name": "ec2-user" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } - } - \ No newline at end of file diff --git a/test/definitions/super-agent/logs/amazonlinux2023-x86-super-agent-logs.json b/test/definitions/super-agent/logs/amazonlinux2023-x86-super-agent-logs.json deleted file mode 100644 index 6c607204..00000000 --- a/test/definitions/super-agent/logs/amazonlinux2023-x86-super-agent-logs.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.small", - "ami_name": "al2023-ami-2023.*-x86_64", - "user_name": "ec2-user" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/logs/debian11-super-agent-logs.json b/test/definitions/super-agent/logs/debian11-super-agent-logs.json deleted file mode 100644 index d0346c2a..00000000 --- a/test/definitions/super-agent/logs/debian11-super-agent-logs.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.nano", - "ami_name": "debian-11-amd64-daily-*", - "user_name": "admin" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/logs/redhat8-super-agent-logs.json b/test/definitions/super-agent/logs/redhat8-super-agent-logs.json deleted file mode 100644 index e9765939..00000000 --- a/test/definitions/super-agent/logs/redhat8-super-agent-logs.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.micro", - "ami_name": "RHEL_HA-8.4.?_HVM-????????-x86_64-??-Hourly2-GP2" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/logs/redhat9-super-agent-logs.json b/test/definitions/super-agent/logs/redhat9-super-agent-logs.json deleted file mode 100644 index 6de6e556..00000000 --- a/test/definitions/super-agent/logs/redhat9-super-agent-logs.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.micro", - "ami_name": "RHEL_HA-9.0.?_HVM-????????-x86_64-?-Hourly2-GP2" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/logs/suse154-super-agent-logs.json b/test/definitions/super-agent/logs/suse154-super-agent-logs.json deleted file mode 100644 index c9f248aa..00000000 --- a/test/definitions/super-agent/logs/suse154-super-agent-logs.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.nano", - "ami_name": "suse-sles-15-sp4-chost-byos-v????????-hvm-ssd-x86_64" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/logs/suse155-super-agent-logs.json b/test/definitions/super-agent/logs/suse155-super-agent-logs.json deleted file mode 100644 index 065327c3..00000000 --- a/test/definitions/super-agent/logs/suse155-super-agent-logs.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.micro", - "ami_name": "suse-sles-sap-15-sp5-v*-hvm-ssd-x86_64-*" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": [ - "host1" - ], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/suse.yml", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "local_recipes": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/logs/ubuntu20-super-agent-logs.json b/test/definitions/super-agent/logs/ubuntu20-super-agent-logs.json deleted file mode 100644 index 52ff036c..00000000 --- a/test/definitions/super-agent/logs/ubuntu20-super-agent-logs.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.micro", - "ami_name": "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*", - "user_name": "ubuntu" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/logs/ubuntu22-super-agent-logs.json b/test/definitions/super-agent/logs/ubuntu22-super-agent-logs.json deleted file mode 100644 index 2f82f89f..00000000 --- a/test/definitions/super-agent/logs/ubuntu22-super-agent-logs.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.micro", - "ami_name": "ubuntu/images/hvm-ssd/ubuntu-jammy-22.??-amd64-server-????????", - "user_name": "ubuntu" - } - ], - - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent_logs", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", - "params": { - "env_var": "NEW_RELIC_CLI_SKIP_CORE=1", - "newrelic_cli_option": "-n super-agent,logs-integration-super-agent", - "validate_output": "Logs Integration\\s+\\(installed\\)", - "local_recipes": true, - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/rhel/awslinux23-super-agent.json b/test/definitions/super-agent/rhel/awslinux23-super-agent.json deleted file mode 100644 index 940abed1..00000000 --- a/test/definitions/super-agent/rhel/awslinux23-super-agent.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "ami_name": "al2023-ami-2023.*-x86_64", - "type": "ec2", - "size": "t3.nano", - "user_name": "ec2-user" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/rhel.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/rhel/awslinuxarm64-super-agent.json b/test/definitions/super-agent/rhel/awslinuxarm64-super-agent.json deleted file mode 100644 index 9073b814..00000000 --- a/test/definitions/super-agent/rhel/awslinuxarm64-super-agent.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "ami_name": "amzn2-ami-hvm-2.0.????????.?-arm64-gp2", - "type": "ec2", - "size": "t4g.nano" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/rhel.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/rhel/redhat8arm64-super-agent.json b/test/definitions/super-agent/rhel/redhat8arm64-super-agent.json deleted file mode 100644 index ddde59bd..00000000 --- a/test/definitions/super-agent/rhel/redhat8arm64-super-agent.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t4g.micro", - "ami_name": "RHEL-8.*_HVM-????????-arm64-*-Hourly2-GP2" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/rhel.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/suse/suse125-super-agent.json b/test/definitions/super-agent/suse/suse125-super-agent.json deleted file mode 100644 index 689e9b19..00000000 --- a/test/definitions/super-agent/suse/suse125-super-agent.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.micro", - "ami_name": "suse-sles-12-sp5-v????????-hvm-*" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/suse.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -} diff --git a/test/definitions/super-agent/suse/suse154-super-agent.json b/test/definitions/super-agent/suse/suse154-super-agent.json deleted file mode 100644 index 460ac1fa..00000000 --- a/test/definitions/super-agent/suse/suse154-super-agent.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, - "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.nano", - "ami_name": "suse-sles-15-sp4-chost-byos-v????????-hvm-ssd-x86_64" - } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": ["host1"], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/suse.yml", - "validate_output": "Agent Control\\s+\\(installed\\)", - "recipe_targeted": "super-agent", - "use_organization_id": true - } - } - ] - } -}