Grid環境構築用のChefリポジトリです。
Revision | c48fd5ff6c415e90cb2b0ef881d85ead8e2147cb (tree) |
---|---|
Zeit | 2022-01-05 22:30:48 |
Autor | whitestar <whitestar@user...> |
Commiter | whitestar |
add check swap usage flag for localhost.
@@ -1,6 +1,10 @@ | ||
1 | 1 | nagios-grid CHANGELOG |
2 | 2 | ===================== |
3 | 3 | |
4 | +0.3.0 | |
5 | +----- | |
6 | +- add check swap usage flag for localhost. | |
7 | + | |
4 | 8 | 0.2.0 |
5 | 9 | ----- |
6 | 10 | - add Nagios4 support. |
@@ -50,6 +50,7 @@ None. | ||
50 | 50 | |`['nagios']['web']['mod_auth_kerb']['Krb5Keytab']`|String||`'/etc/krb5.keytab'`| |
51 | 51 | |`['nagios']['web']['mod_auth_kerb']['KrbMethodNegotiate']`|String||`'on'`| |
52 | 52 | |`['nagios']['web']['mod_auth_kerb']['KrbMethodK5Passwd']`|String||`'off'`| |
53 | +|`['nagios']['localhost']['check_swap_usage']['enabled']`|Boolean||`true`| | |
53 | 54 | |`['nagios']['objects']['default_contact_groups']`|String||`'admins'`| |
54 | 55 | |`['nagios']['objects']['check_ldap']['base']`|String||`'dc=example,dc=com'`| |
55 | 56 | |`['nagios']['objects']['commands']`|Array|for full customization.|`[]`| |
@@ -102,7 +103,7 @@ None. | ||
102 | 103 | - Author:: whitestar at osdn.jp |
103 | 104 | |
104 | 105 | ```text |
105 | -Copyright 2016-2018, whitestar | |
106 | +Copyright 2016-2022, whitestar | |
106 | 107 | |
107 | 108 | Licensed under the Apache License, Version 2.0 (the "License"); |
108 | 109 | you may not use this file except in compliance with the License. |
@@ -2,7 +2,7 @@ | ||
2 | 2 | # Cookbook Name:: nagios-grid |
3 | 3 | # Attributes:: default |
4 | 4 | # |
5 | -# Copyright 2016, whitestar | |
5 | +# Copyright 2016-2022, whitestar | |
6 | 6 | # |
7 | 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
8 | 8 | # you may not use this file except in compliance with the License. |
@@ -75,6 +75,8 @@ default['nagios']['web']['mod_auth_kerb']['KrbMethodNegotiate'] = 'on' | ||
75 | 75 | default['nagios']['web']['mod_auth_kerb']['KrbMethodK5Passwd'] = 'off' |
76 | 76 | |
77 | 77 | # objects |
78 | +## localhost | |
79 | +default['nagios']['localhost']['check_swap_usage']['enabled'] = true | |
78 | 80 | ## default template base |
79 | 81 | default['nagios']['objects']['default_contact_groups'] = 'admins' |
80 | 82 | default['nagios']['objects']['check_ldap'] = { |
@@ -2,7 +2,7 @@ | ||
2 | 2 | # Cookbook Name:: nagios-grid |
3 | 3 | # Recipe:: nagios-base |
4 | 4 | # |
5 | -# Copyright 2016-2018, whitestar | |
5 | +# Copyright 2016-2022, whitestar | |
6 | 6 | # |
7 | 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
8 | 8 | # you may not use this file except in compliance with the License. |
@@ -287,3 +287,17 @@ file '/usr/lib/nagios/plugins/check_disk_smb' do | ||
287 | 287 | only_if { File.exist?(path) } |
288 | 288 | notifies :restart, "service[#{nagios_service}]", :delayed if autoreload |
289 | 289 | end |
290 | + | |
291 | +# toggle swap usage check on localhost. | |
292 | +file '/etc/nagios4/objects/localhost.cfg' do | |
293 | + content lazy { | |
294 | + cmd = Chef::Util::FileEdit.new(File.exist?(path) ? path : '/dev/null') | |
295 | + cmd.search_file_delete_line(/^\s+register\s+0$/) | |
296 | + unless node['nagios']['localhost']['check_swap_usage']['enabled'] | |
297 | + cmd.insert_line_after_match(/^\s+service_description\s+Swap Usage$/, " register 0\n") | |
298 | + end | |
299 | + cmd.send(:editor).lines.join('') | |
300 | + } | |
301 | + only_if { File.exist?(path) } | |
302 | + notifies :restart, "service[#{nagios_service}]", :delayed if autoreload | |
303 | +end |
@@ -1 +1 @@ | ||
1 | -0.2.0 | |
1 | +0.3.0 |