mostafamemariani / mysql-cacti-templates

Automatically exported from code.google.com/p/mysql-cacti-templates
GNU General Public License v2.0
0 stars 0 forks source link

ss_get_mysql_stats.php doesn't query heartbeat on the master #126

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. php ss_get_mysql_stats.php --items br --heartbeat db.tbl

What is the expected output? What do you see instead?
I would like to see the current lag but get 'br:-1'

What version of the product are you using? On what operating system?
better-cacti-templates-1.1.6 on centos5

Please provide any additional information below.
Reorganizing the code fixes. This enables checking slave lag on master
and/or slave.
   # Get SHOW SLAVE STATUS, and add it to the $status array.
   if ( $chk_options['slave'] ) {
    if(!$heartbeat){
      //all non heartbeat code here...
    }else{
         # Check replication heartbeat, if present.
         if ( $heartbeat ) {
           //heartbeat code moved here
         }
    }
   }

Original issue reported on code.google.com by stu.he...@gmail.com on 27 Feb 2010 at 6:09

GoogleCodeExporter commented 8 years ago
Sorry, I don't really understand.  Are you saying that the heartbeat is ignored
unless $chk_options[slave] is set?

Original comment by baron.schwartz on 28 Feb 2010 at 5:41

GoogleCodeExporter commented 8 years ago
Removing unused labels.

Original comment by baron.schwartz on 16 Apr 2010 at 2:14

GoogleCodeExporter commented 8 years ago
This error may be related to this (Debug enabled in script):

rovangju@dev:/var/www/tools/cacti/scripts$ php ss_get_mysql_stats.php --host 
xxx --items br,bo --nocache
SQLERR Unknown column 'id' in 'where clause' in SELECT GREATEST(0, 
UNIX_TIMESTAMP() - UNIX_TIMESTAMP(ts) - 1) AS delay FROM maatkit.heartbeat 
WHERE id = 1

~ Line 384, maatkit makes this field `server_id` now instead of `id`. The query 
simply needs to compare on `server_id` instead of `id`

Original comment by thin...@gmail.com on 26 Jul 2011 at 4:56