Need transistor/circuit help for building a power sensing circuit.

I have a crude power sensing system I built with an Arduino Pro, a GPRS shield, and a relay that will send me a text message when my power goes out. The Arduino is powered from a UPS, which will keep it going after the power fails. To sense a failure, I have a relay held closed by a USB wall wart plugged directly into the wall (no UPS). When the power fails, the relay opens, and the Arduino senses the change in state and sends a text message. When the power comes back on, the wall wart pulls the relay closed again, and I get another message saying the power has been restored. If the power is out longer than the UPS can handle (there's a computer attached to it too), I'll get a message when the Arduino starts back up once the power is restored.

What I want to do is eliminate the relay. I know I should be able to use a transistor instead. I don't know much at all about transistors though. What kind of transistor should I use? (I know NPN, but more specifically which one?). How would I wire it? Do I need anything else in my circuit, like a resistor or a diode?

You can consider using a solid state relay,

For example, the VN540 from ST
Max power supply voltage : 45V
Input control voltage: 0~5V
Output current (CONTINUOUS) : 2.8A
http://www.st.com/web/en/resource/technical/document/datasheet/CD00070971.pdf

A UPS should have a serial interface you can use to obtain status information I believe.

MarkT:
A UPS should have a serial interface you can use to obtain status information I believe.

If it doesn't have a serial interface there's always the status LEDs on the unit. Use a light-dependent resistor or phototransistor to detect when they are on/off.

I ended up finding the permanent solution I'm going to go with. I pulled the 4N35 optoisolator out of my Arduino startup kit. My USB wall wart is plugged in to the input side (with a resistor). The collector is plugged into the Arduino ground, and the emitter is plugged into a digital pin. It's programmed to look for a button push, which the optoisolator simulates.