Skip to content

Instantly share code, notes, and snippets.

@NeuralGlue
Created August 12, 2016 22:56
Show Gist options
  • Save NeuralGlue/01341c2291e0dd35034a26a5f20e2e8c to your computer and use it in GitHub Desktop.
Save NeuralGlue/01341c2291e0dd35034a26a5f20e2e8c to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Check_mk
# plugin for freebsd based systems that have disks on /dev/ada?
#
# This plugin produces the correct output to be parsed by the smart.temperature and the smart.stats checks
echo '<<<smart>>>'
for disk in `ls /dev/ada?`;
do
VEND=ATA
MODEL=$(smartctl -a $disk | grep -i "device model" | sed -e "s/.*:[ ]*//g" -e "s/\ /_/g")
CMD="smartctl -v 9,raw48 -A $disk"
[ -n "$CMD" ] && $CMD | grep Always | egrep -v '^190(.*)Temperature(.*)' | sed "s|^|$disk $VEND $MODEL |"
done 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment