PHP Classes

File: README.txt

Recommend this page to a friend!
  Classes of monjurul hasan   RRD Manipulator   README.txt   Download  
File: README.txt
Role: Documentation
Content type: text/plain
Description: Instructions before use
Class: RRD Manipulator
Retrieve server traffic information using RRDTool
Author: By
Last change: Inclusion of RRD Files
Date: 14 years ago
Size: 3,225 bytes
 

Contents

Class file image Download
################################################################################ # rrdmrtg.class.php # # # # # # Created by Md. Monjurul Hasan # # # # Website: http://www.monjurulhasan.com # # # # Email: jewel.buet.cse@gmail.com # # # ################################################################################ Please read below to successfully implement this class Intended use To manipulate RRD values (Average, Maximum, Last and 95th Percentile) using PHP-RRDTool API, current PHP-RRDTool API only gives us the rrd values fetch feature. Pre-requisites 1. Network bandwidth calculation using SNMP-MRTG-RRDTool-PHP 2. Time series RRDTool-MRTG should be enabled in linux server. For this application, platform was CentOS 5.2 with RRDTool 1.2.27, PHP 5.1.6 and rrdtool-php-1.2.27 enabled. 3. RRD database is updated continuously otherwise you wont see values in the display table Value Estimation Algorithms Calculating Average: Sum of values/Total # of value Last/Current Value: Last updated value (in and out) in rrd file Maximum: Get the maximum of the rrd values (in and out) 95th Percentile: For my algorithm, please read the following example that I found from http://forums.cacti.net/post-95140.html&highlight= Say we have a series of data stored, we want to calculate the 95th percentile for this series of data. 1. We take the set of data, this data is an array of values retrieved from RRDtool. array: [ 2345, 3456, 1234, 5678, 7890, 5675, 3452, 56758, 2345, 234, 57788 ] 2. We have to sort the array, because we are only interested in knowing the 95th highest value. array: [ 234, 1234, 2345, 2345, 3452, 3456, 5675, 5678, 7890, 56758, 57788 ] 3. We take the number of elements in the array (11) and we multiply by the Nth percentage we want (.95) and we then round that value. round( 11 * .95 ) = 10 = Array element of interest 4. We then return the 95th percentile number, which is the 10 element in the array. All values are round up. Files included: config file //required for the rrdfiles path test.php //test file rrdmrtg.php // main class file HelperFunc.php //helper functions datagrid.css //css file for the table images/head_bg.gif //required for the display table Screenshot.png //a screenshot of the output Could not include here the rrd files: rra/test1.rrd //required rrd files for test rra/test2.rrd Thanks for reading. ################################ End ########################################### Md. Monjurul Hasan Website: http://www.monjurulhasan.com Please post me bugs and feature requests At: jewel.buet.cse@gmail.com