quick few quiries if anyone can help:
im wanting to pull information from the web server and post it into nice graphs
so far ive managed to pull the average load.
but
how would i pull cpu details in php?
how would i pull ram information in php?
and how would i then plot this in a graph
like the server load graph below
http://www.keentheme...quer/index.html
any idea?
thanks in advance
jqplot and php
Page 1 of 15 Replies - 279 Views - Last Post: 04 February 2013 - 05:34 AM
Replies To: jqplot and php
#2
Re: jqplot and php
Posted 02 February 2013 - 12:14 PM
Well.. you would check their documentation and see that all the chart needs is an array of numbers.. give it that and bam-o! You got nice looking charts!
http://www.jqplot.co...line-charts.php
http://www.jqplot.co...line-charts.php
#3
Re: jqplot and php
Posted 02 February 2013 - 12:33 PM
modi123_1, on 02 February 2013 - 12:14 PM, said:
Well.. you would check their documentation and see that all the chart needs is an array of numbers.. give it that and bam-o! You got nice looking charts!
http://www.jqplot.co...line-charts.php
http://www.jqplot.co...line-charts.php
thanks only problem the jqplot doesnt look like the one on the website speciefied above and
if im putting the data into a array how would i update this array every x amount of seconds?
#4
Re: jqplot and php
Posted 02 February 2013 - 12:48 PM
Quote
thanks only problem the jqplot doesnt look like the one on the website speciefied above
It it were me.. I would get the sample graph working first, before attempting to substitute my own data.
Quote
if im putting the data into a array how would i update this array every x amount of seconds?
You would use (normally) Ajax to make a request to the server for the updated data and feed this into your Javascript array. Again, I would get it working for a single, static, array firstly.
You are making it very difficult for yourself if you are trying to do everything at once. If it doesn't work, how would you know which part is failing?!
This post has been edited by andrewsw: 02 February 2013 - 12:51 PM
#5
Re: jqplot and php
Posted 04 February 2013 - 03:50 AM
andrewsw, on 02 February 2013 - 12:48 PM, said:
Quote
thanks only problem the jqplot doesnt look like the one on the website speciefied above
It it were me.. I would get the sample graph working first, before attempting to substitute my own data.
Quote
if im putting the data into a array how would i update this array every x amount of seconds?
You would use (normally) Ajax to make a request to the server for the updated data and feed this into your Javascript array. Again, I would get it working for a single, static, array firstly.
You are making it very difficult for yourself if you are trying to do everything at once. If it doesn't work, how would you know which part is failing?!
Hey thanks for your feedback ive decided im going to insert all the data into a database and pull it into an array and that way it shows history of uptime ram etc
Quick query in regards to that
$row=mysql_query (SELECT * FROM server ORDER BY upsite DESC LIMIT 10)
Echo $row
Would the statement above constantly pull the last 10 results? Or would i need to use ajax to do that?
Also my file which runs the script to pull data how would i get that to run every 10seconds?
Would putting a cron on it work?
Thanks
Jordan
#6
Re: jqplot and php
Posted 04 February 2013 - 05:34 AM
$row=mysql_query (SELECT * FROM server ORDER BY upsite DESC LIMIT 10) echo $row
Well, yes, it would return the last 10 rows (if you add quotes and semi-colons!), but you can't echo the row like that. You would use code like the following.
// Perform Query
$result = mysql_query($query);
if ($result) {
while ($row = mysql_fetch_assoc($result)) {
echo $row['firstname'];
echo $row['lastname'];
echo $row['address'];
echo $row['age'];
}
}
The docs
But that is PHP code: it will run once on the server and forward the results to your page. To keep grabbing data would require making Ajax requests, using Javascript's setInterval or setTimeout.
I don't know much about CRON jobs, but they are scheduled server-side scripts. They are used to perform maintenance tasks on the server and cannot affect a page that is already being viewed in a browser.
The mysql library is DEPRECATED - use mysqli or PDO instead.
This post has been edited by andrewsw: 04 February 2013 - 05:35 AM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote







|