PHP Classes

PHP Graph Real Time: Display graphs of machine usage in real time

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 48%Total: 1,146 All time: 3,297 This week: 673Up
Version License PHP version Categories
realtime-graphs 1.0.0GNU General Publi...5.0PHP 5, System information, AJAX
Description 

Author

This class can display graphs of machine usage in real time.

It can generate HTML and JavaScript code that will use AJAX requests to update the usage of resources of the machine on which PHP is running.

Currently it can display containers with information about the machine memory usage, number of threads, number of users, and used disk space.

Innovation Award
PHP Programming Innovation award nominee
January 2015
Number 4


Prize: One downloadable copy of Komodo IDE
Some times it is useful to view information of the state of server resources like for instance CPU, memory or disk usage. However, server resource information varies a lot over time.

This class provides a solution to display the server machine usage using graphs that are updated in real time.

Manuel Lemos
Picture of Gianluca Zanferrari
  Performance   Level  
Name: Gianluca Zanferrari <contact>
Classes: 19 packages by
Country: The Netherlands The Netherlands
Innovation award
Innovation award
Nominee: 5x

Example

<!DOCTYPE HTML>
<html>
<head>
    <script src="jquery.min.js"></script>
    <script src="highcharts.js"></script>
</head>
<body>
<?php
require_once('realtime_graph.class.php');

$mon = new realtime_graph(); // initiates the class

$mon->new_container('mem_usage'); // initiates the mem_usage graph

$mon->set_interval(5000); // I set the time interval of measurement to 5 secs

$mon->draw(); // shows the graph in browser

$mon->new_container('used_space'); // initiates the used_space graph

$mon->set_interval(10000); // I set the time interval of measurement to 10 secs

$data = $mon->draw(FALSE); // I store the data in a var for showing it as last graph (usefull for placing graphs in a templete)

$mon->new_container('num_threads'); // initiates the num_threads graph

$mon->set_interval(7000); // I set the time interval of measurement to 7 secs

$mon->draw(); // shows the graph in browser

$mon->new_container('num_users'); // initiates the num_users graph

$mon->set_interval(15000); // I set the time interval of measurement to 15 secs

$mon->draw(); // shows the graph in browser

echo($data); // I show here the 'used_space' graph
?>
</body>
</html>


Screenshots (1)  
  • screenshot.png
  Files folder image Files (7)  
File Role Description
Accessible without login Plain text file chart1.tpl Data template
Accessible without login Plain text file example.php Example example
Accessible without login Plain text file highcharts.js Data javascript file
Accessible without login Plain text file jquery.min.js Data javascript file
Plain text file realtime_graph.class.php Class class itself
Accessible without login Plain text file serverdata.php Aux. ajax handler

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,146
This week:0
All time:3,297
This week:673Up
User Ratings User Comments (2)
 All time
Utility:70%StarStarStarStar
Consistency:60%StarStarStarStar
Documentation:-
Examples:70%StarStarStarStar
Tests:-
Videos:-
Overall:48%StarStarStar
Rank:3033
 
nice work
10 years ago (Thennarasu)
20%StarStar
Nice job ;-) There a amazing class ;-)
10 years ago (José Filipe Lopes Santos)
70%StarStarStarStar