PHP Classes

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

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum (4)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 49%Total: 1,143 This week: 1All time: 3,296 This week: 380Up
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
Age: 57
All time rank: 1674 in The Netherlands The Netherlands
Week rank: 147 Up3 in The Netherlands The Netherlands Up
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  
  • screenshot.png
  Files folder image Files  
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

 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,143
This week:1
All time:3,296
This week:380Up
User Ratings User Comments (2)
 All time
Utility:72%StarStarStarStar
Consistency:61%StarStarStarStar
Documentation:-
Examples:72%StarStarStarStar
Tests:-
Videos:-
Overall:49%StarStarStar
Rank:2436
 
nice work
8 years ago (Thennarasu)
20%StarStar
Nice job ;-) There a amazing class ;-)
8 years ago (Josť Filipe Lopes Santos)
70%StarStarStarStar