Skip to content

Instantly share code, notes, and snippets.

@mortn
Last active December 7, 2015 11:21
Show Gist options
  • Select an option

  • Save mortn/b4e50b9e0128781c7e90 to your computer and use it in GitHub Desktop.

Select an option

Save mortn/b4e50b9e0128781c7e90 to your computer and use it in GitHub Desktop.
Get disk temperatures on 3ware RAID controller
#!/bin/bash
### First we get the controller ID (e.g. c0)
CT=$(tw-cli info | sed -n 's/\(c[0-9]\).*/\1/p')
### Then we list all drives on that controller
DRV=$(tw-cli /$CT show drivestatus | sed -n 's/\(p[0-9]\).*/\1/p' | xargs)
### Last we loop over the disks we found and read out the temperature on each of them
echo "3ware temperatures: $(for d in $DRV; do
tw-cli /$CT/$d show temperature | sed -n 's/ Temperature = /:/;s/ deg //p'
done | xargs)" | logger
@mortn

mortn commented Feb 11, 2015

Copy link
Copy Markdown
Author

One could, of course, just shorten the whole thing into a single command, but setting the controller ID and the drives as variables makes it so much easier to use for something else than just temperature read-outs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment