Skip to content

Instantly share code, notes, and snippets.

@boostrack
Forked from otoolep/influxdb-grafana-howto.sh
Last active August 29, 2015 14:10
Show Gist options
  • Save boostrack/9a1b0f7f3554aa08a8a9 to your computer and use it in GitHub Desktop.
Save boostrack/9a1b0f7f3554aa08a8a9 to your computer and use it in GitHub Desktop.

Revisions

  1. @otoolep otoolep revised this gist Jun 10, 2014. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions influxdb-grafana-howto.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,11 @@
    #!/bin/bash

    # Check out the blog post at:
    #
    # http://www.philipotoole.com/influxdb-and-grafana-howto
    #
    # for full details on how to use this script.

    AWS_EC2_HOSTNAME_URL=http://169.254.169.254/latest/meta-data/public-hostname
    INFLUXDB_DATABASE=test1
    INFLUXDB_PKG=influxdb_latest_amd64.deb
  2. @otoolep otoolep revised this gist Jun 10, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion influxdb-grafana-howto.sh
    Original file line number Diff line number Diff line change
    @@ -24,7 +24,7 @@ sudo sed -i "s|/usr/share/nginx/html|/home/ubuntu/$GRAFANA_VER|g" /etc/nginx/sit
    sudo service nginx restart

    public_hostname=`curl -s $AWS_EC2_HOSTNAME_URL`
    if [ $? -ne 0 ]; then
    if [ $? -eq 0 ]; then
    echo "Public hostname of this EC2 instance is: $public_hostname"
    else
    echo "Failed to determine EC2 public hostname."
  3. @otoolep otoolep revised this gist Jun 10, 2014. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion influxdb-grafana-howto.sh
    Original file line number Diff line number Diff line change
    @@ -24,7 +24,13 @@ sudo sed -i "s|/usr/share/nginx/html|/home/ubuntu/$GRAFANA_VER|g" /etc/nginx/sit
    sudo service nginx restart

    public_hostname=`curl -s $AWS_EC2_HOSTNAME_URL`
    echo "Public hostname of this EC2 instance is: $public_hostname"
    if [ $? -ne 0 ]; then
    echo "Public hostname of this EC2 instance is: $public_hostname"
    else
    echo "Failed to determine EC2 public hostname."
    echo "Falling back to local hostname."
    public_hostname=`hostname`
    fi

    echo "Configuring Grafana."
    wget https://gist.github.com/otoolep/c58991dec54711026b77/raw/606c0f5adccba4153c5daa016711f2e5350f6939/gistfile1.js -O $GRAFANA_VER/config.js
  4. @otoolep otoolep revised this gist Jun 10, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion influxdb-grafana-howto.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/bin/bash

    AWS_EC2_HOSTNAME_URL=http://169.254.169.254/latest/meta-data/public-hostname
    INFLUXDB_DATABASE=test67
    INFLUXDB_DATABASE=test1
    INFLUXDB_PKG=influxdb_latest_amd64.deb
    INFLUXDB_URL=http://s3.amazonaws.com/influxdb/$INFLUXDB_PKG
    GRAFANA_VER=grafana-1.5.4
  5. @otoolep otoolep revised this gist Jun 10, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions influxdb-grafana-howto.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/bin/bash

    AWS_EC2_HOSTNAME_URL=http://169.254.169.254/latest/meta-data/public-hostname
    INFLUXDB_DATABASE=test1
    INFLUXDB_DATABASE=test67
    INFLUXDB_PKG=influxdb_latest_amd64.deb
    INFLUXDB_URL=http://s3.amazonaws.com/influxdb/$INFLUXDB_PKG
    GRAFANA_VER=grafana-1.5.4
    @@ -36,6 +36,6 @@ curl -s "http://localhost:8086/db?u=root&p=root" -d "{\"name\": \"$INFLUXDB_DATA
    echo "Downloading sine wave generation program."
    curl -s https://gist.github.com/otoolep/3d5741e680bf76021f77/raw/1d81a1ad4771659b008b9c346b4dd20ef1b72536/sine.py >sine.py

    echo "Configuration complete."
    echo -e "Configuration complete. You can find InfluxDB and Grafana at the URLs below.\n"
    echo "Influxdb URL: http://$public_hostname:8083"
    echo "Grafana URL: http://$public_hostname"
  6. @otoolep otoolep revised this gist Jun 9, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion influxdb-grafana-howto.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/bin/bash

    AWS_EC2_HOSTNAME_URL=http://169.254.169.254/latest/meta-data/public-hostname
    INFLUXDB_DATABASE=test67
    INFLUXDB_DATABASE=test1
    INFLUXDB_PKG=influxdb_latest_amd64.deb
    INFLUXDB_URL=http://s3.amazonaws.com/influxdb/$INFLUXDB_PKG
    GRAFANA_VER=grafana-1.5.4
  7. @otoolep otoolep created this gist Jun 9, 2014.
    41 changes: 41 additions & 0 deletions influxdb-grafana-howto.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    #!/bin/bash

    AWS_EC2_HOSTNAME_URL=http://169.254.169.254/latest/meta-data/public-hostname
    INFLUXDB_DATABASE=test67
    INFLUXDB_PKG=influxdb_latest_amd64.deb
    INFLUXDB_URL=http://s3.amazonaws.com/influxdb/$INFLUXDB_PKG
    GRAFANA_VER=grafana-1.5.4
    GRAFANA_PKG=$GRAFANA_VER.tar.gz
    GRAFANA_URL=http://grafanarel.s3.amazonaws.com/$GRAFANA_PKG
    GRAFANA_CONFIG_GIST=https://gist.github.com/otoolep/c58991dec54711026b77/raw/c5af837b93032d5b929fef0ea0b262648ddd4b7f/gistfile1.js

    echo "Downloading and installing Influxdb."
    wget $INFLUXDB_URL
    sudo dpkg -i $INFLUXDB_PKG
    sudo /etc/init.d/influxdb start

    echo "Downloading and installing Grafana."
    wget $GRAFANA_URL
    tar xvfz $GRAFANA_PKG

    echo "Downloading and installing nginx."
    sudo apt-get -y install nginx-full
    sudo sed -i "s|/usr/share/nginx/html|/home/ubuntu/$GRAFANA_VER|g" /etc/nginx/sites-available/default
    sudo service nginx restart

    public_hostname=`curl -s $AWS_EC2_HOSTNAME_URL`
    echo "Public hostname of this EC2 instance is: $public_hostname"

    echo "Configuring Grafana."
    wget https://gist.github.com/otoolep/c58991dec54711026b77/raw/606c0f5adccba4153c5daa016711f2e5350f6939/gistfile1.js -O $GRAFANA_VER/config.js
    sed -i "s|PUBLIC_HOSTNAME|$public_hostname|g" $GRAFANA_VER/config.js

    echo "Creating Influxdb database $INFLUXDB_DATABASE."
    curl -s "http://localhost:8086/db?u=root&p=root" -d "{\"name\": \"$INFLUXDB_DATABASE\"}"

    echo "Downloading sine wave generation program."
    curl -s https://gist.github.com/otoolep/3d5741e680bf76021f77/raw/1d81a1ad4771659b008b9c346b4dd20ef1b72536/sine.py >sine.py

    echo "Configuration complete."
    echo "Influxdb URL: http://$public_hostname:8083"
    echo "Grafana URL: http://$public_hostname"