Giter Site home page Giter Site logo

pinkdiamond1 / server-monitor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pops-one/server-monitor

0.0 1.0 0.0 163 KB

Monitor Server Health using Pusher API

License: GNU General Public License v3.0

JavaScript 23.88% Python 6.65% HTML 69.47%

server-monitor's Introduction

Server Monitor Dashboard using Pusher API

A simple dashboard to monitor your server's CPU, Memory and Disk Usage (Auto-refreshed every 15 seconds)

How does it work ?

  1. A python script reads the CPU, Memory, Disk usage on the server and sends it to Pusher API
  2. You view the results using a simple HTML/js file which pulls the data from Pusher API
  3. The results are only accessible using your secure Pusher API key

Advantages of this method

  1. No need to open up ports, configure security/firewall rules, setup https, encryption etc... on your server
  2. You can view the results using a simple HTML file on your desktop/laptop/mobile phone.

Pre-requisite

Sign-up for an account on https://pusher.com/ . Please make a note of your APP_ID, KEY, SECRET, CLUSTER values from the pusher dashboard. Free version allows you to send up to 200K messages a day. This is enough for monitoring 1 server every 15 seconds.

How to install

Login to your Ubuntu VPS server

  1. Install Python3 sudo apt-get install python3
  2. Install PIP sudo apt-get install python3-pip
  3. Install pusher API & psutil pip3 install pusher pip3 install psutil
  4. Download the server-monitor scripts to your server wget https://raw.githubusercontent.com/mirrormirage0/server-monitor/master/pusher_config.py wget https://raw.githubusercontent.com/mirrormirage0/server-monitor/master/server_push.py
  5. Login to your pusher.com account and make a note of the APP_ID, KEY, SECRET, CLUSTER values.
  6. Edit pusher_config.py and replace the values for my_app_id, my_key, my_secret,my_cluster nano pusher_config.py After you have replaced the values, press CTRL-O, CTRL-X to write the file and exit.
  7. Execute the server_push.py script to start reading your CPU/Memory/Disk usage values and publishing to pusher. python3 server_push.py

You will see the following output Sleeping for 15 second Sending a message

When you see this, You can login to your pusher dashboard and see the messages being received. Each message will have the CPU, Memory and Disk usage percentage.

View the output as graphs/table

Download the server_monitor.js and server_monitor.html files to your Desktop/Mobile. Edit server_monitor.js and replace the value for PUSHERKEY and PUSHERCLUSTER. Open server_monitor.html in your browser.

Where can I change the frequency of reading/broadcasting the readings?

You will find this in the server_push.py

TODO

The easiest way to run the server process in the background is as follows tmux new-session -s server-push python3 server_push.py Then press CTRL-b , and then press d This will detach you from tmux session To reconnect back to the session, use tmux attach Pressing CTRL-c inside the tmux session will kill the process and stop broadcasting the values.

server-monitor's People

Contributors

mirrormirage0 avatar

Watchers

 avatar

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.