1.0.15 • Published 3 years ago

moniter v1.0.15

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

The moniter logo.

GitHub license npm version PRs Welcome

Our Story

First prototyped in Feldkirch, Austria, then built out in full at the Umma Hüsla Hackathon "Reboot", October 2021

Want a dashboard, data persistence, logs, support, and more? Try moniter Enterprise at moniter.org - built upon this very package! 😄

Otherwise, follow the remaining documenation to see how you can use moniter at your own organization.

Get Started

  1. Install the moniter package in your project:
npm install --save moniter
  1. Setup configuration files:
  • Copy the entire contents of the folder example/src/config/moniter to your project and modify all the configuration files:

  • url-config.ts: the list of URLs and the intervals at each that you want to monitor them.

  • alert-config.ts: the list of alert methods you wish to be notified by
  • email-config.ts: the email settings if you wish to be notified by email
  • slack-config.ts: the Slack webhook if you wish to be notified by slack

*** More contact methods are coming soon! ***

Once these files have been created, *do not* check them into git! They potentially contain secrets!

  1. Create a new .ts file (in this example named moniter-config.ts) and import these configuration files and create a variable that corresponds to the IConfigConfig interface:
// src/config/moniter/moniter-config.ts
import { IConfigConfig } from 'moniter';
import urlConfig from './url-config.js';
import alertConfig from './alert-config.js';
import emailConfig from './email-config.js';
import slackConfig from './slack-config.js';

const config: IConfigConfig = {
  urlConfig,
  alertConfig,
  // TODO: add once properly configured for your organization:
  // emailConfig,
  // slackConfig,
};

export default config;

Note that according to IConfigConfig, at least a urlConfig and an alertConfig is required. This example follows the example/ folder and uses only the AlertMethod.CONSOLE alert type.

  1. Import moniter, and your newly created config and call monitor(config) to start monitoring! Or call runImmediately(config) to ignore the cron values and check all URLs immediately.
// index.js
import moniter, { runImmediately } from 'moniter'
import config from './src/config/moniter/monitor-config.js'

moniter(config);

// alternatively, run immediately for all URLs!
// runImmediately(config);

Question: Why the use of the .js file extension everywhere when these are TypeScript files?

Answer: moniter is trying to be very cool and uses esm to package itself. This requires that write our imports filepaths with their compiled file paths(s), i.e., .js.

TypeScript unfortunately does not consider it a responsibility for their library. See more here

Don't want to do all these steps yourself? Try moniter Enterprise at moniter.org - built on this very package! 😄

Example: Run With Forever

To have an on premise site uptime checker you can use anywhere, you can run moniter by using the tool forever:

forever start index.js

This will restart your index.js process if moniter crashes at any time.

See forever's repository for more information.

(We're not sponsored by forever in any way, we just think it's a cool tool! 😄)

Example

See a working example in the example/ folder.

1.0.2

3 years ago

1.0.1

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.0

3 years ago