3.0.9152 • Published 4 years ago

fyipe-server-monitor v3.0.9152

Weekly downloads
76
License
ISC
Repository
-
Last release
4 years ago

npm

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:

$ fyipe-server-monitor
  • Run fyipe-server-monitor.
  • Enter your Project ID, API URL, 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 it like this:

$ fyipe-server-monitor --project-id 5d64d59cae46131619708309 --api-url https://fyipe.com/api --api-key b02798c0-c898-11e9-9f14-4963dc67e2ab --monitor-id 5d7775e9f14a531364ba6917

Or run as a daemon (requires sudo or admin privileges):

$ fyipe-server-monitor --daemon --project-id 5d64d59cae46131619708309 --api-url https://fyipe.com/api --api-key b02798c0-c898-11e9-9f14-4963dc67e2ab --monitor-id 5d7775e9f14a531364ba6917

You can use the following commands with the daemon: start, restart, stop, and uninstall.

Run to start the stopped daemon (requires sudo or admin privileges):

$ fyipe-server-monitor --daemon start

Run to restart the running daemon (requires sudo or admin privileges):

$ fyipe-server-monitor --daemon restart

Run to stop the running daemon (requires sudo or admin privileges):

$ fyipe-server-monitor --daemon stop

Run to stop and uninstall the running daemon (requires sudo or admin privileges):

$ fyipe-server-monitor --daemon uninstall

Run to check for logs and errors:

$ fyipe-server-monitor --daemon logs
$ fyipe-server-monitor --daemon errors

A complete log of the daemon can be found in these directories:

# linux logs
/var/log/Fyipe Server Monitor/fyipeservermonitor.log
/var/log/Fyipe Server Monitor/fyipeservermonitor_error.log

# mac logs
/Library/Logs/Fyipe Server Monitor/fyipeservermonitor.log
/Library/Logs/Fyipe Server Monitor/fyipeservermonitor_error.log

# windows logs
<service_path>/fyipeservermonitor.out.log
<service_path>/fyipeservermonitor.err.log

NB:- In most cases, sudo or admin privileges are required to run the shell as a daemon.

Services

Linux

Services created by the daemon are like other services running on Linux. It can be started/stopped using service fyipeservermonitor start or service fyipeservermonitor stop and logs are available. This file is created in /etc/init.d by default. Additionally, log files are generated in /var/log/Fyipe Server Monitor/ for general output and error logging.

Mac

Services created by the daemon are similar to most other services running on OSX. It can be stopped from the Activity Monitor and make logs available in the Console app. A plist file is created in /Library/LaunchDaemons by default. Additionally, two log files are generated in /Library/Logs/Fyipe Server Monitor/ for general output and error logging.

Windows

Services created by the daemon are similar to most other services running on Windows. It can be started/stopped from the windows service utility, via NET START or NET STOP commands, or even managed using the sc utility. A directory called daemon is created and populated with fyipeservermonitor.exe and fyipeservermonitor.xml. The XML file is a configuration for the executable. Additionally, logs are created in this directory (which are viewable in the Event log).

Programmatic Usage

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

const monitor = serverMonitor({
    projectId: '5d64d59cae46131619708309',
    // (optional) If you have installed Fyipe Platform on your server,
    // this should be your API URL
    apiUrl: 'https://fyipe.com/api',
    apiKey: 'b02798c0-c898-11e9-9f14-4963dc67e2ab',
    monitorId: '5d7775e9f14a531364ba6917',
    interval: '*/5 * * * * *', // cron job interval
    timeout: 10000, // milliseconds
});

monitor.start();

Known Issues

Windows Temperature

wmic - is used to determine temperature and sometimes needs to be run with admin privileges. So if you do not get any values, try to run it again with according privileges. If you still do not get any values, your system might not support this feature.

Linux Temperature

In some cases you may need to install the linux sensors package to be able to measure temperature e.g. on DEBIAN based systems run sudo apt-get install lm-sensors.

See system information to learn more.

API Documentation

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

See

  • module:helpers
  • module:logger

Author: HackerBay, Inc.

module.exports(config, apiUrl, 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.

ParamTypeDescription
configstring | ObjectThe project id or config of the project.
apiUrlstringThe url of the api.
apiKeystringThe api key of the project.
monitorIdstring | functionThe monitor id or function to resolve monitor id of the server monitor.

module.exports~ping(projectId, monitorId, apiUrl, 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.

ParamTypeDefaultDescription
projectIdstringThe project id of the project.
monitorIdstringThe monitor id of the server monitor.
apiUrlstringThe url of the api.
apiKeystringThe api key of the project.
intervalstring"* * * * *"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.

ParamTypeDescription
idstringThe 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.

3.0.9152

4 years ago

3.0.9090

4 years ago

3.0.8980

4 years ago

3.0.8757

4 years ago

3.0.8571

4 years ago

3.0.8546

4 years ago

3.0.8527

4 years ago

3.0.8544

4 years ago

3.0.8408

4 years ago

3.0.8365

4 years ago

3.0.8276

4 years ago

3.0.8241

4 years ago

3.0.8202

4 years ago

3.0.8220

4 years ago

3.0.8147

4 years ago

3.0.8117

4 years ago

3.0.7985

4 years ago

3.0.7924

4 years ago

3.0.7932

4 years ago

3.0.7816

4 years ago

3.0.7689

4 years ago

3.0.7738

4 years ago

3.0.7421

4 years ago

3.0.7384

4 years ago

3.0.7272

4 years ago

3.0.7123

4 years ago

3.0.7116

4 years ago

3.0.7040

4 years ago

3.0.7038

4 years ago

3.0.6657

4 years ago

3.0.6630

4 years ago

3.0.6563

4 years ago

3.0.6559

4 years ago

3.0.6483

4 years ago

3.0.6457

4 years ago

3.0.6423

4 years ago

3.0.6051

4 years ago

3.0.6047

4 years ago

3.0.6010

4 years ago

3.0.5973

4 years ago

3.0.5972

4 years ago

3.0.5971

4 years ago

3.0.5949

4 years ago

3.0.5928

4 years ago

3.0.5910

4 years ago

3.0.5882

4 years ago

3.0.5835

4 years ago

3.0.5762

4 years ago

3.0.5726

4 years ago

3.0.5708

4 years ago

3.0.5678

4 years ago

3.0.5674

4 years ago

3.0.5618

4 years ago

3.0.5628

4 years ago

3.0.5588

4 years ago

3.0.5547

4 years ago

3.0.5480

4 years ago

3.0.5469

4 years ago

3.0.5408

4 years ago

3.0.5385

4 years ago

3.0.5383

4 years ago

3.0.5379

4 years ago

3.0.5287

4 years ago

3.0.5284

4 years ago

3.0.5258

4 years ago

3.0.5196

4 years ago

3.0.5199

4 years ago

3.0.4342

4 years ago

3.0.4336

4 years ago

3.0.3807

4 years ago

3.0.3806

4 years ago

3.0.3805

4 years ago

3.0.3374

4 years ago

3.0.3061

5 years ago

3.0.2981

5 years ago

3.0.2976

5 years ago

3.0.2917

5 years ago

3.0.2903

5 years ago

3.0.2899

5 years ago

3.0.2890

5 years ago

3.0.2870

5 years ago

3.0.2856

5 years ago

3.0.2857

5 years ago

3.0.2800

5 years ago

3.0.2774

5 years ago

3.0.2761

5 years ago

3.0.2673

5 years ago

3.0.2640

5 years ago

3.0.2647

5 years ago

3.0.2645

5 years ago

3.0.2643

5 years ago

3.0.2641

5 years ago

3.0.2622

5 years ago

3.0.2620

5 years ago

3.0.2615

5 years ago

3.0.2617

5 years ago

3.0.2602

5 years ago

3.0.2470

5 years ago

3.0.2463

5 years ago

3.0.2457

5 years ago

3.0.2452

5 years ago

3.0.2406

5 years ago

3.0.2396

5 years ago

3.0.2404

5 years ago

3.0.2394

5 years ago

3.0.2390

5 years ago

3.0.2378

5 years ago

3.0.2376

5 years ago

3.0.2374

5 years ago

3.0.2365

5 years ago

3.0.2367

5 years ago

3.0.2361

5 years ago

3.0.2048

5 years ago

3.0.2041

5 years ago

3.0.1978

5 years ago

3.0.1974

5 years ago

3.0.1937

5 years ago

3.0.1923

5 years ago

3.0.1896

5 years ago

3.0.1885

5 years ago

3.0.1863

5 years ago

3.0.1887

5 years ago

3.0.1865

5 years ago

3.0.1881

5 years ago

3.0.1883

5 years ago

3.0.1861

5 years ago

3.0.1859

5 years ago

3.0.1877

5 years ago

3.0.1855

5 years ago

3.0.1879

5 years ago

3.0.1857

5 years ago

3.0.1797

5 years ago

3.0.1873

5 years ago

3.0.1851

5 years ago

3.0.1875

5 years ago

3.0.1853

5 years ago

3.0.1891

5 years ago

3.0.1871

5 years ago

3.0.1849

5 years ago

3.0.1889

5 years ago

3.0.1867

5 years ago

3.0.1869

5 years ago

3.0.1846

5 years ago

0.0.7

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago