npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

thewatcher

v1.1.2

Published

Node location monitor, status & relay.

Downloads

14

Readme

TheWatcher

A client / server monitoring tool (Previously named: NightWatch; Keeps watch over its clients through the night)

NPM Version Dependency Status Code Climate Gitter

js-standard-style


# Setup

Clone the project

Recommendation: Use the master branch for the best stability, If you wish to try an experimental / dev branch checkout be aware, there will be errors / incomplete functionality.

# Installing the latest from NPM
npm install thewatcher

# Optionally installing to access globally
npm install thewatcher -g

# To get the latest on GitHub
git clone https://github.com/TheDoxMedia/thewatcher.git
Get Dependencies
npm install
First use walkthrough

Where the command/step should be performed for each step will be marked like: [server]

  1. [server] A server is needed, on the server machine run thewatcher -s server, the prompts will walk through setting up the Database & server information/keys which will be located under ./conf.

  2. [server] Preparing the Database structure, run thewatcher --db setup, this will load the server.json, connect to the provided DB & table and setup the structure (if not already present). (Note: The DB Table must exist & at least be empty for this step)

[server] At this point the server can be started using thewatcher -m server

  1. [client] Setup a client. The same as with the server, we need to run the client setup to create the proper .json & client keys. On the client machine, run thewatcher -s client to begin the prompts.

  2. [client] After completing 3, the client must be loaded into the server's clients database in order for the client to authenticate and transmit its status/stats. Run thewatcher --export client /path/to/save.json

Why not import the default client.json? The default /conf/client.json only contains paths to the client's keys. Running the export places the keys into the one exported client.json file for easy transport/server add/import.

  1. [server] Adding the new client we created to the server's clients. On the server run thewatcher -a /path/to/client.json pointing to the client.json we brought over from the client machine containing the keys.

That's it. For new clients, they only need to be created and added to the server.

  1. (Optional) [server] You can navigate to https://127.0.0.1:9905/admin, once here provide the server's private key (./conf/SVR_PrivateKey) to perform a client-like socket authentication and display all connected client's and admins along with the currently available clients stats.

Side note: The client can be created on the server machine, client.json exported and moved to the client machine - the config-loader will understand if it sees the raw key instead of a path when running for either the server or client mode startup.


# Running via cmd / shell

All commands starting with node index.js

| Desc | Shorthand | Full | Arg / Options | |:-------------------|---------------|------------|--------------------------| | Run Config Builder | -s | --setup | client | server | | Start in mode | -m | --mode | client | server | | Add a client | -a | --add | /path/to/json | | Export client conf | | --export | client /path/to/save| | Database * | | --db | *<check opts below> |

Config builder

Running config builder mode via command line will prompt the user for various items such as Name, Location of server, port to listen on, and database connection information.

# Example for setting up server
thewatcher -s server

# For client
thewatcher -s client

Start in mode

Starts TheWatcher in the specified mode, the application will check the default location (./conf/) for the client -or- server's {config}.json and generated pgp keys. Once loaded the application begin listening or connect to the specified server and emit back (client to server) its current running details & stats.

# Example
thewatcher -m server

Add a client

Adds the supplied client's configuration & [Public] pgp key to the server's Database. The server's Database is used to track and authenticate its clients.

# Example (Note: Without the type, this is contained in the {type}.json file)
thewatcher -a /path/to/client.json

Export client config

Exports the current client config (from ./conf/client.json) to the specified save path.

Note: The default /conf/client.json does not store the client's pgp keys rather it stores the location of the keys and on mode startup these paths are used to load the client key's data. Exporting replaces the paths with the key contents for better portability and for importing later at the server.

# Example
thewatcher --export /path/to/save/

Database

Helpers to setup and manage the database.

Note: The default /conf/server.json is needed in order for these helpers to setup & communicate with the database (as the server's DB credentials are stored inside this config file.

# Example - Migrate the initial DB structure (createTableIfNotExists)
thewatcher --db setup

Configuration

Overrides to the <type>.json available starting with 1.1.0.

The Environment Variable being used first with the <type>.json as the fallback.

Available

# Database
TW_DB_HOST=127.0.0.1
TW_DB_USER=user
TW_DB_PASS=pass
TW_DB_NAME=thewatcher
TW_LOG=debug

# Usage via require('thewatcher')


# Versions

1.1.2
  • Dependencies update.
  • Shortened user ID to shorter 7 digit output, full value still passed internally.
1.1.1
  • Added logging
  • Updates to setup
  • Support for environment variable DB settings
  • Updates to npm test testing
  • Added wait for DB connection to server
  • Fixed client heartbeat multiplier in certain situations
1.0.1
  • Memory DB for storing heartbeat/client current data.
  • MySQL (See docs for supported) DB for storing clients.
  • Database migrations.
  • Better Client & Server config generate.
  • PGP keys on client used to help verify data sent to server.
  • Client config & key exporting.
  • Redone client authentication.
  • Better command line support & options.
  • Available via npm.
  • WebSocket for client <=> server data vs restful from 0.0.1.
  • Some initial support/testin for thewatcher-gui. (More to come)
  • Rename from NightWatch to TheWatcher.
  • More complete readme & walkthrough.
1.0.0
  • Used for rebuilding and prep for full release. See >=1.0.1.
0.0.1
  • Initial release.
    • Readme added!
    • Both Client and Server modes available (set in respective .json config file that's loaded in.)
    • Add and generate of clients can be performed using the --add mode of running thewatcher.
    • Checkins & Clients tracked via DB files.