The MySQL Graph Collection - Version 2.0!

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

Moderators: Developers, Moderators

Post Reply
suse
Posts: 23
Joined: Sun Nov 13, 2005 1:05 am

Post by suse »

re-read Readme, I got it works,

Thanks!! :lol:
gttommy
Posts: 25
Joined: Thu Oct 06, 2005 6:52 pm
Contact:

Post by gttommy »

Is there a quick way to monitor the number of rows of a table?
Thx.
Hildebrand
Posts: 18
Joined: Thu Oct 27, 2005 9:24 am
Location: Germany, Bavaria

Post by Hildebrand »

Hello and thanks for this nice script :P

I will use it in our local network on a Debian 3.1 Machine with MySql 4.1
and Cacti 0.8.6g. The Installation is complete and on the shell is everything allright:

Code: Select all


debian:/# /usr/bin/php -q /usr/local/share/cacti/scripts/mysql_stats.php cache localhost myuser mypassword
used:5839072 available:10938144debian:/#

debian:/# /usr/bin/php -q /usr/local/share/cacti/scripts/mysql_stats.php handler localhost myuser mypassword
delete:544514 read_first:23676 read_key:1667449 read_next:1648447 read_prev:13 read_rnd:269712 read_rnd_next:1751137 update:81865 write:670992debian:/#


But in Cacti is only an empty graph.
Here the Cacti Log.

Code: Select all


 11/16/2005 07:05:13 AM - SYSTEM STATS: Time:11.2628 Method:cactid Processes:1 Threads:1 Hosts:36 HostsPerProcess:36 DataSources:338 RRDsProcessed:188
11/16/2005 07:05:02 AM - CACTID: Poller[0] Host[1] DS[294] WARNING: Result from SCRIPT not valid. Partial Result: ...
11/16/2005 07:05:02 AM - CACTID: Poller[0] Host[1] DS[293] WARNING: Result from SCRIPT not valid. Partial Result: ...
11/16/2005 07:05:02 AM - CACTID: Poller[0] Host[1] DS[292] WARNING: Result from SCRIPT not valid. Partial Result: ...

The Cactid runs at this time with root for debug only.
Permissions should be right...

Has anybody an answer? :roll:
thx Hildebrand
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

There are special mysql permissions needed (look at the docs). And remember to provide the full path to the php binary at the Data Input Method.
Reinhard
Hildebrand
Posts: 18
Joined: Thu Oct 27, 2005 9:24 am
Location: Germany, Bavaria

Post by Hildebrand »

thanks for your post! :D
In the Data Input Method is the full path to the php binary set correctly.

Code: Select all

/usr/bin/php -q <path_cacti>/scripts/mysql_stats.php traffic <hostname> <username> <password>
The Permissions in MySQL are right, i copied the Data Input Method in the Shell an set the hostname,password and user manual and it works.

So i modified the Data Input in Cacti for debug without any Input Fields like:

Code: Select all

/usr/bin/php -q /usr/local/share/cacti/scripts/mysql_stats.php command localhost myuser mypw
But still this Problem:

Code: Select all

 11/17/2005 08:20:14 AM - SYSTEM STATS: Time:12.2821 Method:cactid Processes:1 Threads:1 Hosts:37 HostsPerProcess:37 DataSources:343 RRDsProcessed:193
11/17/2005 08:20:13 AM - CACTID: Poller[0] Host[50] DS[302] WARNING: Result from SCRIPT not valid. Partial Result: ...
Is there an Problem with the PHP Script??
On the Shell it works perfect but in Cacit there are no Data... :roll:

thx
Hildebrand
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Which version of cactid? There was a bug with php script_server and multiple values a while ago. To check this out, please switch to cmd.php (at least for a single run) and post your findings.
Reinhard
Hildebrand
Posts: 18
Joined: Thu Oct 27, 2005 9:24 am
Location: Germany, Bavaria

Post by Hildebrand »

Hello,

there is Cacti 0.8.6g with CACTID 0.8.6f running.
Here is the output with the cmd.php poller.

Code: Select all

11/18/2005 08:10:15 AM - SYSTEM STATS: Time:13.5015 Method:cmd.php Processes:1 Threads:N/A Hosts:37 HostsPerProcess:37 DataSources:343 RRDsProcessed:193
11/18/2005 08:10:14 AM - CMDPHP: Poller[0] Host[50] DS[295] WARNING: Result from CMD not valid. Partial Result: Could not open input
11/18/2005 08:10:14 AM - CMDPHP: Poller[0] Host[50] DS[302] WARNING: Result from CMD not valid. Partial Result: Could not open input
11/18/2005 08:10:14 AM - CMDPHP: Poller[0] Host[50] DS[301] WARNING: Result from CMD not valid. Partial Result: Could not open input
11/18/2005 08:10:14 AM - CMDPHP: Poller[0] Host[50] DS[299] WARNING: Result from CMD not valid. Partial Result: Could not open input
11/18/2005 08:10:13 AM - CMDPHP: Poller[0] Host[50] DS[297] WARNING: Result from CMD not valid. Partial Result: Could not open input
11/18/2005 08:10:13 AM - CMDPHP: Poller[0] Host[50] DS[300] WARNING: Result from CMD not valid. Partial Result: Could not open input
11/18/2005 08:10:12 AM - CMDPHP: Poller[0] Host[50] DS[298] WARNING: Result from CMD not valid. Partial Result: Could not open input
11/18/2005 08:10:11 AM - CMDPHP: Poller[0] Host[50] DS[296] WARNING: Result from CMD not valid. Partial Result: Could not open input
Could not open input?? :roll:
thx 4 Help!

Hildebrand
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please, again one run, now under DEBUG settings to see, what script (including the parms) is failing.
Reinhard
Hildebrand
Posts: 18
Joined: Thu Oct 27, 2005 9:24 am
Location: Germany, Bavaria

Post by Hildebrand »

Allright - here it is :P

Code: Select all

 11/18/2005 04:30:09 PM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q /usr/share/cacti/site/poller_export.php]
11/18/2005 04:30:09 PM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q /usr/share/cacti/site/poller_commands.php]
11/18/2005 04:30:09 PM - SYSTEM STATS: Time:7.3851 Method:cmd.php Processes:1 Threads:N/A Hosts:37 HostsPerProcess:37 DataSources:343 RRDsProcessed:197
11/18/2005 04:30:09 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /usr/share/cacti/site/rra/mysqlserver_value_300.rrd --template value 1132327802:U
11/18/2005 04:30:09 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /usr/share/cacti/site/rra/mysqlserver_write_297.rrd --template 1132327802:U
11/18/2005 04:30:09 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /usr/share/cacti/site/rra/mysqlserver_questions_299.rrd --template questions 1132327802:U
11/18/2005 04:30:09 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /usr/share/cacti/site/rra/mysqlserver_traffic_in_302.rrd --template 1132327802:U
11/18/2005 04:30:09 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /usr/share/cacti/site/rra/mysqlserver_connected_301.rrd --template 1132327802:U
11/18/2005 04:30:09 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /usr/share/cacti/site/rra/mysqlserver_delete_295.rrd --template 1132327802:U
11/18/2005 04:30:08 PM - CMDPHP: Poller[0] Time: 6.7512 s, Theads: N/A, Hosts: 36
11/18/2005 04:30:08 PM - PHPSVR: Poller[0] DEBUG: PHP Script Server Shutdown request received, exiting
11/18/2005 04:30:08 PM - CMDPHP: Poller[0] Host[50] DS[295] CMD: /usr/bin/php -q /usr/share/cacti/site/scripts/mysql_stats.php command 127.0.0.1 stats stats, output: U
11/18/2005 04:30:08 PM - CMDPHP: Poller[0] Host[50] DS[295] WARNING: Result from CMD not valid. Partial Result: Error: MySQL connect
11/18/2005 04:30:08 PM - CMDPHP: Poller[0] Host[50] DS[302] CMD: /usr/bin/php -q /usr/share/cacti/site/scripts/mysql_stats.php traffic 127.0.0.1 stats stats, output: U
11/18/2005 04:30:08 PM - CMDPHP: Poller[0] Host[50] DS[302] WARNING: Result from CMD not valid. Partial Result: Error: MySQL connect
11/18/2005 04:30:08 PM - CMDPHP: Poller[0] Host[50] DS[301] CMD: /usr/bin/php -q /usr/share/cacti/site/scripts/mysql_stats.php thread 127.0.0.1 stats stats, output: U
11/18/2005 04:30:08 PM - CMDPHP: Poller[0] Host[50] DS[301] WARNING: Result from CMD not valid. Partial Result: Error: MySQL connect
11/18/2005 04:30:08 PM - CMDPHP: Poller[0] Host[50] DS[299] CMD: /usr/bin/php -q /usr/share/cacti/site/scripts/mysql_stats.php status 127.0.0.1 stats stats Questions, output: U
11/18/2005 04:30:08 PM - CMDPHP: Poller[0] Host[50] DS[299] WARNING: Result from CMD not valid. Partial Result: Error: MySQL connect
11/18/2005 04:30:08 PM - CMDPHP: Poller[0] Host[50] DS[297] CMD: /usr/bin/php -q /usr/share/cacti/site/scripts/mysql_stats.php handler 127.0.0.1 stats stats, output: U
11/18/2005 04:30:08 PM - CMDPHP: Poller[0] Host[50] DS[297] WARNING: Result from CMD not valid. Partial Result: Error: MySQL connect
11/18/2005 04:30:08 PM - CMDPHP: Poller[0] Host[50] DS[300] CMD: /usr/bin/php -q /usr/share/cacti/site/scripts/mysql_stats.php status 127.0.0.1 stats stats, output: U
11/18/2005 04:30:08 PM - CMDPHP: Poller[0] Host[50] DS[300] WARNING: Result from CMD not valid. Partial Result: Error: MySQL connect
...
...
...
 11/18/2005 04:30:02 PM - CMDPHP: Poller[0] PHP Script Server Started Properly
11/18/2005 04:30:02 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is cmd
11/18/2005 04:30:02 PM - PHPSVR: Poller[0] DEBUG: FILENM: /usr/share/cacti/site/script_server.php
11/18/2005 04:30:02 PM - PHPSVR: Poller[0] DEBUG: DIRNAM: /usr/share/cacti/site
11/18/2005 04:30:02 PM - PHPSVR: Poller[0] DEBUG: GETCWD: /root
11/18/2005 04:30:02 PM - PHPSVR: Poller[0] DEBUG: SERVER: cmd
11/18/2005 04:30:02 PM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q /usr/share/cacti/site/cmd.php 0 50]
MySQL Connect Error?? Why?
Output: U ??

Here is the shell:

Code: Select all

debian:/# /usr/bin/php -q /usr/share/cacti/site/scripts/mysql_stats.php command localhost stats stats
change_db:2212 delete:84737 insert:11338 select:33297 update:9930debian:/# /usr/bin/php -q /usr/share/cacti/site/scripts/mysql_stats.php command localhost statsdebian:/# /usr/bin/php -q /usr/share/cacti/site/scripts/mysql_stats.php command 127.0.0.1 stats stats
Error: MySQL connect failed. Check MySQL parameters (host/login/password)
debian:/# /usr/bin/php -q /usr/local/share/cacti/scripts/mysql_stats.php command localhost stats stats
When i use "localhost" and NOT "127.0.0.1" it will work in the shell!
But not in Cacti :roll:

thx Hildebrand
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

cacti uses 127.0.0.1 as of your logs. So it fails (it won't work better than shell). Change e.g. your localhost hostname to localhost instead of 127.0.0.1 in the Device screen? But it is definitely a mysql permission issue...
Reinhard
Hildebrand
Posts: 18
Joined: Thu Oct 27, 2005 9:24 am
Location: Germany, Bavaria

Post by Hildebrand »

Hy Reinhard,

it works now :P
The problem was the "127.0.0.1" in the Device Screen.
Is setup "localhost" and it works!

Thx 4 your good work!
Hildebrand
schef4711
Posts: 19
Joined: Tue Jul 12, 2005 1:49 pm
Location: Argentina
Contact:

other problem with Mysql

Post by schef4711 »

Hi,

I have also some problems with the MySQL scripts. The connect works I think but I don't get any result in the graphs. I only get the following lines in the logfile (DEBUG modus) :

12/01/2005 10:15:13 PM - CMDPHP: Poller[0] Host[27] DS[374] WARNING: Result from CMD not valid. Partial Result:
12/01/2005 10:15:13 PM - CMDPHP: Poller[0] Host[27] DS[374] CMD: /usr/bin/php -q /usr/share/webapps/cacti/0.8.6f-r1/htdocs/scripts/mysqli_stats.php status hostname username password Questions, output: U
12/01/2005 10:15:14 PM - CMDPHP: Poller[0] Host[27] DS[375] WARNING: Result from CMD not valid. Partial Result:
12/01/2005 10:15:14 PM - CMDPHP: Poller[0] Host[27] DS[375] CMD: /usr/bin/php -q /usr/share/webapps/cacti/0.8.6f-r1/htdocs/scripts/mysqli_stats.php thread hostname username password, output: U

This are only some lines but each statistic has the same problem with "output: U". The hostname/username/password is crunched with normal words.

The hostname is in my case the real name of the host (like ix1266.domain.tld) and not localhost, but also with localhost the messages are the same.

I use the following system :

Gentoo 2005
PHP 4.4.0
Cacti 0.8.6f-r1
Apache 2.0.54-r31
MySql 4.1.14

So there isn't any problem with the rights I think because if there is anythink like this - as in the begin - there would be other error messages in the Debug-Log.

Maybe anyone can help me for this problem.

cu alex
schef4711
Posts: 19
Joined: Tue Jul 12, 2005 1:49 pm
Location: Argentina
Contact:

other problem with Mysql

Post by schef4711 »

Hello again,

so after a good night with some drinks I got the result ;o) The problem is if you use PHP 4.4 you MUST use the old mysql_stats.php script and not the new mysqli_stats.php

So be carefully :

PHP 4.x --> mysql_stats.php
PHP 5.x --> mysqli_stats.php

So now it works - thanks for the nice scripts

bye alex
lozzd
Posts: 30
Joined: Thu Dec 08, 2005 7:13 pm
Contact:

Post by lozzd »

Hey,

I'd like to use this script as mentioned earlier, when i try to paste the file or import the file the page just reloads without any errors or anything.

Is there a fix to this problem?

Thanks very much
Laurie

EDIT: Ignore this completly. Ubuntu has a really really old version in the apt-get. And now I've upgraded, which was apparently successful, but now viewgraph.php returns a blank page. Bugger.
moonzar
Posts: 9
Joined: Fri Dec 09, 2005 3:00 pm

Unit

Post by moonzar »

Hello,

Thanks for these graphic, work fine on my side.

What the lower case "m" unit mean in the mysql graph ? I guess this milli unit.

BTW what is a access units ?

I thought a access units was one select, one delete...

But how could we have decimal like 3.5 access units ? Does this mean a query was a half unit ? Doesn't make sense to me. Or maybe this because some query take more time to run from other ?

You could have a select who take 2.5 access unit and one who take 1 access unit.

Does someone can help me to understand this ?

Thanks again,

MoonZar
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests