-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: This is a very simple cookbook to install and configure smartmontools. This was primarily written by infcted Pull Request resolved: #203 Test Plan: Potentially usable internally (we don't yet have a dedicated smartmon cookbook beyond engenv_smartd FWICT, but for now this would be an example on our open-source repo and not in use. Differential Revision: D66516318 fbshipit-source-id: d1742fa753665cfdecd317354f0d69cd7f8d5005
- Loading branch information
1 parent
cc8e178
commit 53432dc
Showing
7 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,7 @@ | |
'fb_screen', | ||
'fb_sdparm', | ||
'fb_securetty', | ||
'fb_smartmon', | ||
'fb_storage', | ||
'fb_stunnel', | ||
'fb_sudo', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
fb_smartmon Cookbook | ||
==================== | ||
This cookbook manages the package `smartmontools` and `smartctl` | ||
as well as the server `smartd` | ||
|
||
Requirements | ||
------------ | ||
|
||
Attributes | ||
---------- | ||
* node['fb_smartmon']['enable'] | ||
* node['fb_smartmon']['config'][$DIRECTIVE][$CONFIG] | ||
|
||
Usage | ||
----- | ||
By default this cookbook will install the `smartmontools` package | ||
which allows the `smartctl` command to be used. | ||
|
||
By default `node['fb_smartmon']['enable']` is set to false which | ||
disables the `smartd` service | ||
|
||
Setting `node['fb_smartmon']['enable']` to `true` will enable the | ||
`smartd` service | ||
|
||
`node['fb_smartmon']['config'][$DIRECTIVE][$CONFIG]` controls | ||
the `/etc/smartd.conf` config. The `$DIRECTIVE` can be a device | ||
device such as `/dev/sda` - or a command such as `DEVICESCAN` | ||
or `DEFAULT`. `$CONFIG` can be used to specify an options the | ||
directive takes (see smartd.conf man pages). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2 | ||
# | ||
# Copyright (c) 2022-present, Vicarious, Inc. | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
return unless node.linux? | ||
|
||
if node['block_device'].keys.any? { |x| x.start_with?('nvme') } | ||
devicetype = 'nvme' | ||
else | ||
devicetype = 'auto' | ||
end | ||
|
||
default['fb_smartmon'] = { | ||
'enable' => false, | ||
'config' => { | ||
'devicescan' => { | ||
'-d' => devicetype, | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright (c) 2022-present, Viarious, Inc. | ||
name 'fb_smartmon' | ||
maintainer 'Facebook' | ||
maintainer_email 'noreply@facebook.com' | ||
license 'All Rights Reserved' | ||
source_url 'https://github.com/facebook/chef-cookbooks/' | ||
description 'Installs/Configures fb_smartmon' | ||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) | ||
# never EVER change this number, ever. | ||
version '0.1.0' | ||
depends 'fb_helpers' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# | ||
# Cookbook:: fb_smartmon | ||
# Recipe:: default | ||
# | ||
# Copyright (c) 2016-present, Facebook, Inc. | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
package 'smartmontools' do | ||
action :upgrade | ||
end | ||
|
||
template '/etc/smartd.conf' do | ||
owner 'root' | ||
group 'root' | ||
mode '0644' | ||
end | ||
|
||
service 'smartd' do | ||
only_if { node['fb_smartmon']['enable'] } | ||
action [:enable, :start] | ||
end | ||
|
||
service 'disable smartd' do | ||
service_name 'smartd' | ||
not_if { node['fb_smartmon']['enable'] } | ||
action [:stop, :disable] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This file is controlled by Chef, do not modify! | ||
<% node.default['fb_smartmon']['config'].each do |section, config| %> | ||
<%= section.upcase %> <%= config.to_a.flatten.join(' ') %> | ||
|
||
<% end %> |