Skip to content
A TurtleCoin® public node monitor agent that monitors, polls, and logs public node availability and basic information to MySQL/MariaDB backend.
JavaScript TSQL
Branch: master
Clone or download

README.md

NPM

Version Documentation Maintenance License: AGPL-3.0 Twitter:

Prerequisites

Install

Collection Service

npm install -g turtlecoin-node-monitor
export MYSQL_HOST=<server ip>
export MYSQL_PORT=<server port>
export MYSQL_USERNAME=<server username>
export MYSQL_PASSWORD=<server password>
export MYSQL_DATABASE=<database>
turtlecoin-node-monitor

Additional Options

export MYSQL_SOCKET=<server socket path (default: not set)>
export MYSQL_CONNECTION_LIMIT=<# of maximum server connections (default: 10)>
export HISTORY_DAYS=<# of days to keep history (default: 6 hours)>
export UPDATE_INTERVAL=<# of seconds between updating node list (default: 1 hour)>
export POLLING_INTERVAL=<# of seconds between checking nodes (default: 120s)>
export NODE_LIST_URL=<Full URL to node list (default: turtlecoin-nodes-json)>

As a Module for Pulling Stats

npm install --save turtlecoin-node-monitor

Sample Code

const StatsDatabase = require('turtlecoin-node-monitor')

const db = new StatsDatabase({
  host: 'localhost',
  port: 3306,
  username: 'root',
  password: 'password',
  database: 'turtlecoin',
  connectionLimit: 10
})

db.getNodeStats().then((stats) => {
  console.log(stats)
})

Database Schema

CREATE TABLE IF NOT EXISTS `nodes` (
  `id` varchar(64) NOT NULL,
  `name` varchar(255) NOT NULL,
  `hostname` varchar(255) NOT NULL,
  `port` int(11) NOT NULL DEFAULT 11898,
  `ssl` int(11) NOT NULL DEFAULT 0,
  `cache` int(11) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `ssl` (`ssl`),
  KEY `cache` (`cache`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `node_polling` (
  `id` varchar(64) NOT NULL,
  `timestamp` bigint(1) unsigned NOT NULL,
  `status` int(11) NOT NULL DEFAULT 0,
  `feeAddress` varchar(255) DEFAULT NULL,
  `feeAmount` bigint(20) NOT NULL DEFAULT 0,
  `height` bigint(20) NOT NULL DEFAULT 0,
  `version` varchar(20) NOT NULL DEFAULT '0.0.0',
  `connectionsIn` int(11) NOT NULL DEFAULT 0,
  `connectionsOut` int(11) NOT NULL DEFAULT 0,
  `difficulty` bigint(20) NOT NULL DEFAULT 0,
  `hashrate` bigint(20) NOT NULL DEFAULT 0,
  `txPoolSize` bigint(20) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`,`timestamp`),
  KEY `status` (`status`),
  KEY `feeAmount` (`feeAmount`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED;

Author

The TurtleCoin Developers

License

Copyright © 2019 The TurtleCoin Developers.
This project is AGPL-3.0 licensed.

You can’t perform that action at this time.