Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support
It is currently Thu Dec 18, 2014 5:29 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: MySQL monitoring
PostPosted: Wed Mar 17, 2004 11:50 am 
Offline

Joined: Mon Mar 15, 2004 10:51 am
Posts: 5
Location: Montgeron, France
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


Attachments:
File comment: Script to monitor MySQL
mysql_monitoring.php.txt [1.18 KiB]
Downloaded 2653 times
Top
 Profile  
 
 Post subject: the graph is not working
PostPosted: Sat Apr 17, 2004 6:44 pm 
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


Top
  
 
 Post subject:
PostPosted: Fri Apr 01, 2005 4:18 am 
Offline

Joined: Mon Mar 15, 2004 10:51 am
Posts: 5
Location: Montgeron, France
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


Attachments:
File comment: Host template
cacti_host_template_mysql_monitoring.xml [54.02 KiB]
Downloaded 1819 times
Top
 Profile  
 
 Post subject: Got mysql problems? Read this.
PostPosted: Mon Apr 04, 2005 7:00 pm 
Offline

Joined: Mon Apr 04, 2005 6:54 pm
Posts: 1
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.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 04, 2005 7:26 pm 
Offline
Cacti Moderator
User avatar

Joined: Sat May 08, 2004 12:44 pm
Posts: 11467
Location: USA
how does this script differ from this one? http://forums.cacti.net/viewtopic.php?t=6108

_________________

| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 22, 2005 5:20 am 
Offline
Cacti User
User avatar

Joined: Tue Jun 08, 2004 3:07 am
Posts: 61
Location: Bodø, Norway
Is Questions the amount of questions the last 5 minutes?
What is slow questions?

-Wernicke


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 22, 2005 5:37 am 
Offline
Cacti Guru User
User avatar

Joined: Fri Sep 19, 2003 8:36 am
Posts: 2326
Location: Sophia-Antipolis, France
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...

_________________

HOWTOs :
Templates :


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 11 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