Skip to content

Commit

Permalink
Monitor prepared statement usage
Browse files Browse the repository at this point in the history
  • Loading branch information
jblackburn22 committed Oct 30, 2013
1 parent 5f1f9a3 commit 5c91239
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions plugins/mysql/mysql-graphite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def run
'Open_files' => 'openFiles',
'Open_tables' => 'openTables',
'Opened_tables' => 'openedTables',
'Prepared_stmt_count' => 'preparedStmtCount',
'Seconds_Behind_Master' => 'slaveLag',
'Select_full_join' => 'fullJoins',
'Select_full_range_join' => 'fullRangeJoins',
Expand Down Expand Up @@ -167,6 +168,9 @@ def run
'Innodb_rows_read' => 'rowsRead',
'Innodb_rows_deleted' => 'rowsDeleted',
'Innodb_rows_inserted' => 'rowsInserted'
},
'configuration' => {
'Max_prepared_stmt_count' => 'MaxPreparedStmtCount'
}
}

Expand Down Expand Up @@ -208,6 +212,21 @@ def run
puts "Error querying slave status: #{e}" if config[:verbose]
end

begin
variables_results = mysql.query("SHOW GLOBAL VARIABLES")

category = 'configuration'
variables_results.each do |row|
metrics[category].each do |metric, desc|
if metric.casecmp(row["Variable_name"]) == 0
output "#{config[:scheme]}.#{category}.#{desc}", row["Value"]
end
end
end
rescue => e
puts e.message
end

ok

end
Expand Down

0 comments on commit 5c91239

Please sign in to comment.