Serial Connections and Alerts

I have an unusual question about Alerts and Serial Connections.  I want to know if you can configure Alerts under certain criteria to send a signal to control a UPS.

Reason:  I would like under certain to kill the power or if the UPS is going to die, to send me an email.  The power in our area has destroyed a few power supplies, so they will die.  We have redundant UPC's so I want to be able to toggle them or Kill one completely. 

Is there a good way to script this?