Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Sun Apr 30, 2017 9:51 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: UpdateÑ The MySQL Graph Collection - Version 2.5.0!
PostPosted: Wed Apr 06, 2011 2:25 pm 
Offline

Joined: Tue Nov 28, 2006 6:44 am
Posts: 24
Location: Akron
Just updated the code to include the query cache hits template!!! Thanks Kyle and

All, Otto is no longer has time to support this template, so I inherited it! Let me know of any changes that might need done. I fixed a few problems with the graphs and now everything works again on 0.8.7g. I also plan to add a port option and some documentation on how to use this template with the cacit CLI.

The code is now here if anybody wants to help with it:
http://code.google.com/p/crunchtools/source/browse/#hg%2Fcacti%2Fgraph_mysql_stats

Best Regards
Scott M


Attachments:
graph_mysql_stats.zip [35.2 KiB]
Downloaded 1148 times
mysql_stats.gif
mysql_stats.gif [ 71.22 KiB | Viewed 13239 times ]

_________________
Scott McCarty
Solutions Architect/Open Source Evangelist
Twitter: @fatherlinux
URL: http://crunchtools.com


Last edited by scottevil on Wed May 30, 2012 2:09 pm, edited 2 times in total.
Top
 Profile  
 
 Post subject: Re: The MySQL Graph Collection - Version 2.0.1!
PostPosted: Sat Apr 30, 2011 9:56 am 
Offline
Cacti User

Joined: Wed Jul 28, 2010 5:05 am
Posts: 153
Location: France
Thanks for the share and to continue the work in this template :)
These files have been exported to a recent version of cacti, more recent than 0.8.7e

Can you convert it ?

_________________
Cacti Version - 0.8.8a
Plugin Architecture - 3.1
Poller Type - spine
Server Info - Linux
Web Server - Apache/2.2.22 (Ubuntu)
PHP - 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli)
MySQL - 5.5.29-0ubuntu0.12.04.2
RRDTool - 1.4.7


Top
 Profile  
 
 Post subject: Re: The MySQL Graph Collection - Version 2.0.1!
PostPosted: Sat Apr 30, 2011 5:34 pm 
Offline

Joined: Tue Nov 28, 2006 6:44 am
Posts: 24
Location: Akron
Oh, that is a problem now. Do you know if there is any easier way to convert them, than to install an older version of cacti and export them from that? I think I could take the originals, patch them and export them in an older version, but not sure if that is the only path.

Best Regards
Scott M

_________________
Scott McCarty
Solutions Architect/Open Source Evangelist
Twitter: @fatherlinux
URL: http://crunchtools.com


Top
 Profile  
 
 Post subject: Re: The MySQL Graph Collection - Version 2.0.1!
PostPosted: Mon May 02, 2011 2:03 am 
Offline
Cacti Guru User

Joined: Thu Aug 05, 2010 2:04 am
Posts: 1573
Location: Japan
Original templates seemed to be exported from Cacti 0.8.7g.
Let's try replacing hash code to your version,
e.g. "hash_xx0021" -> "hash_xx0019".

See also: http://docs.cacti.net/howto:determine_cacti_template_version

For example, converting for 0.8.7e by traditional(?) sed method:
Quote:
% sed -i.bak -e 's/\([<\/*|>|\|]\)hash_\(..\)0021/\1hash_\20019/g' graph_mysql_stats/*.xml

or, more simply:
Quote:
% sed -i.bak -e 's/hash_\(..\)0021/hash_\10019/g' graph_mysql_stats/*.xml

Import results:
(when imported modified 'cacti_graph_template_mysql_command_statistics.xml')
Image

But I'm not sure whether if this converted templates will work (or not) at older version of Cacti.


Top
 Profile  
 
 Post subject: Re: The MySQL Graph Collection - Version 2.0.1!
PostPosted: Mon May 02, 2011 6:51 am 
Offline
Cacti User

Joined: Wed Jul 28, 2010 5:05 am
Posts: 153
Location: France
Whaou great, thanks for the tips :wink:
I test it !

_________________
Cacti Version - 0.8.8a
Plugin Architecture - 3.1
Poller Type - spine
Server Info - Linux
Web Server - Apache/2.2.22 (Ubuntu)
PHP - 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli)
MySQL - 5.5.29-0ubuntu0.12.04.2
RRDTool - 1.4.7


Top
 Profile  
 
 Post subject: Re: The MySQL Graph Collection - Version 2.0.1!
PostPosted: Sun May 08, 2011 8:31 am 
Offline

Joined: Sun May 08, 2011 8:27 am
Posts: 2
Hello,

I tried to create the graphs for my MySQL Server, but only the Query Cache is shown correctly, all the other graphs are not displayed (the image is missing).

I tried to run the script by hand, and it works fine :

Code:
/usr/bin/php -q /var/www/cacti/scripts/mysql_stats.php cache XxX.com cacti_stats XxXx
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/mhash.so' - /usr/lib/php5/20060613+lfs/mhash.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  Cannot load module 'pdo_sqlite' because required module 'pdo' is not loaded in Unknown on line 0
used:17728 available:67091136

/usr/bin/php -q /var/www/cacti/scripts/mysql_stats.php traffic XxX cacti_stats XxXx
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/mhash.so' - /usr/lib/php5/20060613+lfs/mhash.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  Cannot load module 'pdo_sqlite' because required module 'pdo' is not loaded in Unknown on line 0
in:85 out:73


But, only the Query Cache graph is shown... Do you have an idea of what can be the problem ?

Thank you


Top
 Profile  
 
 Post subject: Re: The MySQL Graph Collection - Version 2.0.1!
PostPosted: Sun May 08, 2011 10:34 am 
Offline

Joined: Tue Nov 28, 2006 6:44 am
Posts: 24
Location: Akron
What version are you running? Do you know if you are getting data in the RRD files?

Best Regards

Kedare wrote:
Hello,

I tried to create the graphs for my MySQL Server, but only the Query Cache is shown correctly, all the other graphs are not displayed (the image is missing).

I tried to run the script by hand, and it works fine :

Code:
/usr/bin/php -q /var/www/cacti/scripts/mysql_stats.php cache XxX.com cacti_stats XxXx
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/mhash.so' - /usr/lib/php5/20060613+lfs/mhash.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  Cannot load module 'pdo_sqlite' because required module 'pdo' is not loaded in Unknown on line 0
used:17728 available:67091136

/usr/bin/php -q /var/www/cacti/scripts/mysql_stats.php traffic XxX cacti_stats XxXx
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/mhash.so' - /usr/lib/php5/20060613+lfs/mhash.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  Cannot load module 'pdo_sqlite' because required module 'pdo' is not loaded in Unknown on line 0
in:85 out:73


But, only the Query Cache graph is shown... Do you have an idea of what can be the problem ?

Thank you

_________________
Scott McCarty
Solutions Architect/Open Source Evangelist
Twitter: @fatherlinux
URL: http://crunchtools.com


Top
 Profile  
 
 Post subject: Re: The MySQL Graph Collection - Version 2.0.1!
PostPosted: Sun May 08, 2011 2:35 pm 
Offline

Joined: Sun May 08, 2011 8:27 am
Posts: 2
I'm running Version 0.8.7e. (I can't upgrade for now)

How can I know if the RDD files are getting data ?


Top
 Profile  
 
 Post subject: Re: The MySQL Graph Collection - Version 2.0.1!
PostPosted: Sun May 08, 2011 3:15 pm 
Offline

Joined: Tue Nov 28, 2006 6:44 am
Posts: 24
Location: Akron
That is probably your problem, let me try and install 0.8.7e first and translate this thing, so that it will work with older versions. I will let you know when I am done.

Kedare wrote:
I'm running Version 0.8.7e. (I can't upgrade for now)

How can I know if the RDD files are getting data ?

_________________
Scott McCarty
Solutions Architect/Open Source Evangelist
Twitter: @fatherlinux
URL: http://crunchtools.com


Top
 Profile  
 
 Post subject: Re: The MySQL Graph Collection - Version 2.0.1!
PostPosted: Wed May 18, 2011 9:38 am 
Offline
User avatar

Joined: Sat Nov 17, 2007 3:37 pm
Posts: 38
Location: Atlanta, Ga
This works fine on my local server but fails when connecting to a remote server.

I can connect to the remote via cli:
mysql -h remoteip -user=dbuser --password=dbpw
and run the same commands the script runs:
SHOW STATUS; and SHOW VARIABLES;.

But I cannot connect the remote host using the php script:
$ /usr/bin/php /var/www/html/scripts/mysql_stats.php status remoteip dbuser dbpw Connections
Error: MySQL connect failed. Check MySQL parameters (host/login/password)

I know that my parameters are correct.

select version(); returns:
local MySQL version: 5.0.77
remote MySQL version: 5.0.54a-enterprise-log

Anybody have any idea how to get this to work?


Top
 Profile  
 
 Post subject: Re: The MySQL Graph Collection - Version 2.0.1!
PostPosted: Wed May 18, 2011 10:58 am 
Offline
Cacti Guru User

Joined: Thu Aug 05, 2010 2:04 am
Posts: 1573
Location: Japan
When performed this command, what do you see?
Code:
$ /usr/bin/php -r 'mysql_connect("remoteip", "dbuser", "dbpw");'

If nothing returned (and nothing recorded in your php error log), perhaps it succeeded.
If not so, hmm..


Top
 Profile  
 
 Post subject: Re: The MySQL Graph Collection - Version 2.0.1!
PostPosted: Wed May 18, 2011 11:40 am 
Offline
User avatar

Joined: Sat Nov 17, 2007 3:37 pm
Posts: 38
Location: Atlanta, Ga
noname wrote:
When performed this command, what do you see?
Code:
$ /usr/bin/php -r 'mysql_connect("remoteip", "dbuser", "dbpw");'

If nothing returned (and nothing recorded in your php error log), perhaps it succeeded.
If not so, hmm..


This is what was returned:
PHP Warning: Module 'mysql' already loaded in Unknown on line 0


I can't find the php error log.
'find / -name php.errors' returned nothing.


Top
 Profile  
 
 Post subject: Re: The MySQL Graph Collection - Version 2.0.1!
PostPosted: Wed May 18, 2011 7:49 pm 
Offline
Cacti Guru User

Joined: Thu Aug 05, 2010 2:04 am
Posts: 1573
Location: Japan
jt555 wrote:
PHP Warning: Module 'mysql' already loaded in Unknown on line 0

If the following line exists in your php.ini, then comment out.
Code:
extension=mysql.so --> ;extension=mysql.so
After that, restart Apache (and Mysql).

Probably your PHP binary have already linked MySQL library.
Code:
% ldd /usr/bin/php | grep mysql
        libmysqlclient.so.15 =>  /usr/lib/libmysqlclient.so.15


Top
 Profile  
 
 Post subject: Re: The MySQL Graph Collection - Version 2.0.1!
PostPosted: Fri May 20, 2011 8:52 am 
Offline
User avatar

Joined: Sat Nov 17, 2007 3:37 pm
Posts: 38
Location: Atlanta, Ga
noname wrote:
jt555 wrote:
PHP Warning: Module 'mysql' already loaded in Unknown on line 0

If the following line exists in your php.ini, then comment out.
Code:
extension=mysql.so --> ;extension=mysql.so
After that, restart Apache (and Mysql).

Probably your PHP binary have already linked MySQL library.
Code:
% ldd /usr/bin/php | grep mysql
        libmysqlclient.so.15 =>  /usr/lib/libmysqlclient.so.15



extension=mysql.so is not in my php.ini.
ldd /usr/bin/php | grep mysql returned nothing.


Top
 Profile  
 
 Post subject: Re: The MySQL Graph Collection - Version 2.0.1!
PostPosted: Fri May 20, 2011 9:32 am 
Offline
User avatar

Joined: Sat Nov 17, 2007 3:37 pm
Posts: 38
Location: Atlanta, Ga
Quote:
extension=mysql.so is not in my php.ini.
ldd /usr/bin/php | grep mysql returned nothing.


It works now without making any changes other than a MySQL restart. I think it was a problem with our MySQL server all along.
Thanks for your help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group