[CentOS] Power Cut

Sun Oct 30 09:12:49 UTC 2016
John R Pierce <pierce at hogranch.com>

On 10/30/2016 12:47 AM, Ned Slider wrote:
> On 30/10/16 07:11, Hadi Motamedi wrote:
>> But the site is far remote and having alert on battery exhaustion can no
>> longer help . As I said before , I am suspicious if it comes from 
>> frequent
>> power cuts so seeking some means to distinguish it among the system 
>> logs.
>
> Your UPS should be capable of logging to /var/log/messages and should 
> also be capable of powering down the system cleanly when the battery 
> reaches a predetermined critical level (either run time remaining or 
> percentage charge), so there shouldn't be any uninitiated shutdowns. 
> The UPS logs should tell you exactly how many power outages you are 
> getting together with how long each one lasts. It sounds like you 
> haven't configured your UPS.

if its a proper enterprise/server grade commercial UPS, you should be 
able to monitor the charge state of the battery via the USB network 
interface...  I don't know what sort of UPS this is, and I've seen some 
pictures of some awful things in the third world that use a charger 
module, and a bunch of old car batteries on the floor, and an inverter,  
running whole households during the regular afternoon brownouts.   I 
don't think those sorts of things *have* network monitoring, but 
enterprise grade UPS's like newer SmartUPS, Eaton PowerWare, etc DO have 
this ability.    APC tend to be worse at this than most of the better 
alternatives like Eaton.

if this UPS *does* have any sort of thing that will give you battery 
state information, use NUT, the Network UPS Tool, on linux, and if 
you're dealing with a homebrew UPS, build your own module that can 
monitor that voltage.   I would use NUT initiate an OS shutdown when you 
get to 20% battery charge state, which is around 12.0VDC (fully charged 
12V lead acid battery is 12.6VDC, on the AC powered charger, its more 
like 13.8-14.1V).     NUT is quite powerful, and very flexible.   one 
server could monitor the UPS (maybe even via using a USB digital volt 
meter module connected directly to the batteries), and that master NUT 
node could tell all the other nodes/systems to shutdown, too.

Letting this sort of homebrew UPS fully run down the batteries to 
totally dead shortens the batteries life.     if you could shut the 
systems AND the UPS off at before the batteries are totally run down, 
they'll last a lot longer.

if this UPS is the homebrew third world bodge I described, you could 
pretty easily build a NUT master w/ a raspberry pi and a ADC 'hat'





-- 
john r pierce, recycling bits in santa cruz