Power Cut

Home » CentOS » Power Cut
CentOS 15 Comments

Dear All I am using a CentOS server for cdr billing and mediation device on a remote network. I am experiencing problem that I am suspicious it comes from main supply power cut at the remote site. The power supply to the remote site comes from battery charger that will be automatically switched in circuit under main supply power cut but cannot provide adequate power for more than
2 hours . I am suspicious that the remote system is suffering from many frequent main supply power cut . Can you please do me favor and let me know if there is any log on my CentOS server that I can check to see if there would be many frequent power cut there ?
Thank you for your time

15 thoughts on - Power Cut

  • look at /var/log/messages for reboots without shutdowns.

    CentOS 6 linux boot starts logging something like…

    Oct 25 15:01:25 new kernel: imklog 5.8.10, log source = /proc/kmsg started. Oct 25 15:01:25 new rsyslogd: [origin software=”rsyslogd”
    swVersion=”5.8.10″ x-pid=”2740″ x-info=”http://www.rsyslog.com”] start Oct 25 15:01:25 new kernel: Initializing cgroup subsys cpuset Oct 25 15:01:25 new kernel: Initializing cgroup subsys cpu Oct 25 15:01:25 new kernel: Linux version 2.6.32-642.6.1.el6.x86_64
    (mockbuild@worker1.bsys.CentOS.org) (gcc version 4.4.7 20120313 (Red Hat
    4.4.7-17) (GCC) ) #1 SMP Wed Oct 5 00:36:12 UTC 2016

    followed by tons more about all the stuff starting up….

    when its properly shutdown, you’d see something like this after everything has stopped

    Oct 25 14:20:36 new init: Disconnected from system bus Oct 25 14:20:38 new rpcbind: rpcbind terminating on signal. Restart with
    “rpcbind -w”
    Oct 25 14:20:38 new auditd[2704]: The audit daemon is exiting. Oct 25 14:20:38 new kernel: type05 audit(1477430438.399:37765):
    audit_pid=0 old’04 auidB94967295 sesB94967295 res=1
    Oct 25 14:20:38 new kernel: type05 audit(1477430438.497:37766):
    audit_enabled=0 old=1 auidB94967295 sesB94967295 res=1
    Oct 25 14:20:38 new kernel: Kernel logging (proc) stopped. Oct 25 14:20:38 new rsyslogd: [origin software=”rsyslogd”
    swVersion=”5.8.10″ x-pid=”2738″ x-info=”http://www.rsyslog.com”] exiting on signal 15.

    if its booted without a clean shutdown, it will do some file system checking and such while starting.

  • you could use smart ups and connect information from it to system, so it can shutdown system in clean way.


    2016-10-30 7:12 GMT+02:00 Hadi Motamedi :

  • Thank you very much for your reply . So you mean under the
    /var/log/messages it is distinguishable that which logs come from operator initiated reboot and which ones come from sudden power cut and then booting from scratch when power resumed ? Am I correct ?

  • Thank you for your reply. You are correct and the ups is present there but the battery charger can no longer bear power cuts more than two hours so I
    need some means to distinguish frequent power cuts there among the system logs.

  • If your battery backup can handle 2 hours of runtime then it almost certainly has a network management interface. Why aren’t you using it to send alerts?

  • 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. Thank you in advance

  • 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.

  • Thank you very much for your help. I have received plentiful helpful messages . Please consider this case as solved. Thank you again

  • 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’

  • I have been experiencing a similar situation with a remote server, and found it much easier to use the command:
    last -x | tail -n50
    to see reboots. You can tell a power cut because the end time for the previous boot up will be the same as the begin time for the next boot. If it is an orderly shutdown, there will be a time gap that is logged. As I
    understand it, the ‘last’ command uses the data stored in /var/log/wtmp, but that information is not in human-readable format. Ted Miller Indiana, USA

  • Hello Hadi,

    People have already pointed you to dmesg and /var/log/messages.

    To receive an email every time it gets rebooted put the below lines in /etc/rc.d/rc.local (or wrap them in a script and add a reference to that):

    mail -s “Server rebooted” you@example.com < < ENDOFMESSAGE Server has been rebooted. ENDOFMESSAGE

    This of course will only notify you after the fact and will be no good if the system stays down.

    Regards, Leonard.

  • Don’t know how much control you have over the remote situation but some UPSes have their own logs which should show this. Also, some UPSes have add-in boards providing network connections with various services. If these outages are costing enough money and the remote UPS doesn’t have the add-in card but does have the capability of adding one you might be able to justify the expense.

    —– Original Message —

  • Leroy Tennison wrote:

    Please don’t top post.

    Here at work, all our UPSes (mostly APC SmartUPS, but a few others, we use apcupsd to monitor them, and cron jobs to log.