Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ### Parameters ###
- logfile="/tmp/ups_report.tmp"
- email="your_mail@gmail.com"
- subject="UPS Status Report for FreeNAS"
- ups="ups@localhost"
- ### Set email headers ###
- (
- echo "To: ${email}"
- echo "Subject: ${subject}"
- echo "Content-Type: text/html"
- echo "MIME-Version: 1.0"
- echo -e "\r\n"
- ) > ${logfile}
- ### Set email body ###
- (
- echo "<pre style=\"font-size:14px\">"
- echo "UPS report generated:"
- date "+Time: %Y-%m-%d %H:%M:%S"
- echo ""
- echo "Ups Info:"
- echo " UPS Status: `upsc ${ups} ups.status`"
- echo " UPS Temp: `upsc ${ups} ups.temperature` C"
- echo ""
- echo "Input Output:"
- echo " Input Frequency: `upsc ${ups} input.frequency` Hz"
- echo " Input Voltage: `upsc ${ups} input.voltage` V"
- echo " Output Voltage: `upsc ${ups} output.voltage` V"
- echo " Output Load: `upsc ${ups} ups.load` %"
- echo ""
- echo "Battery Status:"
- echo " Battery Runtime: `upsc ${ups} battery.runtime` s"
- echo " Battery Voltage: `upsc ${ups} battery.voltage` V"
- echo " Battery Charge: `upsc ${ups} battery.charge` %"
- echo ""
- echo "</pre>"
- ) >> ${logfile}
- ### Send report ###
- sendmail -t < ${logfile}
- rm ${logfile}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement