Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[db_mysql] initial changes for a35063 seconds_behind_master

  • Loading branch information...
commit 10034e8b962418e211d2ed85cfa1a27ec9238ed9 1 parent 099e2d0
Lopaka Delp authored January 20, 2012
15  providers/default.rb
@@ -328,6 +328,7 @@
328 328
 end
329 329
 
330 330
 action :setup_monitoring do
  331
+
331 332
   service "collectd" do
332 333
     action :nothing
333 334
   end
@@ -347,12 +348,20 @@
347 348
     source TMP_FILE
348 349
   end
349 350
 
350  
-  cookbook_file ::File.join(node[:rs_utils][:collectd_plugin_dir], 'mysql.conf') do
  351
+  if ( node[:db][:init_status] == "uninitialized" )
  352
+     replication_type_line = ""
  353
+  else 
  354
+     replication_type_line = node[:db][:this_is_master] == true ? "MasterStats true" : "SlaveStats true"
  355
+  end
  356
+  template ::File.join(node[:rs_utils][:collectd_plugin_dir], 'mysql.conf') do
  357
+    source "collectd-plugin-mysql.conf.erb"
351 358
     mode "0644"
352 359
     backup false
353  
-    source "collectd-plugin-mysql.conf"
354  
-    notifies :restart, resources(:service => "collectd")
355 360
     cookbook 'db_mysql'
  361
+    variables({
  362
+      :replication_type_entry => replication_type_line
  363
+    })
  364
+    notifies :restart, resources(:service => "collectd")
356 365
   end
357 366
 
358 367
   # Send warning if not centos/redhat or ubuntu
18  templates/default/collectd-plugin-mysql.conf.erb
... ...
@@ -0,0 +1,18 @@
  1
+# 
  2
+# Cookbook Name:: db_mysql
  3
+#
  4
+# Copyright RightScale, Inc. All rights reserved.  All access and use subject to the
  5
+# RightScale Terms of Service available at http://www.rightscale.com/terms.php and,
  6
+# if applicable, other agreements such as a RightScale Master Subscription Agreement.
  7
+# 
  8
+# Managed by RightScale
  9
+# DO NOT EDIT BY HAND
  10
+#
  11
+
  12
+LoadPlugin mysql
  13
+<Plugin mysql>
  14
+  Host "localhost"
  15
+  User "root"
  16
+  Password ""
  17
+  <%= @replication_type_entry %>
  18
+</Plugin>

0 notes on commit 10034e8

Please sign in to comment.
Something went wrong with that request. Please try again.