Skip to content
This repository has been archived by the owner on Jul 11, 2020. It is now read-only.

Commit

Permalink
add some postgres checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dwradcliffe committed Aug 7, 2014
1 parent b5df487 commit b5cf4d2
Show file tree
Hide file tree
Showing 6 changed files with 10,604 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Berksfile.lock
Expand Up @@ -286,7 +286,7 @@ GRAPH
nginx (>= 0.0.0)
rubygems (>= 0.0.0)
rubygems-ruby (0.0.1)
rubygems-sensu (0.0.72)
rubygems-sensu (0.0.73)
chef-vault (>= 0.0.0)
sensu (>= 0.0.0)
rubygems-ssh (0.0.4)
Expand Down
10,572 changes: 10,572 additions & 0 deletions cookbooks/rubygems-sensu/files/default/check_postgres.pl

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cookbooks/rubygems-sensu/metadata.rb
@@ -1,7 +1,7 @@
name 'rubygems-sensu'
maintainer 'RubyGems.org ops team'

version '0.0.72'
version '0.0.73'

depends 'chef-vault'
depends 'sensu'
Expand Down
2 changes: 1 addition & 1 deletion cookbooks/rubygems-sensu/recipes/base.rb
Expand Up @@ -9,7 +9,7 @@

package 'nagios-plugins'

%w( check-procs.rb ).each do |plugin|
%w( check-procs.rb check_postgres.pl ).each do |plugin|
cookbook_file "/etc/sensu/plugins/#{plugin}" do
source plugin
path "/etc/sensu/plugins/#{plugin}"
Expand Down
28 changes: 28 additions & 0 deletions cookbooks/rubygems-sensu/recipes/database.rb
@@ -0,0 +1,28 @@
#
# Cookbook Name:: rubygems-sensu
# Recipe:: database
#

sensu_check 'check_postgres_proc' do
command "/opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-procs.rb -p 'postgres -D'"
handlers ['slack', 'pagerduty']
subscribers ['database']
interval 30
additional(notification: 'postgres is not running', occurences: 3)
end

sensu_check 'check_postgres_connection' do
command "perl check_postgres.pl --action connection -db rubygems_#{node.chef_environment}"
handlers ['slack', 'pagerduty']
subscribers ['database']
interval 30
additional(occurences: 3)
end

sensu_check 'check_postgres_backends' do
command "perl check_postgres.pl --action backends -db rubygems_#{node.chef_environment}"
handlers ['slack', 'pagerduty']
subscribers ['database']
interval 30
additional(occurences: 3)
end
1 change: 1 addition & 0 deletions cookbooks/rubygems-sensu/recipes/default.rb
Expand Up @@ -32,4 +32,5 @@
include_recipe 'rubygems-sensu::balancer'
include_recipe 'rubygems-sensu::app'
include_recipe 'rubygems-sensu::nginx'
include_recipe 'rubygems-sensu::database'
include_recipe 'sensu::client_service'

0 comments on commit b5cf4d2

Please sign in to comment.