On Wed, Jul 04, 2007 at 10:10:17AM -0400, Charles Lepple wrote: > On 7/4/07, Charles Lepple <[EMAIL PROTECTED]> wrote: > >http://ocelot.ghz.cc/~buildbot/nut-2.3.0-r1012.tar.gz > > > >Please post the output of 'upsc' after everything is running. > > I made some other changes to map the values returned by your UPS into > the standard NUT status variables. The new snapshot is here: > > http://ocelot.ghz.cc/~buildbot/nut-2.3.0-r1014.tar.gz
I did that -- it works, **** many thanks ****. There are various bits to this email, separated by ****. /usr/local/ups/bin/upsc [EMAIL PROTECTED] ups.status tells me: OL CHRG and when I unplug the UPS from the mains: OB DISCHRG If I go: /usr/local/ups/bin/upsc [EMAIL PROTECTED] I get: battery.charge: 100 battery.runtime: 600 battery.voltage: 13 battery.voltage.nominal: 12 driver.name: usbhid-ups driver.parameter.pollinterval: 2 driver.parameter.port: auto driver.parameter.vendorid: 06da driver.version: 2.3.0-r1014 ups.load: 25 ups.mfr: LIEBERT ups.model: PowerSure Personal XT ups.productid: ffff ups.status: OL ups.vendorid: 06da and: battery.charge: 95 battery.runtime: 600 battery.voltage: 12 battery.voltage.nominal: 12 driver.name: usbhid-ups driver.parameter.pollinterval: 2 driver.parameter.port: auto driver.parameter.vendorid: 06da driver.version: 2.3.0-r1014 ups.load: 30 ups.mfr: LIEBERT ups.model: PowerSure Personal XT ups.productid: ffff ups.status: OB DISCHRG ups.vendorid: 06da I don't see why ups.load goes up when I unplug it ? **** Note that nut-2.3.0-r1014/scripts/RedHat/README is wrong, it should read: Install ups in /etc/sysconfig/ /etc/sysconfig/ups is used only to store the POWERDOWNFLAG variable Install upsd & upsmon in /etc/rc.d/init.d Then run: chkconfig --add upsd chkconfig --add upsmon If you have not already started the daemon & monitor, run: service upsd start service upsmon start **** Under the default install directory of /usr/local/ups the PATH is wrong; nut-2.3.0-r1014/scripts/RedHat/upsmon should be modified, before the line: case "$1" in Insert: PATH=$PATH:/usr/local/ups/sbin:/usr/local/ups/bin DO NOT change the PATH assignment at the top, since the PATH is reset in /etc/rc.d/init.d/functions. Alternatively the resetting of PATH can be done in /etc/sysconfig/ups (as show later). **** I modified nut-2.3.0-r1014/scripts/RedHat/upsd to allow UPSDCONF & UPSCONF to be set in /etc/sysconfig/ups: [ -z "$UPSDCONF" ] && UPSDCONF=/etc/ups/upsd.conf [ -z "$UPSCONF" ] && UPSCONF=/etc/ups/ups.conf (The default install puts them in /usr/local/ups/etc/) Also add: PATH=$PATH:/usr/local/ups/sbin:/usr/local/ups/bin just below: . /etc/rc.d/init.d/functions Alternatively the resetting of PATH can be done in /etc/sysconfig/ups (as show later). **** Twice when I restarted upsd the system hung to 10 minutes or so. I have not had a chance to investigate. Leave it alone & it came back. System: CentOS 4.5 (==RedHat Enterprise 4.5), kernel 2.6.9-42.0.10.plus.c4, i386 Seems to be OK now ??? **** You need to mention somewhere that the firewall may need to be modified to allow incoming connections to TCP port 3493. **** I pulled the plug, got lots of warning messages about the thing being on battery -- after a few minutes it decided to power down but never got there as the UPS powered off before Linux had shutdown properly. Plug the UPS back in and the machine came up without attention. I have had a look at upssched ... looks complicated, why not just add an extra parameters to ups.conf that 'fakes' an imminent power off at the earliest of: * X seconds of the UPS being on battery * the battery.charge being less than Y% * the battery.runtime less than S seconds **** I attach a new patch against the current RedHat/CentOS 4.5 /etc/init.d/halt This basically checks for /etc/killpower and if it is there executes: upsdrvctl shutdown I tested it by creating /etc/killpower by hand - it powers off; unfortunately (in my testing) the machine then stayed off, even when I unplugged/plugged in the UPS to the mains. I would like the machine to come back up when power returns, I am not convinced that this setup will do that. **** I attach a patch against the current RedHat/CentOS 4.5 /etc/rc.sysinit This removed the file /etc/killpower on system boot. Without doing that 'upsdrvctl shutdown' would be called on every system reboot. **** I attach my /etc/sysconfig/ups for your interest. **** Cheers -- Alain Williams Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php #include <std_disclaimer.h>
--- halt.orig 2007-07-13 19:02:13.000000000 +0100 +++ halt 2007-07-13 19:32:24.000000000 +0100 @@ -218,13 +218,25 @@ echo $"On the next boot fsck will be forced." fi -if [ "$command" = /sbin/halt -a -r /etc/ups/upsmon.conf -a -f /etc/killpower -a -f /etc/sysconfig/ups ] ; then - . /etc/sysconfig/ups - if [ "$SERVER" = "yes" -a "$MODEL" = "upsdrvctl" ] ; then - /sbin/upsdrvctl shutdown - elif [ "$SERVER" = "yes" -a "$MODEL" != "NONE" -a -n "$MODEL" -a -n "$DEVICE" ] ; then - $MODEL $OPTIONS_HALT -k $DEVICE - fi +[ -f /etc/sysconfig/ups ] && . /etc/sysconfig/ups +[ -z "$UPSMONCONF" ] && UPSMONCONF=/etc/ups/upsmon.conf +[ -z "$POWERDOWNFLAG" ] && POWERDOWNFLAG=/etc/killpower + +if [ "$command" = /sbin/halt -a -r $UPSMONCONF -a -f $POWERDOWNFLAG ] ; then + echo "Killing the power, bye!" + + upsdrvctl shutdown + + echo "Power should now be off ..." + + sleep 120 + + # uh oh... the UPS power-off failed, try to reboot - so we don't get stuck + echo "Trying reboot -- since the power off didn't work" + sleep 2 + reboot + + # Should not get here, but if we do - drop through to the standard halt fi if [ -x /sbin/halt.local ]; then
--- rc.sysinit.orig 2007-05-03 06:38:14.000000000 +0100 +++ rc.sysinit 2007-07-14 00:22:41.000000000 +0100 @@ -812,6 +812,11 @@ # Clean out /. rm -f /fastboot /fsckoptions /forcefsck /.autofsck /halt /poweroff &> /dev/null +# UPS monitoring: +[ -f /etc/sysconfig/ups ] && . /etc/sysconfig/ups +[ -z "$POWERDOWNFLAG" ] && POWERDOWNFLAG=/etc/killpower +rm -f $POWERDOWNFLAG + # Do we need (w|u)tmpx files? We don't set them up, but the sysadmin might... _NEED_XFILES= [ -f /var/run/utmpx -o -f /var/log/wtmpx ] && _NEED_XFILES=1
# POWERDOWNFLAG *must* match that in upsmon.conf POWERDOWNFLAG=/etc/killpower NUTUSER=ups UPSDCONF=/usr/local/ups/etc/upsd.conf UPSMONCONF=/usr/local/ups/etc/upsmon.conf UPSCONF=/usr/local/ups/etc/ups.conf # Because things are installed in /usr/local/: PATH=$PATH:/usr/local/ups/sbin:/usr/local/ups/bin
_______________________________________________ Nut-upsuser mailing list Nut-upsuser@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser