dstat Node Profiler

Crystal Setup

Install dependencies, which will be resolved into lib from shard.yml:

crystal deps

Database Setup

Creating the Roles and Tables

sudo su - postgres
psql
CREATE DATABASE stats;
CREATE USER capstone3 WITH PASSWORD 'password';

Then, run psql/schema.psql to initialize the tables, enumerated types, and indices. The database must also be externally reachable:

iptables -A INPUT -s 0/0 -p tcp --dport 5432 -j ACCEPT

telnet (instead of a psql client) can be used to trivially verify the port is open on the host machine.

Configure Cron

crontab -e

Should be configured to run benchmarking (dstat -r) every minute:

* * * * * /usr/local/dstat/dstat -r

SystemD Configuration

Move the service unit file, dstat.service into /etc/systemd/system (altering the user option as appropriate). Then the web service can be interacted with using the expected service commands:

sudo service dstat status

If the unit file is changed on disk, run: systemctl daemon-reload as root.