aboutsummaryrefslogtreecommitdiff
path: root/manifests/subsystem/sensors.pp
blob: 8a198314d3821aaa00ad2182b681a7a0e37ebe71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
class nodo::subsystem::sensors {
  #
  # SMART monitoring
  #

  $smartmontools = lookup('nodo::sensors::smartmontools', undef, undef, 'present')

  if $smartmontools == 'present' {
    class { 'smartmontools': }
  }

  #
  # LM Sensors
  #

  $lm_sensors = lookup('nodo::sensors::lm_sensors', undef, undef, 'present')

  package { [
    'lm-sensors',
  ]:
    ensure => $lm_sensors,
  }

  #
  # drivetemp
  #
  # Just load this driver and lm-sensors will detect sensors automatically.
  #
  # https://www.baeldung.com/linux/hdd-ssd-temperature
  # https://askubuntu.com/questions/1426482/tool-to-monitor-hdd-temperature-in-ubuntu-server-22-04
  # https://wiki.archlinux.org/title/Lm_sensors#S.M.A.R.T._drive_temperature
  # https://github.com/philipl/drivetemp

  $drivetemp = lookup('nodo::sensors::drivetemp', undef, undef, 'present')

  nodo::subsystem::modprobe::module { 'drivetemp':
    ensure => $drivetemp,
  }

  #
  # hddtemp
  #

  # Deprecated in favor of drivetemp:
  # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1002484
  package { [
    'hddtemp',
  ]:
    ensure => $::lsbdistcodename ? {
      'wheezy'   => present,
      'buster'   => present,
      'bullseye' => present,
      default  => absent,
    }
  }
}