Code Monkey home page Code Monkey logo

mymetricsjs's Introduction

MyMetricsJS

Extremely light weight server monitoring system to monitor your servers or computers remotely through https request.
myMetricsJS builds a payload every 30 seconds and sends it out to your API to be processed.

Completely free and open source.

Requirements

  • Latest Version of Node
  • Ubuntu

Configuration

  • Rename ./lib/configexample.json to ./lib/config.json
  • fill er out.
{
    "setup": {
        "notifyAddress": "ip/subdomain.domain.com/domain.com",
        "notifyPort": "443 or 80",
        "notifyPath": "/api/monitor"
    },
    "security": {
        "type": "custom",
        "service": {
            "jwt": {
                "token": "enter your jwt token"
            },
            "custom": {
                "token": "mymetricsjs"
            }
        }
    },
    "services": {
        "enabled": "screen",
        "available": {
            "screen": {
                "run": "screen -S mymetricsjs -dm node ./mymetrics.js",
                "stop": "screen -S mymetricsjs -p 0 -X quit",
                "install": "sudo apt-get install screen"
            },
            "pm2": {
                "run": "pm2 start mymetrics.js",
                "stop": "pm2 stop mymetrics.js",
                "install": "npm install pm2@latest -g"
            }
        }
    },
    "debug": {
        "enabled": true
    }
}

Debug notice

You cannot start the monitor in the background in debug mode.
To use debug mode enabled type the following with debug enabled. This does not run the monitor in the backround. node mymetricsjs

Installing

git clone https://github.com/yordadev/myMetricsJS.git
cd client
node setup

Usage

Usage of this package lives in ./client/ and its easy peasy. node start && node stop

Expected Payload

    "authorization": {
        'token': "" 
    },
    "id": "",
    "cpus": 0,
    "server_uptime": 0,
    "total_memory": 0,
    "free_memory": 0,
    "free_memory_round": 0,
    "load_avg": [],
    /* Comes in a List of 3 Elements, 1 Min, 15 Min, 30 Min */
    "interfaces": {
        "ipv4": [],
        "ipv6": []
    },
    "errorLog": []
}

Screenshots

What are services in the config.json?

Services here are what keeps your monitor running deteached in the background. Plan on adding cronjobs to this but for now this will do.

Why use this monitor?

Zero Dependency light weight monitoring system that'll send your system information to any API you want, easy peasy with an extremely easy setup.

Is this secure?

Yes, myMetricsJS has prebuilt in authentication ready to go for you.

If you have JWT Authenication on your API already:

  • Set security.type to jwt
  • Set security.service.jwt.token to a JWT token.

If you do not have JWT Authenication on your API:

  • set security.type to custom
  • set security.service.custom.token to anything you want
  • on your API Endpoint, you will retrieve the token entered above to verify that this is coming from indeed your server.

How to contribute

Contribute a PR/Issue or buy me a covfefe.

mymetricsjs's People

Contributors

yordadev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

darksidesfear

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.