dstat

Version, currently master branch1 version
  • master branchlatestDec 18, 2017

github.com/jamestaylr/device-stat

Utility to monitor and report system statistics across machines

1 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  dstat:
    github: jamestaylr/device-stat
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
no constraint declared
License
MIT
Author
James Taylor

Dependencies

Runtime Dependencies

  • pg*github: will/crystal-pg
  • toml*github: manastech/crystal-toml, branch: master

README

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:

  • In pg_hba.conf, an entry host all all 0.0.0.0/0 md5 must be added
  • In postgresql.conf, listen_addresses must be set to '*' to bind to 0.0.0.0 rather than localhost
  • The following modification must be made to iptables:
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.