Prerequisites
- Node.js >= 6.x
- MySQL/MariaDB
- Load the database schema
Install
Collection Service
npm install -g traaittplatform-node-monitorexport MYSQL_HOST=<server ip>export MYSQL_PORT=<server port>export MYSQL_USERNAME=<server username>export MYSQL_PASSWORD=<server password>export MYSQL_DATABASE=<database>traaittplatform-node-monitor
Additional Options
export MYSQL_SOCKET=<server socket path >export MYSQL_CONNECTION_LIMIT=<# of maximum server connections >export HISTORY_DAYS=<# of days to keep history >export UPDATE_INTERVAL=<# of seconds between updating node list >export POLLING_INTERVAL=<# of seconds between checking nodes >export NODE_LIST_URL=<Full URL to node list >
As a Module for Pulling Stats
npm install --save traaittplatform-node-monitor
Sample Code
const StatsDatabase = const db = host: 'localhost' port: 3306 username: 'root' password: 'password' database: 'traaittplatform' connectionLimit: 10 db
Database Schema
NOT EXISTS `nodes` ( `id` varchar(64) NOT NULL, `name` varchar(255) NOT NULL, `hostname` varchar(255) NOT NULL, `port` int(11) NOT NULL DEFAULT 23896, `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; 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
traaittPlatform
The traaittPlatform Developers
License
Copyright © 2020 traaittPlatform
Copyright © 2019 The traaittPlatform Developers.
This project is AGPL-3.0 licensed.