------- datadog_setup.sh -------
##!/bin/bash
# Installing nginx
nginx=stable
sudo add-apt-repository ppa:nginx/$nginx
sudo apt-get update
sudo apt-get install nginx -y
# Installing curl
sudo apt-get install curl
# Datadog Initial setup
echo "Copy and paste the easy one step install script from datadogs and press Enter."
read datadogs_install
sudo $datadogs_install
# insert this text into line 66, adding another location to the server
# to check that the /nginx_status metrics page is working, change the "deny all;" to "allow all;" in nginx default config found at /etc/nginx/sites-enabled/default
sudo sed -i '66i location /nginx_status { stub_status on; access_log off; allow 127.0.0.1; deny all; }' /etc/nginx/sites-enabled/default
#restart nginx server
sudo nginx -s reload
#EOF
You can now see your basic metrics at http://your server ip/nginx_status