Skip to content

Commit 5bf6142

Browse files
authored
Merge pull request #13 from gottfrois/nginx-nr-agent
Adds nginx newrelic agent snippet
2 parents 3e5bbbc + 7167166 commit 5bf6142

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

cloud66/nginx_newrelic_agent

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# {{Description: This deploy hook will run the following code snippet to automate the installation of NewRelic Nginx plugin, and requires NEWRELIC_KEY and NEWRELIC_NGINX_NAME environment variables to be set on a stack.}}
2+
if [ -z "$NEWRELIC_KEY" ]
3+
then
4+
>&2 echo "Please set your NEWRELIC_KEY environment variable"
5+
exit 1
6+
elif [ -z "$NEWRELIC_NGINX_NAME" ]
7+
then
8+
>&2 echo "Please set your NEWRELIC_NGINX_NAME environment variable"
9+
exit 1
10+
else
11+
if [ -s /etc/apt/sources.list.d/nginx.list ]
12+
then
13+
sudo rm -f /etc/apt/sources.list.d/nginx.list
14+
echo "deb http://nginx.org/packages/ubuntu/ trusty nginx" | sudo tee -a /etc/apt/sources.list.d/nginx.list
15+
else
16+
echo "deb http://nginx.org/packages/ubuntu/ trusty nginx" | sudo tee -a /etc/apt/sources.list.d/nginx.list
17+
fi
18+
19+
sudo wget -O- http://nginx.org/keys/nginx_signing.key | sudo apt-key add -
20+
sudo apt-get update -y
21+
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install nginx-nr-agent crudini
22+
23+
sudo crudini --set --existing /etc/nginx-nr-agent/nginx-nr-agent.ini global newrelic_license_key $NEWRELIC_KEY
24+
sudo crudini --set /etc/nginx-nr-agent/nginx-nr-agent.ini source1 name $NEWRELIC_NGINX_NAME
25+
sudo crudini --set /etc/nginx-nr-agent/nginx-nr-agent.ini source1 url http://127.0.0.1:8559/status
26+
sudo /etc/init.d/nginx-nr-agent start
27+
fi

0 commit comments

Comments
 (0)