Terminal UI for graphing service stats

After I wrote the Pebble pinproxy tool, which lets users feed information from IFTTT into their Pebble Timeline, I wanted a way to monitor the server.

For a number of reasons, I decided to make a TUI (Terminal UI) for the job. Partly because it was quick, and partly because I really like not having to leave the terminal, whilst still being able to view graphs. The end result looks like this:

It uses two nodeJS libraries to accomplish the graphs: blessed and blessed-contrib. Some of the data comes directly from the pinproxy server, but most of it comes from a cronjob run every 30 minutes which parses the logs into JSON. All of that happens on the digital ocean droplet it runs on, and the data is exposed to the monitoring tool through an API.

The two graphs show response codes from Rebble Web Services over time, and pins created per user over time. Only the last 6 characters of the user's timeline token are used as a unique ID.

The tool has basic keyboard controls - Up and Down change the 'active' user (the one highlighted red in the bottom graph), allowing you to highlight the graph of a specific user. You can also press 'o' to toggle only displaying the selected user.

Left and right 'zoom' in and out, changing the x axis of the graph by +- 10 days at a time.

The view zoomed all the way out:

and selecting only one user:

Overall, it's a neat way to visualise the traffic flowing through the pinproxy server, and it highlights how much you can do without a real GUI.