From e49bd78d8b04938adb30920aa3a44f33a8a24898 Mon Sep 17 00:00:00 2001 From: Sergio Rodriguez Date: Wed, 20 Feb 2013 17:38:02 -0500 Subject: [PATCH 1/4] Imported customink-webops/percona-install monitoring recipe and attributes file. --- attributes/monitoring.rb | 23 ++++++++++++++++++++++ recipes/monitoring.rb | 41 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 attributes/monitoring.rb create mode 100644 recipes/monitoring.rb diff --git a/attributes/monitoring.rb b/attributes/monitoring.rb new file mode 100644 index 00000000..704a3391 --- /dev/null +++ b/attributes/monitoring.rb @@ -0,0 +1,23 @@ +# Cookbook Name:: percona +# Attributes:: monitoring +# +# Copyright 2012, CX Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +default['percona']['plugins_url'] = "http://www.percona.com/downloads/percona-monitoring-plugins/" +default['percona']['plugins_version'] = "1.0.2" +default['percona']['plugins_sha'] = "da84cfe89637292da15ddb1e66f67ad9703fa21392d8d49e664ad08f7aa45585" +default['percona']['plugins_path'] = "/opt/pmp" +# default['percona']['plugins_nagios'] = "/opt/pmp/nagios/bin" diff --git a/recipes/monitoring.rb b/recipes/monitoring.rb new file mode 100644 index 00000000..57542ad0 --- /dev/null +++ b/recipes/monitoring.rb @@ -0,0 +1,41 @@ +# Cookbook Name:: percona +# Recipe:: monitoring +# +# Copyright 2012, CX Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +percona_plugins_tarball = "percona-monitoring-plugins-#{node['percona']['plugins_version']}.tar.gz" +percona_plugins_url = "#{node['percona']['plugins_url']}/#{percona_plugins_tarball}" + +directory "percona_plugins_dir" do + path node['percona']['plugins_path'] + owner "root" + group "root" + mode 0755 +end + +execute "percona-extract-plugins" do + command "tar zxf #{Chef::Config[:file_cache_path]}/#{percona_plugins_tarball} --strip-components 2 -C #{node['percona']['plugins_path']}" + creates "#{node['percona']['plugins_path']}/COPYING" + only_if do File.exist?("#{Chef::Config[:file_cache_path]}/#{percona_plugins_tarball}") end + action :run +end + +remote_file "#{Chef::Config[:file_cache_path]}/#{percona_plugins_tarball}" do + source percona_plugins_url + mode 0644 + checksum node['percona']['plugins_sha'] + notifies :run, "execute[percona-extract-plugins]", :immediately +end From 05b0402deb7c6937fca9faf706353f4b913dc2e6 Mon Sep 17 00:00:00 2001 From: Sergio Rodriguez Date: Wed, 20 Feb 2013 17:44:11 -0500 Subject: [PATCH 2/4] This attribute isn't used in installing the percona monitoring plugins. --- attributes/monitoring.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/attributes/monitoring.rb b/attributes/monitoring.rb index 704a3391..25468655 100644 --- a/attributes/monitoring.rb +++ b/attributes/monitoring.rb @@ -19,5 +19,4 @@ default['percona']['plugins_url'] = "http://www.percona.com/downloads/percona-monitoring-plugins/" default['percona']['plugins_version'] = "1.0.2" default['percona']['plugins_sha'] = "da84cfe89637292da15ddb1e66f67ad9703fa21392d8d49e664ad08f7aa45585" -default['percona']['plugins_path'] = "/opt/pmp" -# default['percona']['plugins_nagios'] = "/opt/pmp/nagios/bin" +default['percona']['plugins_path'] = "/opt/pmp" \ No newline at end of file From 781ba5a7a3934c17a08e1a608f30c09f12366906 Mon Sep 17 00:00:00 2001 From: Sergio Rodriguez Date: Mon, 25 Feb 2013 11:39:46 -0500 Subject: [PATCH 3/4] Add 'monitoring' recipe to README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6580cb8f..184b1ee9 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Installs the [Percona MySQL](http://www.percona.com/software/percona-server) cli * [XtraBackup](http://www.percona.com/software/percona-xtrabackup/) hot backup software * [Percona Toolkit](http://www.percona.com/software/percona-toolkit/) advanced command-line tools * [XtraDB Cluster](http://www.percona.com/software/percona-xtradb-cluster/) high availability and high scalability solution for MySQL - +* [Percona Monitoring Plugins](http://www.percona.com/software/percona-monitoring-plugins) various Nagios plugins for monitoring MySQL ## Requirements @@ -47,7 +47,7 @@ It is recommended to use a version of Chef `>= 10.16.4` as that is the target of * `percona::configure_server` - Used internally to manage the server configuration. * `percona::replication` - Used internally to grant permissions for replication. * `percona::access_grants` - Used internally to grant permissions for recipes. - +* `percona::monitoring` - Installs Percona monitoring plugins for Nagios ## Usage From ad26d13149967ab6cbb0731ad428aba8039dbcd8 Mon Sep 17 00:00:00 2001 From: Sergio Rodriguez Date: Mon, 25 Feb 2013 11:50:30 -0500 Subject: [PATCH 4/4] Add list of 'monitoring' attributes to README --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 184b1ee9..e0d32fa0 100644 --- a/README.md +++ b/README.md @@ -217,6 +217,15 @@ default["percona"]["cluster"]["innodb_locks_unsafe_for_binlog"] = 1 default["percona"]["cluster"]["innodb_autoinc_lock_mode"] = 2 ``` +### Monitoring.rb + +```ruby +default['percona']['plugins_url'] = "http://www.percona.com/downloads/percona-monitoring-plugins/" +default['percona']['plugins_version'] = "1.0.2" +default['percona']['plugins_sha'] = "da84cfe89637292da15ddb1e66f67ad9703fa21392d8d49e664ad08f7aa45585" +default['percona']['plugins_path'] = "/opt/pmp" +``` + ## Explicit my.cnf templating In some situation it is preferable to explicitly define the attributes needed in a `my.cnf` file. This is enabled by adding categories to the `node[:percona][:conf]` attributes. All keys found in the `node[:percona][:conf]` map will represent categories in the `my.cnf` file. Each category contains a map of attributes that will be written to the `my.cnf` file for that category. See the example for more details.