• R/O
  • HTTP
  • SSH
  • HTTPS

grid-chef-repo: Commit

Grid環境構築用のChefリポジトリです。


Commit MetaInfo

Revisiona13d9979d674de91ce3ea6cc025f6914cd4ab61f (tree)
Time2018-10-08 15:06:11
Authorwhitestar <whitestar@user...>
Commiterwhitestar

Log Message

adds NRPE no ssl support.

Change Summary

Incremental Difference

--- a/cookbooks/nagios-grid/CHANGELOG.md
+++ b/cookbooks/nagios-grid/CHANGELOG.md
@@ -1,6 +1,11 @@
11 nagios-grid CHANGELOG
22 =====================
33
4+0.1.6
5+-----
6+- adds NRPE no ssl support.
7+- adds `/etc/default/nagios-nrpe-server` template.
8+
49 0.1.5
510 -----
611 - bug fix.
--- a/cookbooks/nagios-grid/attributes/default.rb
+++ b/cookbooks/nagios-grid/attributes/default.rb
@@ -100,6 +100,16 @@ default['nagios']['check_ganglia_metric']['enabled'] = false
100100 default['nagios']['check_ganglia_metric']['gmetad_host'] = 'localhost'
101101
102102 # 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+}
103113 default['nagios']['nrpe']['allowed_hosts'] = '127.0.0.1'
104114 default['nagios']['nrpe']['with_smartmontools'] = false
105115 default['nagios']['nrpe']['check_mem.pl'] = {
@@ -107,6 +117,10 @@ default['nagios']['nrpe']['check_mem.pl'] = {
107117 'crit' => '90',
108118 'extra_opts' => '-u', # -u|f, -C
109119 }
120+default['nagios']['nrpe']['check_load'] = {
121+ 'warn' => '15,10,5',
122+ 'crit' => '30,25,20',
123+}
110124 default['nagios']['nrpe']['check_total_procs'] = {
111125 'warn' => '100',
112126 'crit' => '200',
--- a/cookbooks/nagios-grid/recipes/nagios-base.rb
+++ b/cookbooks/nagios-grid/recipes/nagios-base.rb
@@ -35,6 +35,7 @@ when 'debian'
3535 nagios_pkgs = [
3636 # Note: PHP is not php5 but php7.0 in Ubuntu 16.04 or later
3737 'nagios-plugins',
38+ 'nagios-nrpe-plugin',
3839 'nagios-images',
3940 ]
4041
@@ -62,6 +63,8 @@ when 'debian'
6263 httpd_service = 'apache2'
6364 httpd_nagios_conf = "#{root_cfg_dir}/apache2.conf"
6465 when 'rhel'
66+ include_recipe 'yum-epel'
67+
6568 root_cfg_dir = '/etc/nagios'
6669 nagios_pkgs = [
6770 'nagios',
@@ -69,12 +72,11 @@ when 'rhel'
6972 ]
7073
7174 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|
7376 "nagios-plugins-#{item}"
7477 }
7578
7679 if node['nagios']['with_pnp4nagios']
77- include_recipe 'yum-epel'
7880 nagios_pkgs += [
7981 'pnp4nagios',
8082 ]
--- a/cookbooks/nagios-grid/recipes/nagios-nrpe-server.rb
+++ b/cookbooks/nagios-grid/recipes/nagios-nrpe-server.rb
@@ -17,6 +17,7 @@
1717 # limitations under the License.
1818 #
1919
20+platform_family = node['platform_family']
2021 platform = node['platform']
2122 platform_version = node['platform_version']
2223
@@ -26,6 +27,8 @@ pkgs = [
2627 'nagios-plugins-contrib', # for check_memory
2728 ]
2829
30+# https://packages.debian.org/search?keywords=libnagios-plugin-perl
31+# https://packages.ubuntu.com/search?keywords=libnagios-plugin-perl
2932 if (platform == 'debian' && platform_version < '9.0') \
3033 || (platform == 'ubuntu' && platform_version < '17.04')
3134 pkgs += ['libnagios-plugin-perl'] # for check_memory
@@ -60,6 +63,15 @@ template '/etc/nagios/nrpe_local.cfg' do
6063 notifies :reload, 'service[nagios-nrpe-server]'
6164 end
6265
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+
6375 [
6476 'check_logs.pl',
6577 'check_mem.pl',
--- /dev/null
+++ b/cookbooks/nagios-grid/templates/default/etc/default/nagios-nrpe-server
@@ -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+-%>
--- a/cookbooks/nagios-grid/templates/default/etc/nagios/nrpe_local.cfg
+++ b/cookbooks/nagios-grid/templates/default/etc/nagios/nrpe_local.cfg
@@ -1,11 +1,15 @@
11 # This file was generated by Chef.
2+<%
3+conf = node['nagios']['nrpe']
4+-%>
25
3-allowed_hosts=<%= node['nagios']['nrpe']['allowed_hosts'] %>
6+allowed_hosts=<%= conf['allowed_hosts'] %>
47
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'] %>
610 command[check_memory]=/usr/lib/nagios/plugins/check_memory
711 <%
8-mem = node['nagios']['nrpe']['check_mem.pl']
12+mem = conf['check_mem.pl']
913 -%>
1014 command[check_mem]=/usr/lib/nagios/plugins/check_mem.pl <%= mem['extra_opts'] %> -w <%= mem['warn'] %> -c <%= mem['crit'] %>
1115
@@ -14,7 +18,7 @@ command[check_apt]=/usr/lib/nagios/plugins/check_apt
1418 # Disk
1519 <%
1620 (0..3).each {|num|
17- target = node['nagios']['nrpe']["check_disk#{num}"]
21+ target = conf["check_disk#{num}"]
1822 -%>
1923 command[check_disk<%= num %>]=/usr/lib/nagios/plugins/check_disk -w <%= target['warn'] %> -c <%= target['crit']%> -p <%= target['path'] %> <%= target['extra_opts'] %>
2024 <%
@@ -22,7 +26,7 @@ command[check_disk<%= num %>]=/usr/lib/nagios/plugins/check_disk -w <%= target['
2226 -%>
2327 <%
2428 (0..3).each {|num|
25- target = node['nagios']['nrpe']["check_smart#{num}"]
29+ target = conf["check_smart#{num}"]
2630 -%>
2731 command[check_smart<%= num %>]=sudo /usr/lib/nagios/plugins/check_ide_smart -n -d <%= target['device'] %>
2832 <%
@@ -32,9 +36,9 @@ command[check_smart_devs]=sudo /usr/lib/nagios/plugins/check_smart.pl -g '/dev/s
3236
3337 # DNS lookup
3438 <%
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']
3842 -%>
3943 command[check_dig]=/usr/lib/nagios/plugins/check_dig -H <%= dig['host'] %> -l <%= dig['lookup'] %>
4044 command[check_dig_in]=/usr/lib/nagios/plugins/check_dig -H <%= dig_in['host'] %> -l <%= dig_in['lookup'] %>
--- a/cookbooks/nagios-grid/templates/default/etc/nagios3/base/checkcommands-generic.cfg
+++ b/cookbooks/nagios-grid/templates/default/etc/nagios3/base/checkcommands-generic.cfg
@@ -1,4 +1,9 @@
11 # 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+-%>
27
38 define command {
49 command_name check_all_disks_alt
@@ -77,72 +82,72 @@ define command {
7782 # NRPE
7883 define command {
7984 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
8186 }
8287
8388 define command {
8489 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
8691 }
8792
8893 define command {
8994 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
9196 }
9297
9398 define command {
9499 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
96101 }
97102
98103 define command {
99104 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
101106 }
102107
103108 define command {
104109 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
106111 }
107112
108113 define command {
109114 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
111116 }
112117
113118 define command {
114119 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
116121 }
117122
118123 define command {
119124 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
121126 }
122127
123128 define command {
124129 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$
126131 }
127132
128133 define command {
129134 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
131136 }
132137
133138 define command {
134139 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
136141 }
137142
138143 define command {
139144 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
141146 }
142147
143148 define command {
144149 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
146151 }
147152
148153 <%
@@ -150,7 +155,7 @@ define command {
150155 -%>
151156 define command {
152157 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 %>
154159 }
155160
156161 <%
@@ -161,7 +166,7 @@ define command {
161166 -%>
162167 define command {
163168 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 %>
165170 }
166171
167172 <%
@@ -169,66 +174,66 @@ define command {
169174 -%>
170175 define command {
171176 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
173178 }
174179
175180 define command {
176181 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
178183 }
179184
180185 define command {
181186 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
183188 }
184189
185190 define command {
186191 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
188193 }
189194
190195 define command {
191196 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
193198 }
194199
195200 define command {
196201 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
198203 }
199204
200205 define command {
201206 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
203208 }
204209
205210 define command {
206211 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
208213 }
209214
210215 define command {
211216 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
213218 }
214219
215220 define command {
216221 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
218223 }
219224
220225 define command {
221226 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
223228 }
224229
225230 define command {
226231 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
228233 }
229234
230235 define command {
231236 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
233238 }
234239
--- a/cookbooks/nagios-grid/version
+++ b/cookbooks/nagios-grid/version
@@ -1 +1 @@
1-0.1.5
1+0.1.6
Show on old repository browser