-
Notifications
You must be signed in to change notification settings - Fork 0
/
cluster_init_infra.sh
executable file
·30 lines (22 loc) · 928 Bytes
/
cluster_init_infra.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Define the config path
NEW_RELIC_CONFIG_FILE="/etc/newrelic-infra.yml"
# Add New Relic's Infrastructure Agent gpg key
curl -fsSL https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/newrelic-infra.gpg
# Create a manifest file
echo "deb https://download.newrelic.com/infrastructure_agent/linux/apt/ jammy main" | sudo tee -a /etc/apt/sources.list.d/newrelic-infra.list
# Run an update
sudo apt-get update
# Install the New Relic Infrastructure agent
sudo apt-get install newrelic-infra -y
# Create the agent config file
sudo cat <<EOM >> $NEW_RELIC_CONFIG_FILE
license_key: $NEW_RELIC_LICENSE_KEY
custom_attributes:
databricksClusterId: $DB_CLUSTER_ID
databricksClusterName: $DB_CLUSTER_NAME
databricksIsDriverNode: $DB_IS_DRIVER
databricksIsJobCluster: $DB_IS_JOB_CLUSTER
EOM
# Start the agent
sudo systemctl start newrelic-infra