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

fyipe-server-monitor-staging

v3.0.9353

Published

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

Downloads

52

Readme

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.

| Param | Type | Description | | --------- | -------------------------------------------- | ----------------------------------------------------------------------- | | config | string | Object | The project id or config of the project. | | apiUrl | string | The url of the api. | | 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, 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.

| Param | Type | Default | Description | | --------- | ------------------- | --------------------------------------- | ---------------------------------------------------------- | | projectId | string | | The project id of the project. | | monitorId | string | | The monitor id of the server monitor. | | apiUrl | string | | The url of the api. | | 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.