Overmind icon indicating copy to clipboard operation
Overmind copied to clipboard

Instructions to grafana install

Open paralyser opened this issue 7 years ago • 1 comments

Installation of Grafana5 with Google compute:

  • #Step1: Getting ready.

Create a google compute engine. Set up an f1 - micro ubuntu or debian compute engine. This is the cheapest engine, but will do the work. Leave every setting on default. I personaly used ubuntu. I think the only difference is, that ubuntu comes with git installed.

Create a screepspl.us account.

Note: You will need your screeps auth token(provided by screeps.com), and screepspl.us token(generated at account creation).

  • #Step2: Connect to it via SSH.

I used SSH in a browser window. ( dropdown menu)

  • #Step3: Install git, node js, node-agent.

I personaly tried both Node v8, and v10. Both working.

In SSH terminal do the followings:

sudo apt-get install -y git - for Git

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - - for NodeJs installer

sudo apt-get install -y nodejs - NodeJs

git clone https://github.com/ScreepsPlus/node-agent.git - Cloning repository

cd node-agent - Entering the node-agent directory

npm install - Npm

  • #Step4: Configuring and testing node-agent script.

In SSH terminal do the followings

cp config.js.sample config.js - Creating config.js from config.js.sample.

nano config.js - Editing newly created config.js.

Edit config.js and use Your credentials. You have to use 2 different tokens, one provided from screeps account, and the other from screepsplus account. Do NOT forget to remove last line.

When You are done with editing do the following in SSH Terminal:

node app.js Test the node-agent script.

You shall see something like this:

Pushing stats

Result: {"ok":1,"ts":1529157913,"format":"json"}

If it has errors see the DEBUG section.

Press CTRL+C to stop the script.

  • #Step5: Setting Your script to run in background.

For this I personally used TMUX.

In SSH terminal do the followings:

tmux - Creating a tmux instance

cd node-agent - Entering Your script directory

node app.js - Starting Your script. As a result You shall see the same as in #STEP4.

Press CTRL+B and after press D. You detached from tmux. Tmux will keep to run in background.

In SSH terminal write:

w - This will list the users logged in, You shall see the tmux session also.

Example:

14:18:00 up 16:02, 2 users, load average: 0.00, 0.00, 0.00

USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT

boti pts/0 tmux(7622).%0 00:53 13:24m 12.74s 12.71s node app.js

boti pts/1 80.167.78.203 12:55 0.00s 0.05s 0.00s w

DO NOT START THE SCRIPT MULTIPLE TIMES!

Now feel free to close the SSh Terminal, because the script runs in the background. Every time You come back to Your server You can chack the TMUX status by typing the following in the SSH terminal:

tmux attach

  • #Step6:

Log in to your screepspl.us account. IMPORTANT!!!: We use grafana5.

Import Overmind.JSON. Change the username from dropdown to Your screepspl.us username.

Enjoy the graphs!

#########DEBUG########

In steps 1,2 and 5 You shall not run in errors.

In step 3 in case You have chosen ubuntu, You will have a warning, at git is already Installed. Ignore it.

In step 4 You may face configuration errors, check Your config file after tokens.

In step 4 You may also face this error:

Error: Rate limit exceeded, retry after 9222721ms or disable rate limiting

Make sure: You have only 1 instances of node-agent script running! Your screeps auth key is not used elsewhere. Do not create new auth tokens as I did, it is just a waste of time, because the couldown is set on You account globally. Simply wait until that timer expires.

In step 6 You may face errors from screepspl.us like this one:

Datasource named ScreepsPlus-Graphite was not found

Check You datasource list in the configuration menu. If it is empty fill the ollowing fields:

Name: ScreepsPlus-Graphite

Type: Graphite

HTTP/URL: https://screepspl.us/grafana/carbonapi

HTTP/Access: Direct

Graphite details/Version: 1.1x

Checkboxes: Default, AUTH/With credentials.

This script is not owned by me, I just made this detailed guide, because I faced every mentioned problem while I tried to set up grafana. I hope it will be helpful for some users, with 0 knowledge to servers.

Credits goes to:

  • users from #overmind slack channel for helping and testing.

  • ags131 for making grafana and support questions.

  • bonzAI instructions.

paralyser avatar Jun 16 '18 17:06 paralyser

Use tmux new -s screeps-node-agent to name the tmux session, attach using tmux a -t screeps-node-agent

Compresses commands to be pasted into shell (untested):

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash

sudo apt-get install -y git nodejs && git clone https://github.com/ScreepsPlus/node-agent.git && cd node-agent && npm install

cp config.js.sample config.js && nano config.js

tmux new -D -s screeps-node-agent node app.js

Coolfeather2 avatar Jun 16 '18 18:06 Coolfeather2