Re: [gentoo-user] apcupsd to recycle power

2014-11-17 Thread Thanasis

on 11/17/2014 03:06 AM thegeezer wrote the following:
snip


the only way forward that i see would be to get a small device a la
raspberry pi, and have that run apcupsd on it.  you can then have that
device run wake on lan if it detects the power is good, and trigger
remote shutdown when not.



Thanks.
I am going to try and do some more tests though ...




Re: [gentoo-user] apcupsd to recycle power

2014-11-17 Thread J. Roeleveld
On Friday, November 14, 2014 08:53:13 PM Thanasis wrote:
 I have an APC SC620I, which in case of power failure, it successfully
 initiates a shutdown to the connected (via SMART cable) PC, but if the
 mains power returns, the UPS does not recycle the power to the PC, and
 consequently the PC stays off.

Not all UPSs have functionality to cycle the power outputs when the power 
returns.
And some that do require a specific command to be sent to it to enable this, 
which might need some closed-source client that only works on MS Windows.

A few years ago there was a message on the nut website asking for a boycot of 
APC because they changed the protocol and refuse to provide info on it, 
forcing people to use the APC bloatware. (Requiring Java just to talk to a 
UPS?)

--
Joost



Re: [gentoo-user] apcupsd to recycle power

2014-11-16 Thread thegeezer


On 15/11/2014 16:47, Daniel Frey wrote:

If the above fails (if the above does indeed fail, some troubleshooting
should happen to try to figure out why it doesn't work), KILLDELAY is
the parameter you likely seek, but it is dangerous. If you set this it
will wait x seconds after a shutdown was requested and forcibly shut
down the UPS power.

However, in the even that power is restored between the UPS kill and the
time it actually turns off the mains will still not be cycled. But
theoretically this window should be pretty small.

Dan




it does seem as though this hits the issue - that when power fails, the 
ups triggers a shutdown, but the power doesn't fail hard enough to wind 
down the ups too, in which case the machine that is waiting for the 
offbattery event is fast asleep and misses the message. it's a shame 
the killpower command does nothing for you.


the only way forward that i see would be to get a small device a la 
raspberry pi, and have that run apcupsd on it.  you can then have that 
device run wake on lan if it detects the power is good, and trigger 
remote shutdown when not.




Re: [gentoo-user] apcupsd to recycle power

2014-11-15 Thread Mick
On Friday 14 Nov 2014 18:53:13 Thanasis wrote:
 I have an APC SC620I, which in case of power failure, it successfully
 initiates a shutdown to the connected (via SMART cable) PC, but if the
 mains power returns, the UPS does not recycle the power to the PC, and
 consequently the PC stays off.
 
 Regardless if the mains power returns soon after the UPS has initiated a
 shutdown to the PC, shouldn't the UPS recycle the power anyway, so that
 the PC comes back on as set in BIOS?
 
 Am I missing something in the configuration or the daemons that should
 be running?
 
 (Running sys-power/apcupsd-3.14.8-r2)
 
 /etc/apcupsd/apcupsd.conf folows:
 
 UPSNAME SC620I
 UPSCABLE smart
 UPSTYPE apcsmart
 DEVICE /dev/ttyS0
 LOCKFILE /var/lock
 SCRIPTDIR /etc/apcupsd
 PWRFAILDIR /etc/apcupsd
 NOLOGINDIR /etc
 ONBATTERYDELAY 6
 BATTERYLEVEL 20
 MINUTES 2
 TIMEOUT 0
 ANNOY 300
 ANNOYDELAY 60
 NOLOGON disable
 KILLDELAY 0
 NETSERVER on
 NISIP 192.168.0.1
 NISPORT 3551
 EVENTSFILE /var/log/apcupsd.events
 EVENTSFILEMAX 10
 UPSCLASS standalone
 UPSMODE disable
 STATTIME 600
 STATFILE /var/log/apcupsd.status
 LOGSTATS off
 DATATIME 0
 BATTDATE 10/17/11
 SENSITIVITY H
 WAKEUP 60
 SLEEP 180
 LOTRANSFER  208
 HITRANSFER 253
 RETURNCHARGE 45
 BEEPSTATE L
 LOWBATT 5
 OUTPUTVOLTS 230
 SELFTEST 336

I'm afraid I don't have an APC UPS to know its quirks, but in my case I have 
these running:

upsd
upsdrv
upslog
upsmon


Is it that the UPS does not recycle the power, or is it that the PC does not 
reboot after power is restored?  Does the PC reboot if you pull and reinsert 
its mains plug?

WARNING:  don't just pull the plug in a fully working system to avoid fs 
corruption - Press something r e i s u  in sequence while holding 
Ctrl+Alt+SysRq and then pull the plug.  If the PC's BIOS is configured 
correctly it should reboot as soon as you reconnect the mains supply to it.

Have a look here if you haven't seen this section already:

http://www.apcupsd.com/manual/manual.html#arranging-for-reboot-on-power-up

-- 
Regards,
Mick


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] apcupsd to recycle power

2014-11-15 Thread Thanasis

on 11/15/2014 11:35 AM Mick wrote the following:

On Friday 14 Nov 2014 18:53:13 Thanasis wrote:

I have an APC SC620I, which in case of power failure, it successfully
initiates a shutdown to the connected (via SMART cable) PC, but if the
mains power returns, the UPS does not recycle the power to the PC, and
consequently the PC stays off.

Regardless if the mains power returns soon after the UPS has initiated a
shutdown to the PC, shouldn't the UPS recycle the power anyway, so that
the PC comes back on as set in BIOS?

Am I missing something in the configuration or the daemons that should
be running?

(Running sys-power/apcupsd-3.14.8-r2)

/etc/apcupsd/apcupsd.conf folows:

UPSNAME SC620I
UPSCABLE smart
UPSTYPE apcsmart
DEVICE /dev/ttyS0
LOCKFILE /var/lock
SCRIPTDIR /etc/apcupsd
PWRFAILDIR /etc/apcupsd
NOLOGINDIR /etc
ONBATTERYDELAY 6
BATTERYLEVEL 20
MINUTES 2
TIMEOUT 0
ANNOY 300
ANNOYDELAY 60
NOLOGON disable
KILLDELAY 0
NETSERVER on
NISIP 192.168.0.1
NISPORT 3551
EVENTSFILE /var/log/apcupsd.events
EVENTSFILEMAX 10
UPSCLASS standalone
UPSMODE disable
STATTIME 600
STATFILE /var/log/apcupsd.status
LOGSTATS off
DATATIME 0
BATTDATE 10/17/11
SENSITIVITY H
WAKEUP 60
SLEEP 180
LOTRANSFER  208
HITRANSFER 253
RETURNCHARGE 45
BEEPSTATE L
LOWBATT 5
OUTPUTVOLTS 230
SELFTEST 336


I'm afraid I don't have an APC UPS to know its quirks, but in my case I have
these running:

upsd
upsdrv
upslog
upsmon


the above are not part of apcupsd, are they?




Is it that the UPS does not recycle the power,


The UPS does NOT recycle the power.

or is it that the PC does not

reboot after power is restored?  Does the PC reboot if you pull and reinsert
its mains plug?


The PC's BIOS is correctly configured and tested to start up as soon as 
power is restored to it.




WARNING:  don't just pull the plug in a fully working system to avoid fs
corruption - Press something r e i s u  in sequence while holding
Ctrl+Alt+SysRq and then pull the plug.  If the PC's BIOS is configured
correctly it should reboot as soon as you reconnect the mains supply to it.


I am aware of it.



Have a look here if you haven't seen this section already:

http://www.apcupsd.com/manual/manual.html#arranging-for-reboot-on-power-up


Looks like the UPS does not cut (kill) the power, but I am not sure how 
to debug it.





Re: [gentoo-user] apcupsd to recycle power

2014-11-15 Thread Bruce Schultz

On 15/11/14 22:52, Thanasis wrote:

on 11/15/2014 11:35 AM Mick wrote the following:

On Friday 14 Nov 2014 18:53:13 Thanasis wrote:

I have an APC SC620I, which in case of power failure, it successfully
initiates a shutdown to the connected (via SMART cable) PC, but if the
mains power returns, the UPS does not recycle the power to the PC, and
consequently the PC stays off.

Regardless if the mains power returns soon after the UPS has 
initiated a

shutdown to the PC, shouldn't the UPS recycle the power anyway, so that
the PC comes back on as set in BIOS?

Am I missing something in the configuration or the daemons that should
be running?






Is it that the UPS does not recycle the power,


The UPS does NOT recycle the power.

or is it that the PC does not
reboot after power is restored?  Does the PC reboot if you pull and 
reinsert

its mains plug?


The PC's BIOS is correctly configured and tested to start up as soon 
as power is restored to it.



Have a look here if you haven't seen this section already:

http://www.apcupsd.com/manual/manual.html#arranging-for-reboot-on-power-up 



Looks like the UPS does not cut (kill) the power, but I am not sure 
how to debug it.





If the UPS battery has not run flat before the mains power is restored, 
I see no reason why a UPS should kill the output power. So the BIOS has 
no real way of knowing that it should reboot again in that case.


Have you looked for any BIOS options related to powering on from a USB 
device? eg, I'm thinking of PCs which can be switched on by pressing a 
key on the keyboard... could that mechanism be triggered by a UPS? Or 
perhaps via wake-on-lan? (Note I have no real experience with UPSs, I'm 
just trying to think of other ways that PCs can be made to power on).


Bruce

--
:b




Re: [gentoo-user] apcupsd to recycle power

2014-11-15 Thread Thanasis

on 11/15/2014 03:54 PM Bruce Schultz wrote the following:


If the UPS battery has not run flat before the mains power is restored,
I see no reason why a UPS should kill the output power.


The PC has an option in BIOS to Power On when the mains power is 
restored to it, without any need to press any button.
So, once the UPS has initiated a shutdown to the PC, the PC will 
shutdown, and if the mains power is restored (to the UPS) shortly after 
the PC has shutdown, how will the UPS make the PC come back on, unless 
it cuts (kills) the power to PC's cord, and then restores it after a few 
seconds.

See the link Mick posted in his reply:
http://www.apcupsd.com/manual/manual.html#arranging-for-reboot-on-power-up



Re: [gentoo-user] apcupsd to recycle power

2014-11-15 Thread Rich Freeman
On Sat, Nov 15, 2014 at 8:54 AM, Bruce Schultz brul...@gmail.com wrote:

 If the UPS battery has not run flat before the mains power is restored, I
 see no reason why a UPS should kill the output power. So the BIOS has no
 real way of knowing that it should reboot again in that case.


Obviously not directly applicable, but I use nut and a cyberpower UPS
and the shutdown scheme it employs is that the master (controls the
UPS) commands everything else to shut down, then it begins shutdown,
and just before powering off it sends a command to the UPS which
causes a several second delay followed by a power off, and then it
powers off the host (which is otherwise shutdown already).

I need to re-read how exactly this is implemented.

--
Rich



Re: [gentoo-user] apcupsd to recycle power

2014-11-15 Thread Mick
On Saturday 15 Nov 2014 14:22:47 Thanasis wrote:
 on 11/15/2014 03:54 PM Bruce Schultz wrote the following:
  If the UPS battery has not run flat before the mains power is restored,
  I see no reason why a UPS should kill the output power.
 
 The PC has an option in BIOS to Power On when the mains power is
 restored to it, without any need to press any button.
 So, once the UPS has initiated a shutdown to the PC, the PC will
 shutdown, and if the mains power is restored (to the UPS) shortly after
 the PC has shutdown, how will the UPS make the PC come back on, unless
 it cuts (kills) the power to PC's cord, and then restores it after a few
 seconds.
 See the link Mick posted in his reply:
 http://www.apcupsd.com/manual/manual.html#arranging-for-reboot-on-power-up

On the same page it lists a number of tests you can perform:

http://www.apcupsd.com/manual/manual.html#testing-apcupsd

Have you been through them and in particular the Full Power Down Test?  If 
yes, did you wait long enough after the PC has powered down, for the UPS to 
also switch off (you can affect the overall waiting time by setting a shorter 
TIMEOUT value, rather than waiting for the batteries to go flat). 

If this does not get you somewhere, I recommend you post to the  
nut-upsu...@lists.alioth.debian.org (you'll need to register first).  The 
developers and contributors are offering friendly advice and are very 
knowledgeable on all things UPS related, including annoying bugs with firmware 
that defeat reason.

PS. The services I listed running are particular to my UPS, I expect different 
to your APC unit.

-- 
Regards,
Mick


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] apcupsd to recycle power

2014-11-15 Thread Thanasis

on 11/15/2014 04:40 PM Rich Freeman wrote the following:

On Sat, Nov 15, 2014 at 8:54 AM, Bruce Schultz brul...@gmail.com wrote:


If the UPS battery has not run flat before the mains power is restored, I
see no reason why a UPS should kill the output power. So the BIOS has no
real way of knowing that it should reboot again in that case.



Obviously not directly applicable, but I use nut and a cyberpower UPS
and the shutdown scheme it employs is that the master (controls the
UPS) commands everything else to shut down, then it begins shutdown,
and just before powering off it sends a command to the UPS which
causes a several second delay followed by a power off, and then it
powers off the host (which is otherwise shutdown already).

I need to re-read how exactly this is implemented.



As I wrote in the initial post I am running apcupsd because my UPS is an 
APC (... should I switch to sys-power/nut ?)





Re: [gentoo-user] apcupsd to recycle power

2014-11-15 Thread Thanasis

on 11/15/2014 04:59 PM Mick wrote the following:

On Saturday 15 Nov 2014 14:22:47 Thanasis wrote:


The PC has an option in BIOS to Power On when the mains power is
restored to it, without any need to press any button.
So, once the UPS has initiated a shutdown to the PC, the PC will
shutdown, and if the mains power is restored (to the UPS) shortly after
the PC has shutdown, how will the UPS make the PC come back on, unless
it cuts (kills) the power to PC's cord, and then restores it after a few
seconds.
See the link Mick posted in his reply:
http://www.apcupsd.com/manual/manual.html#arranging-for-reboot-on-power-up


On the same page it lists a number of tests you can perform:

http://www.apcupsd.com/manual/manual.html#testing-apcupsd

Have you been through them and in particular the Full Power Down Test?  If
yes, did you wait long enough after the PC has powered down, for the UPS to
also switch off (you can affect the overall waiting time by setting a shorter
TIMEOUT value, rather than waiting for the batteries to go flat).


Yes I have set the TIMEOUT to 30 (seconds) in /etc/apcupsd/apcupsd.conf, 
and run the tests. Waited more than 3 minutes after the PC powers off, 
the UPS will not kill the power.




If this does not get you somewhere, I recommend you post to the
nut-upsu...@lists.alioth.debian.org (you'll need to register first).


Is the above list (nut-upsu...@lists.alioth.debian.org) also appropriate 
for apcupsd users?



The
developers and contributors are offering friendly advice and are very
knowledgeable on all things UPS related, including annoying bugs with firmware
that defeat reason.

PS. The services I listed running are particular to my UPS, I expect different
to your APC unit.

Yes, because they belong to sys-power/nut. I 've been talking about 
sys-power/apcupsd, as I said in first post.

(Should I switch to sys-power/nut?)




Re: [gentoo-user] apcupsd to recycle power

2014-11-15 Thread Thanasis

on 11/15/2014 06:47 PM Daniel Frey wrote the following:

On 11/14/2014 10:53 AM, Thanasis wrote:

I have an APC SC620I, which in case of power failure, it successfully
initiates a shutdown to the connected (via SMART cable) PC, but if the
mains power returns, the UPS does not recycle the power to the PC, and
consequently the PC stays off.

Regardless if the mains power returns soon after the UPS has initiated a
shutdown to the PC, shouldn't the UPS recycle the power anyway, so that
the PC comes back on as set in BIOS?


I assume that your PC shuts off thus reducing the load - and, of course,
this increases the runtime of the remaining battery so the UPS never
actually shuts down?

I don't think you can get apcupsd in any case to cycle the outlet
groups, but you can try a couple things.

First, is apcupsd even sending the signal to shutdown the UPS?

/etc/init.d/apcupsd.powerfail needs to be added to the shutdown runlevel:

`rc-update add apcupsd.powerfail shutdown`


I have even tried to run the command /sbin/apcupsd --killpower from a 
root terminal (while in default runlevel, after manually creating the 
file /etc/apcupsd/powerfail) and nothing happened.




At the end of the shutdown this is run and it tells the UPS to power
off. If you have multiple PCs this should be enabled on the slowest to
shutdown to make sure it doesn't kill a machine still shutting down.



Am I missing something in the configuration or the daemons that should
be running?

(Running sys-power/apcupsd-3.14.8-r2)

/etc/apcupsd/apcupsd.conf folows:
KILLDELAY 0


If the above fails (if the above does indeed fail, some troubleshooting
should happen to try to figure out why it doesn't work), KILLDELAY is
the parameter you likely seek, but it is dangerous. If you set this it
will wait x seconds after a shutdown was requested and forcibly shut
down the UPS power.

However, in the even that power is restored between the UPS kill and the
time it actually turns off the mains will still not be cycled.


Why would this be so?


But
theoretically this window should be pretty small.

Dan









Re: [gentoo-user] apcupsd to recycle power

2014-11-15 Thread Daniel Frey
On 11/15/2014 09:05 AM, Thanasis wrote:

 However, in the even that power is restored between the UPS kill and the
 time it actually turns off the mains will still not be cycled.
 
 Why would this be so?
 

That was a musing, it wasn't based on testing. On most UPS systems I've
seen when the power comes back the UPS resets.

As I said, you can time your shutdown and set KILLDELAY, but make sure
you add some extra time in case the shutdown takes longer than expected.
`man apcupsd.conf` only has a two-sentence description for killdelay usage.

Dan




Re: [gentoo-user] apcupsd to recycle power

2014-11-15 Thread Mick
On Saturday 15 Nov 2014 16:54:26 Thanasis wrote:
 on 11/15/2014 04:59 PM Mick wrote the following:

  Have you been through them and in particular the Full Power Down Test? 
  If yes, did you wait long enough after the PC has powered down, for the
  UPS to also switch off (you can affect the overall waiting time by
  setting a shorter TIMEOUT value, rather than waiting for the batteries
  to go flat).
 
 Yes I have set the TIMEOUT to 30 (seconds) in /etc/apcupsd/apcupsd.conf,
 and run the tests. Waited more than 3 minutes after the PC powers off,
 the UPS will not kill the power.

Hmm ... I'm running out of ideas.  :-(

 
  If this does not get you somewhere, I recommend you post to the
  nut-upsu...@lists.alioth.debian.org (you'll need to register first).
 
 Is the above list (nut-upsu...@lists.alioth.debian.org) also appropriate
 for apcupsd users?

I'm sure I saw threads there on APC UPS, so yes it won't hurt if you post 
there.


  PS. The services I listed running are particular to my UPS, I expect
  different to your APC unit.
 
 Yes, because they belong to sys-power/nut. I 've been talking about
 sys-power/apcupsd, as I said in first post.
 (Should I switch to sys-power/nut?)

You can try sys-power/nut, and use something like:

sudo /opt/local/bin/usbhid-ups -a apcups -DD

to get some debug info from your UPS, after you set up the configuration 
files.  You could either try the apcupsd-ups driver which acts as an apcupsd 
client, or you give usbhid-ups a spin as I show above.  In any case, I trust 
that the guys at the nut M/L will give sound advice for your particular UPS - 
unless some gentoo user with this UPS chimes in first.

HTH.

-- 
Regards,
Mick


signature.asc
Description: This is a digitally signed message part.