]> git.openstreetmap.org Git - chef.git/blob - cookbooks/postgresql/definitions/postgresql_munin.rb
Disable mptsas status reporting for now
[chef.git] / cookbooks / postgresql / definitions / postgresql_munin.rb
1 #
2 # Cookbook Name:: postgresql
3 # Definition:: postgresql_munin
4 #
5 # Copyright 2012, OpenStreetMap Foundation
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #     http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19
20 define :postgresql_munin, :action => :create do
21   cluster = params[:cluster]
22   suffix = cluster.tr("/", ":")
23   database = params[:database]
24
25   if node[:postgresql][:clusters] and node[:postgresql][:clusters][cluster]
26     munin_plugin "postgres_cache_#{database}:#{suffix}" do
27       action params[:action]
28       target "postgres_cache_"
29       conf "munin.erb"
30       conf_cookbook "postgresql"
31       conf_variables :port => node[:postgresql][:clusters][cluster][:port]
32     end
33
34     munin_plugin "postgres_connections_#{database}:#{suffix}" do
35       action params[:action]
36       target "postgres_connections_"
37       conf "munin.erb"
38       conf_cookbook "postgresql"
39       conf_variables :port => node[:postgresql][:clusters][cluster][:port]
40     end
41
42     munin_plugin "postgres_locks_#{database}:#{suffix}" do
43       action params[:action]
44       target "postgres_locks_"
45       conf "munin.erb"
46       conf_cookbook "postgresql"
47       conf_variables :port => node[:postgresql][:clusters][cluster][:port]
48     end
49
50     munin_plugin "postgres_querylength_#{database}:#{suffix}" do
51       action params[:action]
52       target "postgres_querylength_"
53       conf "munin.erb"
54       conf_cookbook "postgresql"
55       conf_variables :port => node[:postgresql][:clusters][cluster][:port]
56     end
57
58     munin_plugin "postgres_scans_#{database}:#{suffix}" do
59       action params[:action]
60       target "postgres_scans_"
61       conf "munin.erb"
62       conf_cookbook "postgresql"
63       conf_variables :port => node[:postgresql][:clusters][cluster][:port]
64     end
65
66     munin_plugin "postgres_size_#{database}:#{suffix}" do
67       action params[:action]
68       target "postgres_size_"
69       conf "munin.erb"
70       conf_cookbook "postgresql"
71       conf_variables :port => node[:postgresql][:clusters][cluster][:port]
72     end
73
74     munin_plugin "postgres_transactions_#{database}:#{suffix}" do
75       action params[:action]
76       target "postgres_transactions_"
77       conf "munin.erb"
78       conf_cookbook "postgresql"
79       conf_variables :port => node[:postgresql][:clusters][cluster][:port]
80     end
81
82     munin_plugin "postgres_tuples_#{database}:#{suffix}" do
83       action params[:action]
84       target "postgres_tuples_"
85       conf "munin.erb"
86       conf_cookbook "postgresql"
87       conf_variables :port => node[:postgresql][:clusters][cluster][:port]
88     end
89   else
90     log "Postgres cluster #{cluster} not found" do
91       level :warn
92     end
93   end
94 end