# OL means on line power. Anything else - OB (on battery), LB (low battery), # or no answer at all - is a failure worth waking up for, because the # hypervisor has a finite number of minutes left. local ups="{{ healthcheck_ups_name }}" local status charge runtime load status=$(upsc "${ups}@localhost" ups.status 2>/dev/null) if [ -z "$status" ]; then MESSAGE="cannot reach UPS ${ups} via upsd" return 1 fi charge=$(upsc "${ups}@localhost" battery.charge 2>/dev/null) runtime=$(upsc "${ups}@localhost" battery.runtime 2>/dev/null) load=$(upsc "${ups}@localhost" ups.load 2>/dev/null) MESSAGE="status=${status} charge=${charge}% runtime=${runtime}s load=${load}%" [[ "$status" == *"OL"* ]]