nagios-grid CHANGELOG
=====================
+0.3.0
+-----
+- add check swap usage flag for localhost.
+
0.2.0
-----
- add Nagios4 support.
|`['nagios']['web']['mod_auth_kerb']['Krb5Keytab']`|String||`'/etc/krb5.keytab'`|
|`['nagios']['web']['mod_auth_kerb']['KrbMethodNegotiate']`|String||`'on'`|
|`['nagios']['web']['mod_auth_kerb']['KrbMethodK5Passwd']`|String||`'off'`|
+|`['nagios']['localhost']['check_swap_usage']['enabled']`|Boolean||`true`|
|`['nagios']['objects']['default_contact_groups']`|String||`'admins'`|
|`['nagios']['objects']['check_ldap']['base']`|String||`'dc=example,dc=com'`|
|`['nagios']['objects']['commands']`|Array|for full customization.|`[]`|
- Author:: whitestar at osdn.jp
```text
-Copyright 2016-2018, whitestar
+Copyright 2016-2022, whitestar
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
# Cookbook Name:: nagios-grid
# Attributes:: default
#
-# Copyright 2016, whitestar
+# Copyright 2016-2022, whitestar
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
default['nagios']['web']['mod_auth_kerb']['KrbMethodK5Passwd'] = 'off'
# objects
+## localhost
+default['nagios']['localhost']['check_swap_usage']['enabled'] = true
## default template base
default['nagios']['objects']['default_contact_groups'] = 'admins'
default['nagios']['objects']['check_ldap'] = {
# Cookbook Name:: nagios-grid
# Recipe:: nagios-base
#
-# Copyright 2016-2018, whitestar
+# Copyright 2016-2022, whitestar
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
only_if { File.exist?(path) }
notifies :restart, "service[#{nagios_service}]", :delayed if autoreload
end
+
+# toggle swap usage check on localhost.
+file '/etc/nagios4/objects/localhost.cfg' do
+ content lazy {
+ cmd = Chef::Util::FileEdit.new(File.exist?(path) ? path : '/dev/null')
+ cmd.search_file_delete_line(/^\s+register\s+0$/)
+ unless node['nagios']['localhost']['check_swap_usage']['enabled']
+ cmd.insert_line_after_match(/^\s+service_description\s+Swap Usage$/, " register 0\n")
+ end
+ cmd.send(:editor).lines.join('')
+ }
+ only_if { File.exist?(path) }
+ notifies :restart, "service[#{nagios_service}]", :delayed if autoreload
+end