Skip to content

Commit

Permalink
Merge pull request #43 from srodrig0209/percona-monitoring
Browse files Browse the repository at this point in the history
Integrating the 'monitoring' recipe
  • Loading branch information
phlipper committed Feb 25, 2013
2 parents 71ce8d6 + ad26d13 commit bb78c6c
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 2 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down
22 changes: 22 additions & 0 deletions attributes/monitoring.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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"
41 changes: 41 additions & 0 deletions recipes/monitoring.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bb78c6c

Please sign in to comment.