1.0.0 • Published 4 years ago

@turtlecoin/node-monitor v1.0.0

Weekly downloads
1
License
AGPL-3.0
Repository
github
Last release
4 years ago

Prerequisite Documentation Maintenance License: AGPL-3.0 Twitter: TurtlePay

NPM

Prerequisites

  • node >= 12
  • One of the following DBMS
    • MariaDB/MySQL with InnoDB support
    • Postgres or a Postgres compatible SQL interface
    • SQLite (built-in)

Documentation

Full library documentation is available at https://node-monitor.turtlecoin.dev

Install

Collection Service

npm install -g yarn
git clone https://github.com/turtlecoin/turtlecoin-node-monitor
cd turtlecoin-node-monitor
yarn && yarn build

MySQL/MariaDB

1) Set your environment variables and start the service up

export USE_MYSQL=true
export DB_HOST=localhost
export DB_PORT=3306
export DB_USER=yourdbusername
export DB_PASS=yourdbpassword
export DB_NAME=turtlecoin
yarn start

Postgres

1) Set your environment variables and start the service up

export USE_POSTGRES=true
export DB_HOST=localhost
export DB_PORT=3306
export DB_USER=yourdbusername
export DB_PASS=yourdbpassword
export DB_NAME=turtlecoin
yarn start

SQLite

1) Set your environment variables and start the service up

export USE_SQLITE=true
export SQLITE_PATH=node-monitor.sqlite3
yarn start

Note: SQLite is not the best solution if you are running this as part of a web service.

Additional Options

export NODE_HISTORY_DAYS=<# of days to keep history (default: 6 hours)>
export NODE_UPDATE_INTERVAL=<# of seconds between updating node list (default: 1 hour)>
export NODE_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 in your App

yarn add @turtlecoin/node-monitor

Sample Code

import { NodeMonitorDB, getDatabase } from '@turtlecoin/node-monitor';

(async() => {
  const database = await getDatabase();

  const StatsDatabase = new NodeMonitorDB(database);

  const stats = await StatsDatabase.stats();
})();

Author

The TurtleCoin Developers

License

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