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

@randlabs/server-watchdog-nodejs

v1.0.1

Published

NodeJS library for the Server monitoring tool

Downloads

2

Readme

server-watchdog-nodejs

NodeJS library for interacting with the Server monitoring tool.

Installation

To install the library, use the following command inside your NodeJS project:

$ npm install @randlabs/server-watchdog-nodejs --save

Usage sample

const ServerWatchdogClient = require('@randlabs/server-watchdog-nodejs');

//...

let swdClient = ServerWatchdogClient.create({
		host: '127.0.0.1',
		port: 3004,
		apiKey: 'my-access-key',
		defaultChannel: 'default'
});
	
swdClient.info('This is a sample information message').then(() => {
    console.log('Success');
}).catch((err) => {
    console.log('Unable to deliver notification');
});

Documentation

To create the client instance use:

swdClient = ServerWatchdogClient.create(options);

options
options.host

Specifies the server host address.

options.port

Specifies the server port.

options.useSsl

Indicates if the connection to server must use a secure channel.

options.apiKey

Sets the key used to access the server. This is intended to be secret. The key must match the string configured in the server configuration.

options.defaultChannel

Sets the default channel to use when a channel is not specified on notification methods. Read the server documentation for details about channels.

options.timeout (optional)

Establishes the maximum time to use when sending messages to the server in millisecond units. A default value of ten (10) seconds is used if this option is not specified.

Methods

swdClient.error(message[, channel])

Sends an error message to the server using the specified or default channel.

Returns a promise to indicate when delivery completes.

swdClient.warn(message[, channel])

Sends a warning message to the server using the specified or default channel.

Returns a promise to indicate when delivery completes.

swdClient.info(message[, channel])

Sends an information message to the server using the specified or default channel.

Returns a promise to indicate when delivery completes.

swdClient.processWatch(pid, name[, severity[, channel]])

Informs the server to monitor the specified process. severity can be error, warn or info. If not specified, error is used.

If the process is killed or exits with an exit code different than zero, the server will send the proper notification to the specified or default channel.

Returns a promise to indicate when delivery completes.

swdClient.processUnwatch(pid[, channel])

Informs the server to stop monitoring the specified process. Returns a promise to indicate when delivery completes.

License

See LICENSE file.