@turtlecoin/node-monitor
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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.

Package Sidebar

Install

npm i @turtlecoin/node-monitor

Weekly Downloads

1

Version

1.0.0

License

AGPL-3.0

Unpacked Size

72.4 kB

Total Files

15

Last publish

Collaborators

  • zpalmtree
  • fexra
  • brandonlehmann