summaryrefslogtreecommitdiff
path: root/temperatures
blob: 2ccb60182c399995c5d6bb1d7aa5452694af6892 (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
#!/usr/bin/env zsh

host=$(hostname)

if [[ $host == "durant" ]]; then
  #echo "CPU:           $(sensors | sed "s|\s\+| |g" | grep Package | cut -d " " -f 4)"
  echo "CPU:            $(ipmitool sensor 2>/dev/null | sed "s|\s\+| |g" | grep CPU | cut -d " " -f 4 | cut -d. -f 1)°C"
  for disk in `fdisk -l 2>/dev/null | grep -P "/dev" | grep Disk | cut -d " " -f 2 | sed "s|:||"`; do
    case $disk in
      /dev/nvme*)
        TEMP=$(nvme smart-log $disk | grep temperature | sed "s|\s\+| |g" | cut -d " " -f 3 | sed "s|C||")
        echo "$disk\t${TEMP}C"
        ;;
      /dev/sd*)
        TEMP=$(smartctl -a $disk | grep Temp | cut -d " " -f 37 | tr '\n' ' ' | sed "s|\s*||g")
        if [[ $TEMP != "" ]]; then
          echo "$disk\t$TEMP°C"
        fi
        ;;
      *)
        ;;
    esac
  done | sort
fi