Code Monkey home page Code Monkey logo

servermonitor's Introduction

servermonitor

servermonitor is a small project to provide a few simple web graphs showing server CPU and bandwidth usage

About

servermonitor is a small project utilising Python, PHP and javascript to provide a few simple graphs on CPU and bandwidth usage. It works by using Python as a webserver to serve json encoded information, and then the javascript to product animated graphs based on that data.

For my original purposes, I had the webserver serving the HTTP and the server serving the json on separate machines, so that is why I chose to separate the two. This project was made to monitor the CPU and bandwidth usage of a game server in real time, and I didn't want the game server running a web server, so the lightweight Tornado Python module was chosen.

Live example: https://www.sheen.id.au/monitor/

Example image: alt tag

Prerequisites

It depends on following:

We also assume you have a web server, such as Apache which can serve up HTML and PHP - note that whilst I am using PHP in this example, it can also be simply HTML - there is no actual PHP - the code running on my live site that I produced this Git from does have PHP which does various unrelated stuff, so me being lazy I just ripped out the irrelevant code and was left with no actual PHP.

Installation

Copy the www folder contents to your webserver folder.

Run the Python script servermonitor.py using the following:

/usr/bin/python servermonitor.py 82

Note the port number to listen to is passed as a parameter - in this example I'm using port 82. This is the port the Python webserver will serve the json up on.

You can check the json being served using a browser and visiting the :PORT/monitor addess - eg:

https://sheen.id.au:82/monitor

You should see something like this:

{"rx": 0.2744903564453125, "tx": 0.9374618530273438, "cpu03": 58.0, "cpu02": 26.0, "cpu01": 7.1, "cpu00": 23.2, "cpu07": 1.0, "cpu06": 0.0, "cpu05": 21.2, "cpu04": 4.1}

Now you'll need to edit the index.php to make it look at your Python service for the json - in the code look for the following line and replace it with your own url.

url: "https://www.sheen.id.au:82/monitor"

With that done, you can now visit your front-end web server to view the graphs.

servermonitor's People

Contributors

mikesheen avatar

Watchers

Robin Michael avatar James Cloos avatar  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.