-
Notifications
You must be signed in to change notification settings - Fork 418
Home
Cube is designed for internal use only. Cube does not provide access control, so any data you put into Cube can be queried by anyone that can access your evaluator. You can separate the collector and evaluator, and use a firewall to prevent access to the collector. We may add some type of access control in the future if there is demand for user-facing applications.
Another method of access control is to hide Cube behind a secure, authenticated proxy (that speaks WebSockets). Even then, be aware that Cube is not yet hardened against denial-of-service attacks and other malicious requests, and is still in the early stages of development.
via Homebrew
You can install MongoDB, Node.js and NPM like so:
brew install mongodb
brew install node
via Macports
You can install MongoDB, Node.js and NPM like so:
sudo port selfupdate
sudo port install mongodb nodejs npm
Cube is tested against MongoDB 1.8.3 and Node 0.4.8. If you want MongoDB to start automatically, you can also say:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/mongodb/1.8.3-x86_64/org.mongodb.mongod.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist
sudo apt-get install mongodb mongodb-server
Next you’ll need to install Cube’s node modules.
npm install cube
# OR: git clone https://github.com/square/cube.git
cd cube
npm install
The dependencies are defined in package.json.
Lastly, you create the collections and indexes needed by Cube in Mongo. Edit schema/schema-create.js and add the name of any metric type you would like to collect, to the array of existing types, then open a terminal:
cat schema/schema-create.js | mongo cube_development
To start Cube:
node bin/collector.js &
node bin/evaluator.js &
You can now connect to localhost:1080 for the collector, and localhost:1081 for the evaluator and visualizer. You can visit http://localhost:1081/ in your browser to start creating dashboards. Cube is tested mostly on Chrome, but should run in Firefox, Safari and IE9.
You can send events to the collector using WebSockets or HTTP. For WebSockets, connect to ws://localhost:1080/1.0/event/put
. Cube supports draft-10 as well as the older draft-76; however, support for the latter will likely be removed in the future when the standard stabilizes. Once connected, send events one-at-a-time, each in their own text frame. To send events over HTTP, post a JSON array of the event objects to http://localhost:1080/1.0/event/put
.
If you just want some data in order to play around with the dashboard, run the random data emitter:
node examples/emitter/random/random.js
You’ll want to ^C the random emitter after a few seconds. You can then reload your dashboard to see the new data.
An example chart over the random.js data to get you started:
- Type: Area Chart
- Expression: sum(random)
- Time Range: 1 Day / 5-Minute