Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Super Agent recipe, add all repository to allow Fluentbit installation and fix bugs #994

Merged
merged 4 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions recipes/newrelic/infrastructure/super-agent/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ preInstall:
echo "docker detected with environ, unsupported" >&2
exit 131
fi
if [[ -f /.dockerenv ]] ; then
if [ -f /.dockerenv ] ; then
echo "docker detected with .dockerenv, unsupported" >&2
exit 131
fi
Expand Down Expand Up @@ -138,7 +138,7 @@ install:
- |
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_INFRA_AVAILABLE -eq 0 ] ; then
if [ $IS_AGENT_AVAILABLE -eq 0 ] ; then
echo "there is no newrelic super agent available for the distribution with codename '{{.DEBIAN_CODENAME}}'." >&2
exit 131
fi
Expand Down Expand Up @@ -199,7 +199,7 @@ install:
setup_infra_proxy:
cmds:
- |
if [ "{{.NR_CLI_INFRA_AGENT}}" != "false" && ! -z "$HTTPS_PROXY" ]; then
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
Expand Down Expand Up @@ -257,10 +257,13 @@ install:
if [ $IS_ARM -gt 0 ] ; then
ARCH="arm64"
fi

if [ -n "{{.DEBIAN_CODENAME}}" ]; then
printf "deb [arch="$ARCH"] {{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/apt {{.DEBIAN_CODENAME}} main" | tee /etc/apt/sources.list.d/newrelic-infra.list > /dev/null
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}}preview/linux/apt {{.DEBIAN_VERSION_CODENAME}} main" | tee /etc/apt/sources.list.d/newrelic-infra.list > /dev/null
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:
Expand Down Expand Up @@ -336,21 +339,21 @@ install:
config_supervisors:
cmds:
- |
if [ "{{.NR_CLI_INFRA_AGENT}}" == "false" && "{{.NR_CLI_NRDOT}}" == "false" ] ; then
if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ]; then
sed -i '/^\s*agents:/s/^/#/' /etc/newrelic-super-agent/config.yaml
else
sed -i 's/s*#\s*agents:/agents:/g' /etc/newrelic-super-agent/config.yaml
fi
- |
if [ "{{.NR_CLI_INFRA_AGENT}}" == "false" ] ; then
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
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
Expand All @@ -364,7 +367,7 @@ install:
config_opamp:
cmds:
- |
if [ "{{.NR_CLI_FLEET_ENABLED}}" == "false" ] ; then
if [ "{{.NR_CLI_FLEET_ENABLED}}" = "false" ] ; then
sed -i '/^\s*opamp:/s/^/#/' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*endpoint: https:\/\/opamp/s/^/#/' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*api-key:/s/^/#/' /etc/newrelic-super-agent/config.yaml
Expand All @@ -391,7 +394,7 @@ install:
config_host_monitoring:
cmds:
- |
if [ "{{.NR_CLI_HOST_MONITORING_SOURCE}}" == "otel" ]; then
if [ "{{.NR_CLI_HOST_MONITORING_SOURCE}}" = "otel" ]; then
echo 'is_secure_forward_only: true' >> /etc/newrelic-infra.yml
else
if [ -f /etc/nr-otel-collector/config.yaml ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ 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

dependencies:
NRhzhao marked this conversation as resolved.
Show resolved Hide resolved
- super-agent

installTargets:
- type: host
os: linux
Expand Down Expand Up @@ -71,6 +68,11 @@ installTargets:
platformFamily: rhel
platformVersion: "((7|8)\\.?.*)"
kernelArch: aarch64
- type: host
os: linux
platformFamily: suse
platformVersion: "(15\\.[1-4]|15-SP[1-4])"
kernelArch: aarch64

keywords:
- Logs
Expand Down
40 changes: 22 additions & 18 deletions recipes/newrelic/infrastructure/super-agent/rhel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ preInstall:
echo "docker detected with environ, unsupported" >&2
exit 131
fi
if [[ -f /.dockerenv ]] ; then
if [ -f /.dockerenv ] ; then
echo "docker detected with .dockerenv, unsupported" >&2
exit 131
fi
Expand Down Expand Up @@ -154,13 +154,13 @@ install:
exit 15
fi
- |
if [[ {{.AMAZON_LINUX_VERSION}} != "2" && {{.AMAZON_LINUX_VERSION}} != "2023" ]] ; then
REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/linux/yum/{{.REPO_DIR}}/{{.DISTRO_VERSION}}/{{.ARCH}}/newrelic-infra.repo")
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}}infrastructure_agent/linux/yum/{{.REPO_DIR}}/{{.AMAZON_LINUX_VERSION}}/{{.ARCH}}/newrelic-infra.repo")
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_INFRA_AVAILABLE -eq 0 ] ; then
if [ $IS_NEWRELIC_AVAILABLE -eq 0 ] ; then
echo "there is no newrelic super agent available for the distribution '{{.DISTRO_VERSION}}'." >&2
exit 21
fi
Expand Down Expand Up @@ -225,18 +225,22 @@ install:
install_super_agent:
cmds:
- |
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")
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")
else
REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/yum/{{.REPO_DIR}}/{{.AMAZON_LINUX_VERSION}}/{{.ARCH}}/newrelic-infra.repo")
SUPER_AGENT_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)
IS_NEWRELIC_AVAILABLE=$(curl -Ls $SUPER_AGENT_REPO_URL | grep "\[newrelic-infra\]" | wc -l)
if [ $IS_NEWRELIC_AVAILABLE -eq 0 ] ; then
echo "newrelic super agent 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
echo "newrelic super agent 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 $REPO_URL -o /etc/yum.repos.d/newrelic-infra.repo
yum -y -q makecache --disablerepo='*' --enablerepo='newrelic-infra'
fi
INFRA_REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/linux/yum/el/{{.DISTRO_VERSION}}/{{.ARCH}}/newrelic-infra.repo")

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
vars:
DISTRO_VERSION:
Expand Down Expand Up @@ -272,21 +276,21 @@ install:
config_supervisors:
cmds:
- |
if [ "{{.NR_CLI_INFRA_AGENT}}" == "false" && "{{.NR_CLI_NRDOT}}" == "false" ] ; then
if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ] ; then
sed -i '/^\s*agents:/s/^/#/' /etc/newrelic-super-agent/config.yaml
else
sed -i 's/s*#\s*agents:/agents:/g' /etc/newrelic-super-agent/config.yaml
fi
- |
if [ "{{.NR_CLI_INFRA_AGENT}}" == "false" ] ; then
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
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
Expand All @@ -300,7 +304,7 @@ install:
config_opamp:
cmds:
- |
if [ "{{.NR_CLI_FLEET_ENABLED}}" == "false" ] ; then
if [ "{{.NR_CLI_FLEET_ENABLED}}" = "false" ] ; then
sed -i '/^\s*opamp:/s/^/#/' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*endpoint: https:\/\/opamp/s/^/#/' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*api-key:/s/^/#/' /etc/newrelic-super-agent/config.yaml
Expand All @@ -327,7 +331,7 @@ install:
config_host_monitoring:
cmds:
- |
if [ "{{.NR_CLI_HOST_MONITORING_SOURCE}}" == "otel" ]; then
if [ "{{.NR_CLI_HOST_MONITORING_SOURCE}}" = "otel" ]; then
echo 'is_secure_forward_only: true' >> /etc/newrelic-infra.yml
else
if [ -f /etc/nr-otel-collector/config.yaml ]; then
Expand Down
23 changes: 14 additions & 9 deletions recipes/newrelic/infrastructure/super-agent/suse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ preInstall:
echo "docker detected with environ, unsupported" >&2
exit 131
fi
if [[ -f /.dockerenv ]] ; then
if [ -f /.dockerenv ] ; then
echo "docker detected with .dockerenv, unsupported" >&2
exit 131
fi
Expand Down Expand Up @@ -181,16 +181,21 @@ install:
cmds:
- |
ARCH=$(uname -m)
REPO_URL=$(echo -n "{{.NEW_RELIC_DOWNLOAD_URL}}preview/linux/zypp/sles/{{.SLES_VERSION}}/$ARCH/newrelic-infra.repo")
IS_NEWRELIC_AVAILABLE=$(curl -Ls $REPO_URL | grep "\[newrelic-infra\]" | wc -l)
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 "newrelic super agent 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 $REPO_URL -o /etc/zypp/repos.d/newrelic-infra.repo
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:
Expand Down Expand Up @@ -226,21 +231,21 @@ install:
config_supervisors:
cmds:
- |
if [ "{{.NR_CLI_INFRA_AGENT}}" == "false" && "{{.NR_CLI_NRDOT}}" == "false" ] ; then
if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ] ; then
sed -i '/^\s*agents:/s/^/#/' /etc/newrelic-super-agent/config.yaml
else
sed -i 's/s*#\s*agents:/agents:/g' /etc/newrelic-super-agent/config.yaml
fi
- |
if [ "{{.NR_CLI_INFRA_AGENT}}" == "false" ] ; then
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
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
Expand All @@ -254,7 +259,7 @@ install:
config_opamp:
cmds:
- |
if [ "{{.NR_CLI_FLEET_ENABLED}}" == "false" ] ; then
if [ "{{.NR_CLI_FLEET_ENABLED}}" = "false" ] ; then
sed -i '/^\s*opamp:/s/^/#/' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*endpoint: https:\/\/opamp/s/^/#/' /etc/newrelic-super-agent/config.yaml
sed -i '/^\s*api-key:/s/^/#/' /etc/newrelic-super-agent/config.yaml
Expand All @@ -281,7 +286,7 @@ install:
config_host_monitoring:
cmds:
- |
if [ "{{.NR_CLI_HOST_MONITORING_SOURCE}}" == "otel" ]; then
if [ "{{.NR_CLI_HOST_MONITORING_SOURCE}}" = "otel" ]; then
echo 'is_secure_forward_only: true' >> /etc/newrelic-infra.yml
else
if [ -f /etc/nr-otel-collector/config.yaml ]; then
Expand Down
Loading