PHP Classes

PHP Server Monitor Script: Check if a server is working well using Websockets

Recommend this page to a friend!
  Info   View files Example   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 456 This week: 1All time: 6,113 This week: 560Up
Version License PHP version Categories
server-monitor 1.0.0GNU General Publi...5Networking, System information, Web s..., H..., P...
Description 

Author

This package can check if a server is working well using Websockets.

It provides a script that will start a Web server on a configurable port of the host computer that will handle HTTP requests using Websockets.

The Websockets server will return the current time on the server host machine.

A HTML page with some JavaScript code provided with this package will send HTTP requests to the server to retrieve the server time and display it to the user using Google Charts API.

Innovation Award
PHP Programming Innovation award winner
November 2018
Winner


Prize: One subscription to the PDF edition of the PHP Architect magazine
Websockets can be used to establish interactive accesses with a server over a regular HTTP connection.

This package uses Websockets it check if a server is alive and display live charts on a Web page that the user can quickly check if the server is working well as expected.

Manuel Lemos
Picture of Istvan Dobrentei
  Performance   Level  
Name: Istvan Dobrentei <contact>
Classes: 12 packages by
Country: Hungary Hungary
Age: 46
All time rank: 134711 in Hungary Hungary
Week rank: 411 Up4 in Hungary Hungary Up
Innovation award
Innovation award
Nominee: 9x

Winner: 1x

Example

<?php
require __DIR__ . '/vendor/autoload.php';

use
Ratchet\Server\IoServer;
use
Ratchet\Http\HttpServer;
use
Ratchet\WebSocket\WsServer;
use
Noodlehaus\Config;
use
Distvan\App;

$configname = dirname(__FILE__) . '/config.ini';
$config = Config::load($configname);
$app = new App($config);

$server = IoServer::factory(new HttpServer(new WsServer($app)), $app->getPort());
$app->setLoop($server->loop);
$server->run();


Details

Live Server Monitoring

A websocket solution for live server performance monitoring.

Usage:

There are two parts: - server (see: server.php), minimum PHP 7.0 version required setup the config file and run in the background - client (see: index.html) Set the server ip address, port number and click on the start button. Using the HTML5 websocket feature the Google chart shows the current time based server data Live.

Benefits:

The server provides periodically the system informations and send them to the connected clients. It is more efficient than ajax polling requests because the connected client number doesn't add extra work for the system. If there aren't any connected clients it doesn't generate data on the server.

Future todos:
  • setup a token and accept only connections with that
  • putting the whole solution behind a password protected site
  • adding more performance data
  • selecting more charts on the client side
  • store data in nosql database
  • alarm functions
  • etc...

  Files folder image Files  
File Role Description
Files folder imagelib (2 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file config.ini Data Auxiliary data
Accessible without login Plain text file index.html Data Server monitoring page
Accessible without login Plain text file readme.md Doc. Documentation
Accessible without login Plain text file server.php Example Example script

  Files folder image Files  /  lib  
File Role Description
  Plain text file App.php Class Class source
  Plain text file SysInfo.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:456
This week:1
All time:6,113
This week:560Up