Google Answers Logo
View Question
 
Q: PHP scrip to generate MRTG graphs using RRDtool database ( No Answer,   1 Comment )
Question  
Subject: PHP scrip to generate MRTG graphs using RRDtool database
Category: Computers > Programming
Asked by: kudithipudi-ga
List Price: $40.00
Posted: 10 Jul 2003 19:59 PDT
Expires: 11 Jul 2003 20:38 PDT
Question ID: 227675
Hello,
  I am trying to create a php script whic authenticates a user
[usernames and passwords are stored in a mysql database] and then
creates MRTG like graphs for that particular user from data stored in
RRDtool format. I have MRTG populating the RRDtool databases and I
also have a user authentication script. I am not able to get a script
which will create the graphs for me. I know that there is a PHP module
for RRD but since I am not knowledgeble in PHP, I don't know if I can
script it.

==AUTHENITCATION SCRIP [showstats.php]==
<?

if ((!$username) || (!$password)) {
	header("Location: index.html");
	exit;
} 


$db_name = "*****";
$table_name = "****";

$connection = @mysql_connect("localhost", "****", "****") 
	or die("Couldn't connect.");

$db = mysql_select_db($db_name, $connection)
	or die("Couldn't select database.");

$sql = "SELECT * FROM $table_name
	WHERE UserName = \"$username\" AND Password = password(\"$password\")
	"; 

$result = mysql_query($sql) 
        or die ("Can't execute query.");

mysql_close($connection);

$num = mysql_numrows($result); 

if ($num != 0)
    { 
	$msg = "<P><B>Customer:</B> [$username]</p>";
    }
    else
    { 
	header("Location: bad_login.html");
	exit;
    } 
?> 

<HTML>
<HEAD>
<TITLE>Traffic Analysis Stats for <? echo $username ?></TITLE>
</HEAD>
<BODY>
    <? echo "$msg"; ?>
<BR>
</BODY>
</HTML>

==END OF AUTHENITCATION SCRIPT==

I am looking for someone to write me the script to creat the MRTG like
graphs. If my authentication script needs work, I would appreciate any
suggestions. The graphing script needs to take the "Target" name as a
parameter.

If you cannot write the whole script for me, I would appreciate if you
can show me to the correct resources which will allow me to write the
script myself. Please note that I am very [very very] new to PHP. I do
a bit of coding in perl. If the whole authentication/graphing can be
done in perl, that is fine too. If you can modify the 14all.pl script
or similar script, that fine too. Thanks much.

- V.
Answer  
There is no answer at this time.

Comments  
Subject: Re: PHP scrip to generate MRTG graphs using RRDtool database
From: bliptune-ga on 10 Jul 2003 21:23 PDT
 
You asked:  I have MRTG populating the RRDtool databases and I 
also have a user authentication script. I am not able to get a script
which will create the graphs for me. I know that there is a PHP module
for RRD but since I am not knowledgeble in PHP, I don't know if I can
script it. 

--

There is an excellent software package known as ganglia which has a
webfrontend that you can download and examine. It will serve as a
perfect example for what you need to do, if you spend a little time
with it.

I hope this helps. The link is http://ganglia.sourceforge.net/

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy