The MySQL Graph Collection

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

Moderators: Developers, Moderators

ottob
Cacti User
Posts: 51
Joined: Tue Apr 27, 2004 11:43 am
Location: Duesseldorf, Germany
Contact:

Post by ottob »

Hi,
Anonymous wrote:i0ve put scripts in "cacti path/scripts/"
This seems to be right... But...
Anonymous wrote:i've put XML files in "cacti path/resources/mysql_queries"
The XML-Files are the import-files! Use the "import-templates"-function inside the web-interface to install the templates from the xml-files...

Otto
chicago
Posts: 19
Joined: Fri Jul 09, 2004 9:52 am
Contact:

Post by chicago »

nice script and stats!

so how do i use the stats to help tune my server ?
ottob
Cacti User
Posts: 51
Joined: Tue Apr 27, 2004 11:43 am
Location: Duesseldorf, Germany
Contact:

Post by ottob »

Hi!

there are many ways to tune your server using this stats - take a look here:

http://dev.mysql.com/doc/mysql/en/Serve ... ables.html

or maybe in german: :wink:
http://dev.mysql.com/doc/mysql/de/SHOW_STATUS.html

there you will find useful descriptions of the values that are beeing graphed...

For example:
Handler_read_key
The number of requests to read a row based on a key. If this is high, it is a good indication that your queries and tables are properly indexed.
chicago
Posts: 19
Joined: Fri Jul 09, 2004 9:52 am
Contact:

Post by chicago »

Thanks

That helped me a lot!
:)
Roderik
Posts: 6
Joined: Sun Dec 07, 2003 1:22 pm

Post by Roderik »

yeah! it works great!

one little "bug" so to speak

you're script uses short open tags (<?) where the current php default is no short open tags allowed (<?php). So i had to eigter put "on" in the php.ini or change the scripts to <?php.
guest

Great Scripts

Post by guest »

ottob, well done these are some great scripts, and was exactly what my team and I were after to monitor our SQL servers. You have done really well. The instructions were clear and the trouble shooting through the forum were easy follow

Thanks Mate
oharel
Cacti User
Posts: 84
Joined: Wed Jan 07, 2004 11:16 am

Post by oharel »

Hi everyone,

when trying:
php -q /var/www/htdocs/cacti/scripts/mysql_stat.php localhost cacti *** Connections, i got:
PHP Notice: Undefined variable: argv in /var/www/htdocs/cacti-0.8.5a/scripts/mysql_stat.php on line 4
PHP Notice: Undefined variable: argv in /var/www/htdocs/cacti-0.8.5a/scripts/mysql_stat.php on line 5
PHP Notice: Undefined variable: argv in /var/www/htdocs/cacti-0.8.5a/scripts/mysql_stat.php on line 6
PHP Notice: Undefined variable: argv in /var/www/htdocs/cacti-0.8.5a/scripts/mysql_stat.php on line 8
PHP Notice: Undefined index: in /var/www/htdocs/cacti-0.8.5a/scripts/mysql_stat.php on line 16

of-course, cacti does not generate any graph, but in Graph management debug i see (for example):
RRDTool Says:

ERROR: can't parse '#FF6044:Read First'

any idea, anyone?

harel
ottob
Cacti User
Posts: 51
Joined: Tue Apr 27, 2004 11:43 am
Location: Duesseldorf, Germany
Contact:

Post by ottob »

Hi,

sorry i have no idea at the moment. The php-Code is definitely correct.

Which php-Version are you using? If you are using 4.2.0 be sure that you used the "--enable-cli" flag while compiling...
oharel
Cacti User
Posts: 84
Joined: Wed Jan 07, 2004 11:16 am

Post by oharel »

Hi Ottob

i am using PHP/4.3.3

does that give any clue?
User avatar
jshanley
Posts: 11
Joined: Fri Jul 30, 2004 7:39 pm

Cactid?

Post by jshanley »

Probably not, but could I use this script with cactid? It is soooo much faster than the cmd.php method of polling (:o), that it would make me sad to go back.
ottob
Cacti User
Posts: 51
Joined: Tue Apr 27, 2004 11:43 am
Location: Duesseldorf, Germany
Contact:

Post by ottob »

actually, i dont know!

i will test cactid when the next release of cacti is coming out. maybe you can give me an response when it works...

otto

@oharel

i've no idea... Are the other scripts working?
oharel
Cacti User
Posts: 84
Joined: Wed Jan 07, 2004 11:16 am

Post by oharel »

yes, other scripts seem to be fine :-?

-harel
Sandello

Post by Sandello »

ohrael - Enable support for argv/argc in your php.ini
ottob - <? and ?> short tags aren't supported on every server, so to get more compatibility use <?php and ?>
Sandello

Post by Sandello »

Oh, and one more suggestion: perhaps, it would be... er... it would look nicer, if you'll use a mysql-handle for connection/queries/et cetera.
E.g.:

Code: Select all

$sql = mysql_connect($host, $username, $password) or die ("0");
$res_stat = mysql_query("SHOW STATUS", $sql) or die("0");
mysql_close($sql);
Thanks.[/code]
oharel
Cacti User
Posts: 84
Joined: Wed Jan 07, 2004 11:16 am

Post by oharel »

Thanks guys! it is working :) i enabled "register_argc_argv = ON"
as for the code, Sandello, i am no programmer, so if you could be more specific as to where to put the code, it would be excellent. this is what the scripts contain right now:

Code: Select all

mysql_connect($host, $username, $password) or die ("0");
$res_stat = mysql_query("SHOW STATUS") or die("0");
while ($fld_stat = mysql_fetch_row($res_stat)) {
    $status[$fld_stat[0]] = $fld_stat[1];
so in fact the last line:

Code: Select all

mysql_close($sql);
is not there. what does it do and where to place it?

-harel
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest