#!/bin/bash

STATUS="OK"

BAT=`/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -aALL -NoLog | grep "Battery State"`

if [ "$BAT" = "Battery State: Optimal" ]; then
    echo "OK"
    exit 0
else
    echo "Raid battery failed!"
    exit 2
fi
