• R/O
  • HTTP
  • SSH
  • HTTPS

grid-chef-repo: Commit

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


Commit MetaInfo

Revisionc48fd5ff6c415e90cb2b0ef881d85ead8e2147cb (tree)
Zeit2022-01-05 22:30:48
Autorwhitestar <whitestar@user...>
Commiterwhitestar

Log Message

add check swap usage flag for localhost.

Ändern Zusammenfassung

Diff

--- a/cookbooks/nagios-grid/CHANGELOG.md
+++ b/cookbooks/nagios-grid/CHANGELOG.md
@@ -1,6 +1,10 @@
11 nagios-grid CHANGELOG
22 =====================
33
4+0.3.0
5+-----
6+- add check swap usage flag for localhost.
7+
48 0.2.0
59 -----
610 - add Nagios4 support.
--- a/cookbooks/nagios-grid/README.md
+++ b/cookbooks/nagios-grid/README.md
@@ -50,6 +50,7 @@ None.
5050 |`['nagios']['web']['mod_auth_kerb']['Krb5Keytab']`|String||`'/etc/krb5.keytab'`|
5151 |`['nagios']['web']['mod_auth_kerb']['KrbMethodNegotiate']`|String||`'on'`|
5252 |`['nagios']['web']['mod_auth_kerb']['KrbMethodK5Passwd']`|String||`'off'`|
53+|`['nagios']['localhost']['check_swap_usage']['enabled']`|Boolean||`true`|
5354 |`['nagios']['objects']['default_contact_groups']`|String||`'admins'`|
5455 |`['nagios']['objects']['check_ldap']['base']`|String||`'dc=example,dc=com'`|
5556 |`['nagios']['objects']['commands']`|Array|for full customization.|`[]`|
@@ -102,7 +103,7 @@ None.
102103 - Author:: whitestar at osdn.jp
103104
104105 ```text
105-Copyright 2016-2018, whitestar
106+Copyright 2016-2022, whitestar
106107
107108 Licensed under the Apache License, Version 2.0 (the "License");
108109 you may not use this file except in compliance with the License.
--- a/cookbooks/nagios-grid/attributes/default.rb
+++ b/cookbooks/nagios-grid/attributes/default.rb
@@ -2,7 +2,7 @@
22 # Cookbook Name:: nagios-grid
33 # Attributes:: default
44 #
5-# Copyright 2016, whitestar
5+# Copyright 2016-2022, whitestar
66 #
77 # Licensed under the Apache License, Version 2.0 (the "License");
88 # you may not use this file except in compliance with the License.
@@ -75,6 +75,8 @@ default['nagios']['web']['mod_auth_kerb']['KrbMethodNegotiate'] = 'on'
7575 default['nagios']['web']['mod_auth_kerb']['KrbMethodK5Passwd'] = 'off'
7676
7777 # objects
78+## localhost
79+default['nagios']['localhost']['check_swap_usage']['enabled'] = true
7880 ## default template base
7981 default['nagios']['objects']['default_contact_groups'] = 'admins'
8082 default['nagios']['objects']['check_ldap'] = {
--- a/cookbooks/nagios-grid/recipes/nagios-base.rb
+++ b/cookbooks/nagios-grid/recipes/nagios-base.rb
@@ -2,7 +2,7 @@
22 # Cookbook Name:: nagios-grid
33 # Recipe:: nagios-base
44 #
5-# Copyright 2016-2018, whitestar
5+# Copyright 2016-2022, whitestar
66 #
77 # Licensed under the Apache License, Version 2.0 (the "License");
88 # 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
287287 only_if { File.exist?(path) }
288288 notifies :restart, "service[#{nagios_service}]", :delayed if autoreload
289289 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
--- a/cookbooks/nagios-grid/version
+++ b/cookbooks/nagios-grid/version
@@ -1 +1 @@
1-0.2.0
1+0.3.0
Show on old repository browser