Alert expressions are constructed using Python syntax and built-in keywords. The keywords are also used within the email subject and body templates. The keywords are as follows:
online(bool): True if the UPS is online, False if it is notstatus(str): The status text (ONLINE, OFFLINE, ONBATT) from the UPScharge_pct(float): The percent charge remaining in the batterytime_remaining_min(int): Estimated time remaining, in minutesdate(datetime): UPS-provided datestart_time(datetime): Time that UPS last came onlineline_voltage(float): Current line voltage readingload_pct(float): Current load percentbattery_voltage(float): Current battery voltageups_name(str): UPS nameups_model(str): UPS modelups_hostname(str): UPS hostname
{
"alertType" : 1,
"alertExpression" : "not online and charge_pct < 99",
"subject" : "Offline and power at {charge_pct}% {PROD}",
"description" : "Server is offline and power is at {charge_pct}",
"to" : "andy@test.com"
}
python MailPower.py
When MailPower starts it will look for the "config.json" file. A different config file can be provided using the -c <config file path> command-line argument.
Requires apcaccess package, which is not installed by MailPower.