oneuptime/server-monitor
2020-02-17 00:24:23 +01:00
..
bin Update monitor status 2019-11-07 01:59:50 +01:00
lib Fix server monitor lint. 2020-02-17 00:24:23 +01:00
out Update docs 2019-11-03 13:05:03 +01:00
test Implement recommendations and fix tests 2020-01-31 16:44:39 +01:00
.env.example
.eslintignore
.eslintrc.json Fix server monitor lint. 2020-02-17 00:24:23 +01:00
.gitattributes fixed backend failing test and crlf error in all projects 2019-11-21 18:35:28 +05:30
.gitignore
package-lock.json Add dependency check in all projects. 2020-02-13 22:47:35 +03:00
package.json Remove pretest lint becasue we lint in lint_n_audit jobs. 2020-02-16 22:53:03 +01:00
README.md Update 2019-11-03 12:57:49 +01:00

Fyipe Server Monitor

A fyipe shell package that monitor's server resources - disk, memory and CPU percentage - used.

Installation

You can install to use on the CLI:

$ npm install -g fyipe-server-monitor

You can install to use in your project:

$ cd project
$ npm install fyipe-server-monitor

CLI Usage

You can use on the CLI:

  • Run fyipe-server-monitor.
  • Enter your Project ID and API key - Get these from your Fyipe Dashboard.
  • Select Server Monitor from the list of Server Monitors.
  • Server will be pinged every minute and the data stored in your project.

You can also use like so:

$ fyipe-server-monitor -p 5d64d59cae46131619708309 -a b02798c0-c898-11e9-9f14-4963dc67e2ab -m 5d7775e9f14a531364ba6917

Basic Usage

const serverMonitor = require("fyipe-server-monitor");

const monitor = serverMonitor({
  projectId: "5d64d59cae46131619708309",
  apiKey: "b02798c0-c898-11e9-9f14-4963dc67e2ab",
  monitorId: "5d7775e9f14a531364ba6917",
  interval: "*/5 * * * * *", // cron job interval
  timeout: 10000 // milliseconds
});

monitor.start();

API Documentation

Main API to authenticate user, start and stop server monitoring.

See

  • module:helpers
  • module:logger

Author: HackerBay, Inc.

module.exports(config, apiKey, monitorId) ⇒ Object

Authenticate user and get list of server monitors if monitor id not provided.

Kind: Exported function Returns: Object - The server monitor handlers.

Param Type Description
config string | Object The project id or config of the project.
apiKey string The api key of the project.
monitorId string | function The monitor id or function to resolve monitor id of the server monitor.

module.exports~ping(projectId, monitorId, apiKey, interval) ⇒ Object

Get system information at interval and upload to server.

Kind: inner method of module.exports Returns: Object - The ping server cron job.

Param Type Default Description
projectId string The project id of the project.
monitorId string The monitor id of the server monitor.
apiKey string The api key of the project.
interval string "* * * * *" The interval of the cron job, must ba a valid cron format.

module.exports~start(id) ⇒ Object | number

Start server monitor.

Kind: inner method of module.exports Returns: Object | number - The ping server cron job or the error code.

Param Type Description
id string The monitor id of the server monitor.

module.exports~stop() ⇒ Object

Stop server monitor.

Kind: inner method of module.exports Returns: Object - The ping server cron job.