Permalink
Browse files

[db_mysql] initial changes for a35063 seconds_behind_master

  • Loading branch information...
1 parent 099e2d0 commit 10034e8b962418e211d2ed85cfa1a27ec9238ed9 @lopaka lopaka committed Jan 21, 2012
Showing with 30 additions and 3 deletions.
  1. +12 −3 providers/default.rb
  2. +18 −0 templates/default/collectd-plugin-mysql.conf.erb
View
@@ -328,6 +328,7 @@
end
action :setup_monitoring do
+
service "collectd" do
action :nothing
end
@@ -347,12 +348,20 @@
source TMP_FILE
end
- cookbook_file ::File.join(node[:rs_utils][:collectd_plugin_dir], 'mysql.conf') do
+ if ( node[:db][:init_status] == "uninitialized" )
+ replication_type_line = ""
+ else
+ replication_type_line = node[:db][:this_is_master] == true ? "MasterStats true" : "SlaveStats true"
+ end
+ template ::File.join(node[:rs_utils][:collectd_plugin_dir], 'mysql.conf') do
+ source "collectd-plugin-mysql.conf.erb"
mode "0644"
backup false
- source "collectd-plugin-mysql.conf"
- notifies :restart, resources(:service => "collectd")
cookbook 'db_mysql'
+ variables({
+ :replication_type_entry => replication_type_line
+ })
+ notifies :restart, resources(:service => "collectd")
end
# Send warning if not centos/redhat or ubuntu
@@ -0,0 +1,18 @@
+#
+# Cookbook Name:: db_mysql
+#
+# Copyright RightScale, Inc. All rights reserved. All access and use subject to the
+# RightScale Terms of Service available at http://www.rightscale.com/terms.php and,
+# if applicable, other agreements such as a RightScale Master Subscription Agreement.
+#
+# Managed by RightScale
+# DO NOT EDIT BY HAND
+#
+
+LoadPlugin mysql
+<Plugin mysql>
+ Host "localhost"
+ User "root"
+ Password ""
+ <%= @replication_type_entry %>
+</Plugin>

0 comments on commit 10034e8

Please sign in to comment.