Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


MySQL monitoring

 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
zeguigui



Joined: 15 Mar 2004
Posts: 5
Location: Montgeron, France

PostPosted: Wed Mar 17, 2004 11:50 am    Post subject: MySQL monitoring Reply with quote

Here is a simple PHP script to monitor you MySQL servers.

It monitors questions and slow queries (classical) but also the 4.x Query Cache feature.

To use it simply create a script data input method with command line:

Code:
php -f <path_cacti>/scripts/mysql_monitoring.php


Note: you need to modify the script to set your login, pass and host. You should create a user with only process privileges.

Output fields:

Code:
Questions................ Questions
Slow_queries............. Slow Queries
Qcache_queries_in_cache.. Number of queries registered in the cache
Qcache_inserts........... Number of queries added to the cache
Qcache_hits.............. Number of cache hits
Qcache_not_cached........ Number of non-cached queries
Qcache_free_memory....... Amount of free memory for query cache
Qcache_total_blocks...... Total number of blocks in query cache
Qcache_free_blocks....... Number of free memory blocks in query cache
Qcache_lowmem_prunes..... Requests removed from cache


This script can be easily modified to monitor other STATUS variables like threads and others.

Hope this helps!
Guillaume



mysql_monitoring.php.txt
 Description:
Script to monitor MySQL

Download
 Filename:  mysql_monitoring.php.txt
 Filesize:  1.18 KB
 Downloaded:  1619 Time(s)

Back to top
Guest
Guest





PostPosted: Sat Apr 17, 2004 6:44 pm    Post subject: the graph is not working Reply with quote

Hi! Thanks for your script..
O have some problem with the graphs.. The script is working nice..
I need help with the graph template i think.. because i trying almos anything option there, but the graphs dont show any information.. :/

Can help me with the steps for the graphs?

Thanks!!!

Daniel
Back to top
zeguigui



Joined: 15 Mar 2004
Posts: 5
Location: Montgeron, France

PostPosted: Fri Apr 01, 2005 4:18 am    Post subject: Reply with quote

Here is an host template to go with this mysql monitoring.

Note: some of the items are in french... but it is easy to find the meaning from the datasource!

Template exported from cacti 0.8.6c



cacti_host_template_mysql_monitoring.xml
 Description:
Host template

Download
 Filename:  cacti_host_template_mysql_monitoring.xml
 Filesize:  54.02 KB
 Downloaded:  1192 Time(s)

Back to top
markmaunder



Joined: 04 Apr 2005
Posts: 1

PostPosted: Mon Apr 04, 2005 7:00 pm    Post subject: Got mysql problems? Read this. Reply with quote

Firstly both Cacti and this package rock. I'm just getting into the mysql pack, but looks very very good.

If you're having problems connecting, you may want to change this line in mysql_stats.php:
die("Error: MySQL connect failed. Check MySQL paramete.....

to read like so:

die("Error: MySQL connect failed. Check MySQL parameters (host/login/password)\n" . mysql_error());

That way you will be able to actually see what the mysql error is. In my case it was:

Client does not support authentication protocol requested by server. Consider upgrading MySQL client

And you fix it by running the following command from your mysql client on the host you are trying to connect to:

mysql> SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD('mypass');

That way your older php mysql client will be able to connect to your server.

Hope that helps someone else. Thanks again for a great package.

Mark.
Back to top
BSOD2600
Cacti Moderator


Joined: 08 May 2004
Posts: 9568
Location: WA, USA

PostPosted: Mon Apr 04, 2005 7:26 pm    Post subject: Reply with quote

how does this script differ from this one? http://forums.cacti.net/viewtopic.php?t=6108
Back to top
Wernicke
Cacti User


Joined: 08 Jun 2004
Posts: 60
Location: Bodø, Norway

PostPosted: Thu Sep 22, 2005 5:20 am    Post subject: Reply with quote

Is Questions the amount of questions the last 5 minutes?
What is slow questions?

-Wernicke
Back to top
fmangeant
Cacti Guru User


Joined: 19 Sep 2003
Posts: 2326
Location: Sophia-Antipolis, France

PostPosted: Thu Sep 22, 2005 5:37 am    Post subject: Reply with quote

Wernicke wrote:
Is Questions the amount of questions the last 5 minutes?
What is slow questions?

Hi

the data source for "questions" is a COUNTER, so on the graph you see questions/s on a 5 minutes range. If you want to see total # of questions/5 min, add the CDEF "Make per 5 minute" to the graph.

From http://dev.mysql.com/doc/mysql/en/slow-query-log.html, slow queries are "SQL statements that took more than long_query_time seconds to execute", but I don't know anyhting more...
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group