Grid環境構築用のChefリポジトリです。
修订版 | a13d9979d674de91ce3ea6cc025f6914cd4ab61f (tree) |
---|---|
时间 | 2018-10-08 15:06:11 |
作者 | whitestar <whitestar@user...> |
Commiter | whitestar |
adds NRPE no ssl support.
@@ -1,6 +1,11 @@ | ||
1 | 1 | nagios-grid CHANGELOG |
2 | 2 | ===================== |
3 | 3 | |
4 | +0.1.6 | |
5 | +----- | |
6 | +- adds NRPE no ssl support. | |
7 | +- adds `/etc/default/nagios-nrpe-server` template. | |
8 | + | |
4 | 9 | 0.1.5 |
5 | 10 | ----- |
6 | 11 | - bug fix. |
@@ -100,6 +100,16 @@ default['nagios']['check_ganglia_metric']['enabled'] = false | ||
100 | 100 | default['nagios']['check_ganglia_metric']['gmetad_host'] = 'localhost' |
101 | 101 | |
102 | 102 | # NRPE |
103 | +## command | |
104 | +default['nagios']['check_nrpe']['nossl'] = false | |
105 | +## server | |
106 | +default['nagios']['nrpe']['default'] = { | |
107 | + # expanded in the `/etc/default/nagios-nrpe-server` | |
108 | + #'NRPE_OPTS' => '"-n"', # new env. var. e.g. Ubuntu 18.04 | |
109 | + #'DAEMON_OPTS' => '"--no-ssl"', # old env. var. e.g. Debian 8 | |
110 | + #'NICENESS' = '5', | |
111 | + #'INETD' = '0', | |
112 | +} | |
103 | 113 | default['nagios']['nrpe']['allowed_hosts'] = '127.0.0.1' |
104 | 114 | default['nagios']['nrpe']['with_smartmontools'] = false |
105 | 115 | default['nagios']['nrpe']['check_mem.pl'] = { |
@@ -107,6 +117,10 @@ default['nagios']['nrpe']['check_mem.pl'] = { | ||
107 | 117 | 'crit' => '90', |
108 | 118 | 'extra_opts' => '-u', # -u|f, -C |
109 | 119 | } |
120 | +default['nagios']['nrpe']['check_load'] = { | |
121 | + 'warn' => '15,10,5', | |
122 | + 'crit' => '30,25,20', | |
123 | +} | |
110 | 124 | default['nagios']['nrpe']['check_total_procs'] = { |
111 | 125 | 'warn' => '100', |
112 | 126 | 'crit' => '200', |
@@ -35,6 +35,7 @@ when 'debian' | ||
35 | 35 | nagios_pkgs = [ |
36 | 36 | # Note: PHP is not php5 but php7.0 in Ubuntu 16.04 or later |
37 | 37 | 'nagios-plugins', |
38 | + 'nagios-nrpe-plugin', | |
38 | 39 | 'nagios-images', |
39 | 40 | ] |
40 | 41 |
@@ -62,6 +63,8 @@ when 'debian' | ||
62 | 63 | httpd_service = 'apache2' |
63 | 64 | httpd_nagios_conf = "#{root_cfg_dir}/apache2.conf" |
64 | 65 | when 'rhel' |
66 | + include_recipe 'yum-epel' | |
67 | + | |
65 | 68 | root_cfg_dir = '/etc/nagios' |
66 | 69 | nagios_pkgs = [ |
67 | 70 | 'nagios', |
@@ -69,12 +72,11 @@ when 'rhel' | ||
69 | 72 | ] |
70 | 73 | |
71 | 74 | nagios_pkgs += \ |
72 | - %w(load users ping ssh ntp http disk swap procs file_age).map {|item| | |
75 | + %w(load users ping ssh nrpe ntp http disk swap procs file_age).map {|item| | |
73 | 76 | "nagios-plugins-#{item}" |
74 | 77 | } |
75 | 78 | |
76 | 79 | if node['nagios']['with_pnp4nagios'] |
77 | - include_recipe 'yum-epel' | |
78 | 80 | nagios_pkgs += [ |
79 | 81 | 'pnp4nagios', |
80 | 82 | ] |
@@ -17,6 +17,7 @@ | ||
17 | 17 | # limitations under the License. |
18 | 18 | # |
19 | 19 | |
20 | +platform_family = node['platform_family'] | |
20 | 21 | platform = node['platform'] |
21 | 22 | platform_version = node['platform_version'] |
22 | 23 |
@@ -26,6 +27,8 @@ pkgs = [ | ||
26 | 27 | 'nagios-plugins-contrib', # for check_memory |
27 | 28 | ] |
28 | 29 | |
30 | +# https://packages.debian.org/search?keywords=libnagios-plugin-perl | |
31 | +# https://packages.ubuntu.com/search?keywords=libnagios-plugin-perl | |
29 | 32 | if (platform == 'debian' && platform_version < '9.0') \ |
30 | 33 | || (platform == 'ubuntu' && platform_version < '17.04') |
31 | 34 | pkgs += ['libnagios-plugin-perl'] # for check_memory |
@@ -60,6 +63,15 @@ template '/etc/nagios/nrpe_local.cfg' do | ||
60 | 63 | notifies :reload, 'service[nagios-nrpe-server]' |
61 | 64 | end |
62 | 65 | |
66 | +template '/etc/default/nagios-nrpe-server' do | |
67 | + source 'etc/default/nagios-nrpe-server' | |
68 | + owner 'root' | |
69 | + group 'root' | |
70 | + mode '0644' | |
71 | + notifies :reload, 'service[nagios-nrpe-server]' | |
72 | + only_if { platform_family == 'debian' } | |
73 | +end | |
74 | + | |
63 | 75 | [ |
64 | 76 | 'check_logs.pl', |
65 | 77 | 'check_mem.pl', |
@@ -0,0 +1,29 @@ | ||
1 | +# defaults file for nagios-nrpe-server | |
2 | +# (this file is a /bin/sh compatible fragment) | |
3 | + | |
4 | +# Note: New env. var. e.g. Ubuntu 18.04 | |
5 | +# NRPE_OPTS are any extra cmdline parameters you'd like to pass along to the | |
6 | +# nrpe daemon. | |
7 | +# | |
8 | +# The -n option disables SSL support. | |
9 | +#NRPE_OPTS="-n" | |
10 | + | |
11 | +# Note: Old env. var. e.g. Debian 8 | |
12 | +# DAEMON_OPTS are any extra cmdline parameters you'd like to | |
13 | +# pass along to the nrpe daemon | |
14 | +#DAEMON_OPTS="--no-ssl" | |
15 | + | |
16 | +# NICENESS is if you want to run the server at a different nice() priority. | |
17 | +# (only used by the init script) | |
18 | +#NICENESS=5 | |
19 | + | |
20 | +# INETD is if you want to run the server via inetd (default=0, run as daemon). | |
21 | +# (only used by the init script) | |
22 | +#INETD=0 | |
23 | +<% | |
24 | +node['nagios']['nrpe']['default'].each {|key, value| | |
25 | +-%> | |
26 | +<%= key %>=<%= value %> | |
27 | +<% | |
28 | +} | |
29 | +-%> |
@@ -1,11 +1,15 @@ | ||
1 | 1 | # This file was generated by Chef. |
2 | +<% | |
3 | +conf = node['nagios']['nrpe'] | |
4 | +-%> | |
2 | 5 | |
3 | -allowed_hosts=<%= node['nagios']['nrpe']['allowed_hosts'] %> | |
6 | +allowed_hosts=<%= conf['allowed_hosts'] %> | |
4 | 7 | |
5 | -command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w <%= node['nagios']['nrpe']['check_total_procs']['warn'] %> -c <%= node['nagios']['nrpe']['check_total_procs']['crit'] %> | |
8 | +command[check_load]=/usr/lib/nagios/plugins/check_load -r -w <%= conf['check_load']['warn'] %> -c <%= conf['check_load']['crit'] %> | |
9 | +command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w <%= conf['check_total_procs']['warn'] %> -c <%= conf['check_total_procs']['crit'] %> | |
6 | 10 | command[check_memory]=/usr/lib/nagios/plugins/check_memory |
7 | 11 | <% |
8 | -mem = node['nagios']['nrpe']['check_mem.pl'] | |
12 | +mem = conf['check_mem.pl'] | |
9 | 13 | -%> |
10 | 14 | command[check_mem]=/usr/lib/nagios/plugins/check_mem.pl <%= mem['extra_opts'] %> -w <%= mem['warn'] %> -c <%= mem['crit'] %> |
11 | 15 |
@@ -14,7 +18,7 @@ command[check_apt]=/usr/lib/nagios/plugins/check_apt | ||
14 | 18 | # Disk |
15 | 19 | <% |
16 | 20 | (0..3).each {|num| |
17 | - target = node['nagios']['nrpe']["check_disk#{num}"] | |
21 | + target = conf["check_disk#{num}"] | |
18 | 22 | -%> |
19 | 23 | command[check_disk<%= num %>]=/usr/lib/nagios/plugins/check_disk -w <%= target['warn'] %> -c <%= target['crit']%> -p <%= target['path'] %> <%= target['extra_opts'] %> |
20 | 24 | <% |
@@ -22,7 +26,7 @@ command[check_disk<%= num %>]=/usr/lib/nagios/plugins/check_disk -w <%= target[' | ||
22 | 26 | -%> |
23 | 27 | <% |
24 | 28 | (0..3).each {|num| |
25 | - target = node['nagios']['nrpe']["check_smart#{num}"] | |
29 | + target = conf["check_smart#{num}"] | |
26 | 30 | -%> |
27 | 31 | command[check_smart<%= num %>]=sudo /usr/lib/nagios/plugins/check_ide_smart -n -d <%= target['device'] %> |
28 | 32 | <% |
@@ -32,9 +36,9 @@ command[check_smart_devs]=sudo /usr/lib/nagios/plugins/check_smart.pl -g '/dev/s | ||
32 | 36 | |
33 | 37 | # DNS lookup |
34 | 38 | <% |
35 | -dig = node['nagios']['nrpe']['check_dig'] | |
36 | -dig_in = node['nagios']['nrpe']['check_dig_in'] | |
37 | -dig_ex = node['nagios']['nrpe']['check_dig_ex'] | |
39 | +dig = conf['check_dig'] | |
40 | +dig_in = conf['check_dig_in'] | |
41 | +dig_ex = conf['check_dig_ex'] | |
38 | 42 | -%> |
39 | 43 | command[check_dig]=/usr/lib/nagios/plugins/check_dig -H <%= dig['host'] %> -l <%= dig['lookup'] %> |
40 | 44 | command[check_dig_in]=/usr/lib/nagios/plugins/check_dig -H <%= dig_in['host'] %> -l <%= dig_in['lookup'] %> |
@@ -1,4 +1,9 @@ | ||
1 | 1 | # This file was generated by Chef. |
2 | +<% | |
3 | +nrpe_opts = [] | |
4 | +nrpe_opts.push('-n') if node['nagios']['check_nrpe']['nossl'] | |
5 | +nrpe_opts = nrpe_opts.join(' ') | |
6 | +-%> | |
2 | 7 | |
3 | 8 | define command { |
4 | 9 | command_name check_all_disks_alt |
@@ -77,72 +82,72 @@ define command { | ||
77 | 82 | # NRPE |
78 | 83 | define command { |
79 | 84 | command_name check_remote_apt |
80 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_apt | |
85 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_apt | |
81 | 86 | } |
82 | 87 | |
83 | 88 | define command { |
84 | 89 | command_name check_remote_apc_status |
85 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_apc_status | |
90 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_apc_status | |
86 | 91 | } |
87 | 92 | |
88 | 93 | define command { |
89 | 94 | command_name check_remote_apc_load |
90 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_apc_load | |
95 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_apc_load | |
91 | 96 | } |
92 | 97 | |
93 | 98 | define command { |
94 | 99 | command_name check_remote_apc_bcharge |
95 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_apc_bcharge | |
100 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_apc_bcharge | |
96 | 101 | } |
97 | 102 | |
98 | 103 | define command { |
99 | 104 | command_name check_remote_apc_time |
100 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_apc_time | |
105 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_apc_time | |
101 | 106 | } |
102 | 107 | |
103 | 108 | define command { |
104 | 109 | command_name check_remote_dig |
105 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_dig | |
110 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_dig | |
106 | 111 | } |
107 | 112 | |
108 | 113 | define command { |
109 | 114 | command_name check_remote_dig_in |
110 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_dig_in | |
115 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_dig_in | |
111 | 116 | } |
112 | 117 | |
113 | 118 | define command { |
114 | 119 | command_name check_remote_dig_ex |
115 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_dig_ex | |
120 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_dig_ex | |
116 | 121 | } |
117 | 122 | |
118 | 123 | define command { |
119 | 124 | command_name check_remote_logs |
120 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_logs | |
125 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_logs | |
121 | 126 | } |
122 | 127 | |
123 | 128 | define command { |
124 | 129 | command_name check_remote_command |
125 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ | |
130 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c $ARG1$ | |
126 | 131 | } |
127 | 132 | |
128 | 133 | define command { |
129 | 134 | command_name check_remote_users |
130 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_users | |
135 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_users | |
131 | 136 | } |
132 | 137 | |
133 | 138 | define command { |
134 | 139 | command_name check_remote_load |
135 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_load | |
140 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_load | |
136 | 141 | } |
137 | 142 | |
138 | 143 | define command { |
139 | 144 | command_name check_remote_memory |
140 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_memory | |
145 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_memory | |
141 | 146 | } |
142 | 147 | |
143 | 148 | define command { |
144 | 149 | command_name check_remote_mem |
145 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_mem | |
150 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_mem | |
146 | 151 | } |
147 | 152 | |
148 | 153 | <% |
@@ -150,7 +155,7 @@ define command { | ||
150 | 155 | -%> |
151 | 156 | define command { |
152 | 157 | command_name check_remote_disk<%= num %> |
153 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_disk<%= num %> | |
158 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_disk<%= num %> | |
154 | 159 | } |
155 | 160 | |
156 | 161 | <% |
@@ -161,7 +166,7 @@ define command { | ||
161 | 166 | -%> |
162 | 167 | define command { |
163 | 168 | command_name check_remote_smart<%= num %> |
164 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_smart<%= num %> | |
169 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_smart<%= num %> | |
165 | 170 | } |
166 | 171 | |
167 | 172 | <% |
@@ -169,66 +174,66 @@ define command { | ||
169 | 174 | -%> |
170 | 175 | define command { |
171 | 176 | command_name check_remote_smart_devs |
172 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_smart_devs | |
177 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_smart_devs | |
173 | 178 | } |
174 | 179 | |
175 | 180 | define command { |
176 | 181 | command_name check_remote_zombie_procs |
177 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_zombie_procs | |
182 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_zombie_procs | |
178 | 183 | } |
179 | 184 | |
180 | 185 | define command { |
181 | 186 | command_name check_remote_total_procs |
182 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_total_procs | |
187 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_total_procs | |
183 | 188 | } |
184 | 189 | |
185 | 190 | define command { |
186 | 191 | command_name check_remote_mailq_exim |
187 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_mailq_exim | |
192 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_mailq_exim | |
188 | 193 | } |
189 | 194 | |
190 | 195 | define command { |
191 | 196 | command_name check_remote_mailq_postfix |
192 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_mailq_postfix | |
197 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_mailq_postfix | |
193 | 198 | } |
194 | 199 | |
195 | 200 | define command { |
196 | 201 | command_name check_remote_mysql_heartbeat |
197 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_mysql_heartbeat | |
202 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_mysql_heartbeat | |
198 | 203 | } |
199 | 204 | |
200 | 205 | define command { |
201 | 206 | command_name check_remote_jboss_freemem |
202 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_jboss_freemem | |
207 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_jboss_freemem | |
203 | 208 | } |
204 | 209 | |
205 | 210 | define command { |
206 | 211 | command_name check_remote_jboss_jk_curthread |
207 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_jboss_jk_curthread | |
212 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_jboss_jk_curthread | |
208 | 213 | } |
209 | 214 | |
210 | 215 | define command { |
211 | 216 | command_name check_remote_jboss_ds_conn1 |
212 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_jboss_ds_conn1 | |
217 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_jboss_ds_conn1 | |
213 | 218 | } |
214 | 219 | |
215 | 220 | define command { |
216 | 221 | command_name check_remote_jboss_ds_conn2 |
217 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_jboss_ds_conn2 | |
222 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_jboss_ds_conn2 | |
218 | 223 | } |
219 | 224 | |
220 | 225 | define command { |
221 | 226 | command_name check_remote_jboss_logs |
222 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_jboss_logs | |
227 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_jboss_logs | |
223 | 228 | } |
224 | 229 | |
225 | 230 | define command { |
226 | 231 | command_name check_remote_xen_dom0 |
227 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_xen_dom0 | |
232 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_xen_dom0 | |
228 | 233 | } |
229 | 234 | |
230 | 235 | define command { |
231 | 236 | command_name check_remote_xen_domU1 |
232 | - command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_xen_domU1 | |
237 | + command_line $USER1$/check_nrpe <%= nrpe_opts %> -H $HOSTADDRESS$ -c check_xen_domU1 | |
233 | 238 | } |
234 | 239 |
@@ -1 +1 @@ | ||
1 | -0.1.5 | |
1 | +0.1.6 |