Skip to content

Monitor your servers or linux based computers remotely by posting securely to your own dashboard.

Notifications You must be signed in to change notification settings

yordadev/myMetricsJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Monitor your servers or linux based computers remotely by posting securely to your own dashboard.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published