diff --git a/smartctl-ssd-remaining-endurance/smartctl-ssd-remaining-endurance.sh b/smartctl-ssd-remaining-endurance/smartctl-ssd-remaining-endurance.sh
--- a/smartctl-ssd-remaining-endurance/smartctl-ssd-remaining-endurance.sh
+++ b/smartctl-ssd-remaining-endurance/smartctl-ssd-remaining-endurance.sh
#
+# Space seperated list of block device names
#
+DEVICES=${DEVICES:-"sda"}
#
+# Command to use to invoke smartctl
#
+SMARTCTL=${SMARTCTL:-"sudo smartctl"}
#
+function get_remaining_percentage(){
#
+ cmd_op=`$SMARTCTL -A $device`
#
+ echo "${cmd_op}" | grep -q "Percentage Used:"
#
+ usage=`echo "${cmd_op}" | grep "Percentage Used:" | awk '{print $NF}' | tr -d '%'`
#
+ remaining=$(( 100 - $usage ))
#
+ echo "${cmd_op}" | egrep -q "Percent_Lifetime_Remain|Wear_Leveling_Count"
#
+ usage=`echo "${cmd_op}" | egrep "Percent_Lifetime_Remain|Wear_Leveling_Count" | awk '{print $4}'`
#
+ # Strip any leading 0s by converting from base10 to base10
#
+ remaining=$((10#$usage))
#
+# Iterate over the configured devices
#
+for device in $DEVICES
#
+ if [ ! -e /dev/$device ]
#
+ # Device doesn't exist
#
+ lifetime=`get_remaining_percentage /dev/$device`
#
+ if [ "$lifetime" == "" ]
#
+ # Couldn't get a result, skip
#
+ # Otherwise, echo out some lp
#
+ echo "ssd_lifetime,host=$HOSTNAME,device=$device perc_remaining=${lifetime}i"