The concept of Hubble is simple: you launch the program in a big terminal window, and it will display any information that communicates with it via a custom HTTP port 9999 on your machine. In other words, any program capable of pushing some data via HTTP will be able to exchange with Hubble. This makes Hubble easy to interact with and highly flexible. But I think that a bit of practice and a few examples will convince you better than I can.
Installation of Hubble
To install Hubble, you will need the node package manager (npm).
For Debian or Ubuntu:
$ sudo ln -s /usr/bin/nodejs /usr/bin/node
For Arch Linux:
Once npm is installed, you can run:
$ sudo npm install -g hubble
And you should hopefully be all set then.
Usage of Hubble
As mentioned earlier, Hubble is like your best friend waiting for hot gossip. It listens on TCP port 9999 on your localhost machine and displays information. To begin, simply launch it in your terminal via:
Notice that you might have an error message if your window is not big enough. If this is the case, just enter into full screen mode.
From there, press the 'Y' key to make a new configuration file. The file 'config.coffee' should be sitting in your current directory. This is a very standard configuration aspect of Hubble. Put simply, you can modify the title, remove the banner, or modify the port number that's being listened on. The most advanced features will be explained later, when they will make a bit more sense in context.
The most interesting aspect of Hubble is the way you can communicate with it. There are two ways: post information via HTTP, or tell Hubble to query it itself. To post information directly, I like to use curl, which is a very useful program to have in general. The syntax works like this:
In a less abstract way,
will display this:
From there, you can decrement or increment the value with the syntax:
Or even set a threshold via:
Notice that once the value is past that threshold, the text color will change to what has been specified in the config.coffee file under :
The second way to have data show up is to have Hubble query the data itself. This is done by posting to it once with the syntax:
-d column=[column #] \
-d label="[label name]" \
-d poll_url="[URL to poll]" \
-d poll_seconds=[number of seconds between polls] \
-d poll_failed="[message to display if failed]" \
-d poll_method="[how to parse the data]"
As an example, this would be:
-d column=0 \
-d label="Name" \
-d poll_url="https://api.github.com/users/jaymedavis" \
-d poll_seconds=10 \
-d poll_failed="Bummer :(" \
This displays the name of Hubble's creator under the label "Name" in the first column. Notice that the query is done every 10 seconds, and returns a JSON file. Hubble can parse the JSON, and return the value under the tag "name" with the correct parsing method.
In general, Hubble can parse JSON files, and even count the number of elements in an array. From that, it is up to you to be creative and use your favorite APIs.
Last but not least of Hubble's features, you can have multiple screens displayed. In other words, load a different dashboard by pressing a specific key. To set up this other screen, use the syntax:
So for example:
displays another coffee label on a separate screen, that you would display by pressing 'h'.
Finally, once you have all your information nicely spread and displayed in your dashboard, you can save your configuration to a script file via:
and load it back through:
To conclude, I really like Hubble. The idea of having a dashboard is not for everyone, and there are quite a lot of configurations and creativity needed to make it work, but the result is always on par with the effort. The only feature left to be desired is a native way to have Hubble switch screens based on time. In others words, alternate automatically between screens every minute for example. Anyway, it is a great project and from there I can only direct you to the official GitHub page for the project. Kudos to the developers.
What do you think of Hubble? Is it too complex? Would you invest some time in it? And if so, what does your dashboard look like? Let us know in the comments.
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!