Subject: Re: SUCCESS ! Re: Installing a UPS for a NetBSD server... software
To: Asmodehn Shade <asmodehn@gmail.com>
From: Gilles Gravier <Gilles@Gravier.org>
List: netbsd-users
Date: 05/26/2007 10:12:11
This is a multi-part message in MIME format.
--------------030505080904080403020603
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

The problem with the master/slave code I also got. I had to tweak my 
apcupsd.conf... The result is the attached one, which works. You should 
be able to use it more or less as is.

Look in particular at the end section of the file... for network 
configuration.

Gilles.

Asmodehn Shade wrote:
> Hi Gilles and netbsd folks ;)
>
> Well I guess I am trying to do the smae than you are... Here is where I am at, trying to make my APC BackUPS RS 1000 to work with either apcupsd or ups-nut :
> - apcupsd : detected fine, but got the error as well about the master/slave code disabled. A bit annoying as I will have another machine on the smae UPS. It seems also that this prevents the daemon to run. ps -aux | grep apcupsd returns nothing...
> - ups-nut and ups-nut-usb : driver = newhidups -> which port to use ?
>
> Did you make any progress on your side since then ?
>
> Thanks a lot for your help,
>
> --
> Asmodehn
>
> On Fri, 27 Apr 2007 22:02:38 +0200
> Gilles Gravier <Gilles@Gravier.org> wrote:
>
>   
>> Wooooooooooooooooooohooooooooooooooooo!
>>
>> OK. I got ugen0 detection once I removed all the uhidev stuff from my 
>> kernel configuration file. When I had uhidev present, the UPS would 
>> always be detected as uhidev not ugen.
>>
>> Then, with that, I set USBTYPE and CABLE to usb for apcupsd.conf ... and 
>> it WORKS! :)
>>
>> OK... So building a kernel wasn't too hard. :)
>>
>> Now... anybody can tell me how to get nut-ups to work with the same? 
>> Seems that nut-ups uses driver hidups (so should I get back to having my 
>> UPS detected as uhidev?)... but what port to use?
>>
>> I get :
>>
>>     bash-3.2# upsd -D -D -f
>>     Network UPS Tools upsd 2.0.4
>>     Can't connect to UPS [apc] (hidups-usb): No such file or directory
>>     Synchronizing........ giving up
>>
>>
>> Not looking good.
>>
>> Gilles
>>
>> Steven M. Bellovin wrote:
>>     
>>> On Mon, 23 Apr 2007 14:27:33 +0200
>>> Gilles Gravier <Gilles@Gravier.org> wrote:
>>>
>>>   
>>>       
>>>> Steve,
>>>>
>>>> Can you help me there? How do you use that specific line? In what?
>>>>
>>>>     
>>>>         
>>> That goes in a kernel config file, for any system 4.0beta or later.
>>> (That describes all of my machines -- I upgraded the last one
>>> yesterday to let it talk to at UPS.)  You then build a custom kernel
>>> according to the instructions in the NetBSD guide.
>>>
>>> Here's my config file on that machine:
>>>
>>>   include "arch/i386/conf/GENERIC"
>>>
>>>   options         SHMMAXPGS=32768 # 2048 pages is the default
>>>   options         IPSEC           # IP security
>>>   options         IPSEC_ESP       # IP security (encryption part; define w/IPSEC)
>>>   options         PCKBD_LAYOUT="(KB_US | KB_SWAPCTRLCAPS)"
>>>   options         HZ=1000
>>>
>>>   ugen*   at uhub? port ? vendor "0x051d" flags 1
>>>
>>> Note the 'include' line -- it saves a lot of trouble if you're willing
>>> to accept all of the unnecessary drivers in GENERIC.  (I am -- trimming
>>> it down would save me very little memory, as such things go.)
>>>
>>>
>>> 		--Steve Bellovin, http://www.cs.columbia.edu/~smb
>>>   
>>>       
>> -- 
>> /*Gilles Gravier*/ *=* *Gilles@Gravier.org* <mailto:Gilles@Gravier.org> 
>> *=* *http://www.gravier.org/*
>> ICQ : *77488526* 
>> <http://www.icq.com/whitepages/about_me.php?Uin=77488526> * || *MSN 
>> Messenger : Gilles@Gravier.org <http://members.msn.com/Gilles@Gravier.org>*
>> *Skype : ggravier <callto://ggravier>* || *Y! : ggravier 
>> <http://profiles.yahoo.com/ggravier> || AOL : gillesgravier 
>> <aim:goim?screenname=gillesgravier>
>> PGP Key ID : *0x8DE6D026* 
>> <http://pgp.mit.edu:11371/pks/lookup?search=0x8DE6D026&op=index>
>> "Chastity is its own punishment." (/Solomon Short/) [/David Gerrold/]
>> "De toutes les aberrations sexuelles, la chasteté est la plus 
>> aberrante." [Anatole France]
>>
>>     
>
>   

-- 
/*Gilles Gravier*/ *=* *Gilles@Gravier.org* <mailto:Gilles@Gravier.org> 
*=* *http://www.gravier.org/*
ICQ : *77488526* 
<http://www.icq.com/whitepages/about_me.php?Uin=77488526> * || *MSN 
Messenger : Gilles@Gravier.org <http://members.msn.com/Gilles@Gravier.org>*
*Skype : ggravier <callto://ggravier>* || *Y! : ggravier 
<http://profiles.yahoo.com/ggravier> || AOL : gillesgravier 
<aim:goim?screenname=gillesgravier>
PGP Key ID : *0x8DE6D026* 
<http://pgp.mit.edu:11371/pks/lookup?search=0x8DE6D026&op=index>
My Last Known Position / Ma Derniere Position Connue 
<http://www.gmap-track.com/user.php?user=ggravier>
"Chastity is its own punishment." (/Solomon Short/) [/David Gerrold/]
"De toutes les aberrations sexuelles, la chasteté est la plus 
aberrante." [Anatole France]


--------------030505080904080403020603
Content-Type: text/plain;
 name="apcupsd.conf"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="apcupsd.conf"

## apcupsd.conf v1.1 ##
# 
#  for apcupsd release 3.8.0
#
# "apcupsd" POSIX config file
#
#  If you have used a prior version of apcupsd, the CONTROL script file
#  (/sbin/powersc) has now been replaced by /etc/apcupsd/apccontrol.
#  Consequently, the CONTROL configuration statement is obsolete.
#  The following configuration statements have been replaced by scripts
#  called from /etc/apcupsd/apccontrol, and thus are obsolete:
#  BATTCMD, LIMITCMN, LOADCMD, PWRCMD, REBOOTCMD, REMOTECMD, RETCMD,
#  and TIMECMD. 
#
#
#
# ========= General configuration parameters ============
#
# UPSCABLE [ simple | smart |
#            940-00(20B,23A,24B,24C,24G,95A,95B,95C) |
#            940-15(24C) |
#            ether ]
# defines the type of cable that you have.
UPSCABLE usb
#
# UPSTYPE [ backups | sharebasic | netups |
#           backupspro | smartvsups |
#           newbackupspro | backupspropnp |
#           smartups | matrixups | sharesmart ]
# defines the type of UPS you have.
UPSTYPE usb
#
#
#DEVICE <string> /dev/<serial port>
# name of your serial port
#DEVICE /dev/tty00
#
#LOCKFILE <path to lockfile>
# path for serial port lock file
LOCKFILE /var/spool/lock
#
#
#
# ======== configuration parameters used during power failures ==========
#
# BATTERYLEVEL <percent of battery charge for shutdown> 10
BATTERYLEVEL 15
#
# MINUTES <time in minutes of remaining battery runtime before shutdown> 5
MINUTES 5
#
# TIMEOUT <time is seconds to run on UPS after a power failure>
#  Note, if you have a Smart UPS, you will most likely want to disable
#    this timer by setting it to zero. That way, you UPS will continue
#    on batteries until either the % charge remaing drops below BATTERYLEVEL,
#    or the remaining battery runtime drops below MINUTES.  Of course,
#    if you are testing, setting this to 60 causes a quick system shutdown
#    if you pull the power plug.   
#  If you have an older dumb UPS, you will want to set this to less than
#    the time you know you can run on batteries.
TIMEOUT 0

#
# ANNOY <int> <30> <0> disables
#  Time in seconds between annoying users to signoff prior to
#  system shutdown.
ANNOY 300
#
# ANNOYDELAY <int> <60> <0> disables delay before annoying user
ANNOYDELAY 60
#
# NOLOGON <string> [ disable | timeout | percent | minutes | always ]
NOLOGON disable
#
#
#
# ==== Configuration statements the network information server =========
#
# NETSERVER [ on | off ] on enables, off disables the network
#  information server. If netstatus is on, a network information
#  server process will be started for serving the STATUS and
#  EVENT data over the network (used by CGI programs).
NETSERVER on
#
# SERVERPORT <port> default is 7000
#  port to use for sending STATUS and EVENTS data over the network.
#  It is not used unless NETSERVER is on. If you change this port,
#  you will need to change the corresponding value in the cgi directory
#  and rebuild the cgi programs.
SERVERPORT 3551
#
# If you want the last few EVENTS to be available over the network
# by the network information server, you must define an EVENTSFILE.
EVENTSFILE /var/log/apcupsd.events
#
#
#
#
# ===== Configuration statements to control apcupsd system logging ========
#
# STATTIME <int> <120> <0> disables <update rate in seconds for status file >
STATTIME 0
#
# STATFILE
STATFILE /var/run/apcupsd.status
#
#
# LOGSTATS [ on | off ] on enables, off disables
# Note! This generates a lot of output, so if         
#       you turn this on, be sure that the
#       file defined in syslog.conf for LOG_NOTICE is a named pipe.
LOGSTATS off
#
#
# DATATIME <int> <120> <0> disables <update rate in seconds for data logging >
DATATIME 0
#
# FACILITY defines the logging facility (class) for logging to syslog. 
#          If not specified, it defaults to "daemon". This is useful 
#          if you want to separate the data logged by apcupsd from other
#          programs.
#FACILITY local0
#
#
#
#
#
# ========== Configuration statements used if sharing =============
#            a UPS and controlling it via the network              
#
#      The configuration statements below are used if you
#      want to share one UPS for multiple machines and have them
#      communicate by the network.
#
# UPSCLASS [ standalone | shareslave | sharemaster | netslave | netmaster ]
# normally standalone unless you share a UPS with multiple machines.
UPSCLASS standalone
#
# Unless you want to share the UPS (power multiple machines).
#  this should be disable
# UPSMODE [ disable | share | net | sharenet ]
UPSMODE disable
#
#NETACCESS <string> [ true | false ] Enable Network Access Support
NETACCESS false
#
# NETTIME <int>
NETTIME 10
#
# NETPORT <int>
NETPORT 6666
#
# MASTER <string>
#MASTER
#
## SLAVE <string>
#SLAVE my.network.slave.com
#
# Note, USERMAGIC is only used by a slave, not here
# USERMAGIC <string>
#USERMAGIC
#

--------------030505080904080403020603--