No graph

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
Ruslide
Posts: 3
Joined: Sun Jan 30, 2005 6:58 pm

No graph

Post by Ruslide »

I have installed Cacti. And all work fine. I can see the standard graphs
So i decided to create my script for my graph:

Code: Select all

$hostname = "localhost";
$username = "username";
$password = "password";
$dbname   = "dbname";

$connection = mysql_connect($hostname,$username,$password) or die ("Cannot connect to server.");
$db = mysql_select_db($dbname,$connection) or die ("Could not select database.");

$sql = "SELECT COUNT(DISTINCT session_user_id) FROM nuke_bbsessions WHERE session_time >= ".( time() - 300);  
$output = mysql_result(mysql_query($sql, $connection), 0, "COUNT(DISTINCT session_user_id)");

mysql_close($connection);

echo "$output";
?>
the script works fine too but i am not able to draw the result of this script.
I created a "Data input Methods" then a " Data templates" and a "graph templates".
And after, i created a graph, but The graph never started and i cannot see the grid

Please can i have some help
Thanks
Ruslide
Posts: 3
Joined: Sun Jan 30, 2005 6:58 pm

Post by Ruslide »

(sorry for my poor english)

so, i always had a problem for draw my graph.
In fact I try to create a scpript in php for monitoring the number of user on my forum (phpbb).
I changed a little my script :

/var/www/cacti/scripts/phpbb2.php

Code: Select all

<?php
$hostname = "localhost";
$username = "username";
$password = "password";
$dbname   = "db_test";

$connection = mysql_connect($hostname,$username,$password) or die ("Cannot connect to server.");
$db = mysql_select_db($dbname,$connection) or die ("Could not select database.");

$sql = "SELECT COUNT(DISTINCT session_user_id) FROM nuke_bbsessions WHERE session_time >= ".( time() - 300);  
$output = mysql_result(mysql_query($sql, $connection), 0, "COUNT(DISTINCT session_user_id)");

mysql_close($connection);
$output="users:" . $output . "";
echo "$output";
?>
now the result of the script is : "users:<number> "

I give you the screenshots of my configuration for this script, maybe someone will find where is my mistake.
Attachments
capture3.png
capture3.png (88.33 KiB) Viewed 3431 times
capture2.png
capture2.png (120.15 KiB) Viewed 3431 times
capture1.png
capture1.png (81.15 KiB) Viewed 3431 times
Ruslide
Posts: 3
Joined: Sun Jan 30, 2005 6:58 pm

Post by Ruslide »

Thanks for help
Attachments
capture6.png
capture6.png (100.04 KiB) Viewed 3430 times
capture5.png
capture5.png (110.18 KiB) Viewed 3430 times
capture4.png
capture4.png (113.71 KiB) Viewed 3430 times
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests