Temat: UPS + NUT - co i jak

Cześć, tak jak w temacie UPS marki powercom model BNT-600AP. NUT skompilowany z najnowszego trunka, zainstalowane pakiety: nut, nut-compat, nut-server, nut-powercom, nut-usbhid-ups. Konfingi:

upsd.conf

# Network UPS Tools: example upsd configuration file
#
# This file contains access control data, you should keep it secure.
#
# It should only be readable by the user that upsd becomes.  See the FAQ.
#
# Each entry below provides usage and default value.

# =======================================================================
# MAXAGE <seconds>
 MAXAGE 15
#
# This defaults to 15 seconds.  After a UPS driver has stopped updating
# the data for this many seconds, upsd marks it stale and stops making
# that information available to clients.  After all, the only thing worse
# than no data is bad data.
#
# You should only use this if your driver has difficulties keeping
# the data fresh within the normal 15 second interval.  Watch the syslog
# for notifications from upsd about staleness.

# =======================================================================
# STATEPATH <path>
 STATEPATH /var/run/nut
#
# Tell upsd to look for the driver state sockets in 'path' rather
# than the default that was compiled into the program.

# =======================================================================
# LISTEN <address> [<port>]
 LISTEN 127.0.0.1 3493
 LISTEN ::1 3493
#
# This defaults to the localhost listening addresses and port 3493.
# In case of IP v4 or v6 disabled kernel, only the available one will be used.
#
# You may specify each interface you want upsd to listen on for connections,
# optionally with a port number.
#
# You may need this if you have multiple interfaces on your machine and
# you don't want upsd to listen to all interfaces (for instance on a
# firewall, you may not want to listen to the external interface).
#
# This will only be read at startup of upsd.  If you make changes here,
# you'll need to restart upsd, reload will have no effect.

# =======================================================================
# MAXCONN <connections>
 MAXCONN 1024
#
# This defaults to maximum number allowed on your system.  Each UPS, each
# LISTEN address and each client count as one connection.  If the server
# runs out of connections, it will no longer accept new incoming client
# connections.  Only set this if you know exactly what you're doing.

# =======================================================================
# CERTFILE <certificate file>
#
# When compiled with SSL support, you can enter the certificate file here.
# The certificates must be in PEM format and must be sorted starting with
# the subject's certificate (server certificate), followed by intermediate
# CA certificates (if applicable_ and the highest level (root) CA. It should
# end with the server key. See 'docs/security.txt' or the Security chapter of
# NUT user manual for more information on the SSL support in NUT.

nut.conf

# Network UPS Tools: example nut.conf
#
##############################################################################
# General section
##############################################################################
# The MODE determines which part of the NUT is to be started, and which
# configuration files must be modified.
#
# This file try to standardize the various files being found in the field, like
# /etc/default/nut on Debian based systems, /etc/sysconfig/ups on RedHat based
# systems, ... Distribution's init script should source this file to see which
# component(s) has to be started.
#
# The values of MODE can be:
# - none: NUT is not configured, or use the Integrated Power Management, or use
#   some external system to startup NUT components. So nothing is to be started.
# - standalone: This mode address a local only configuration, with 1 UPS 
#   protecting the local system. This implies to start the 3 NUT layers (driver,
#   upsd and upsmon) and the matching configuration files. This mode can also
#   address UPS redundancy.
# - netserver: same as for the standalone configuration, but also need
#   some more network access controls (firewall, tcp-wrappers) and possibly a
#   specific LISTEN directive in upsd.conf.
#   Since this MODE is opened to the network, a special care should be applied
#   to security concerns.
# - netclient: this mode only requires upsmon.
#
# IMPORTANT NOTE:
#  This file is intended to be sourced by shell scripts.
#  You MUST NOT use spaces around the equal sign!

MODE=standalone

Przy odpaleniu upsd otrzymuję:

root@Gargoyle:~# upsd
Network UPS Tools upsd 2.6.5
fopen /var/run/upsd.pid: No such file or directory
listening on ::1 port 3493
listening on 127.0.0.1 port 3493
/var/run/nut is world readable
Can't connect to UPS [domowy] (powercom-domowy): No such file or directory
/etc/nut/upsd.users is world readable

Kierowałem się tym poradnikiem: http://www.blasterspike.it/2011/03/28/h … k-meerkat/

lecz niestety przy chownie mam błędy, że nie ma takiego użytkownika. Czy ktoś może nakierować na prawidłową ścieżkę? Pozdrawiam Bartek!

2

Odp: UPS + NUT - co i jak

UPS APC Back-UPS ES 700, obsługiwany przez usbhid. U mnie całość wygląda tak (pakiety są u mnie w repo:

opkg install nut-client  nut-driver-usbhid-ups nut nut-server

Konfiguracja

/etc/config/ups

config driver 'domowy'
    option driver 'usbhid-ups'
    option port 'auto'
    option desc 'Back-UPS ES 700'

config user
    option username 'guest'
    option upsmon 'slave'
    option password 'guest'

/etc/nut/nut.conf

MODE=netserver

/etc/nut/upsd.conf (jako że ipv6 nie używam)

LISTEN 127.0.0.1 3493

To wszystko. Przy uruchomieniu krzyczy not found, do zignorowania,

root@Gargoyle:~# /etc/init.d/ups start
Network UPS Tools upsd 2.6.5-Unversioned directory
fopen /var/run/upsd.pid: No such file or directory
listening on 127.0.0.1 port 3493
/var/run is world readable
Can't connect to UPS [domowy] (usbhid-ups-domowy): No such file or directory
/etc/nut/upsd.users is world readable
Network UPS Tools - UPS driver controller 2.6.5-Unversioned directory
Network UPS Tools - Generic HID driver 0.38 (2.6.5-Unversioned directory)
USB communication driver 0.31
Using subdriver: APC HID 0.95

A wynikiem jest

root@Gargoyle:~# upsc -l
domowy
root@Gargoyle:~# upsc domowy
battery.charge: 94
battery.charge.low: 10
battery.charge.warning: 50
battery.date: not set
battery.mfr.date: 2013/05/27
battery.runtime: 2310
battery.runtime.low: 120
battery.type: PbAc
battery.voltage: 13.3
battery.voltage.nominal: 12.0
device.mfr: APC
device.model: Back-UPS ES 700
device.serial: 5B0710U03272  
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.version: 2.6.5-Unversioned directory
driver.version.data: APC HID 0.95
driver.version.internal: 0.38
input.sensitivity: medium
input.transfer.high: 266
input.transfer.low: 180
input.voltage: 232.0
input.voltage.nominal: 230
ups.beeper.status: disabled
ups.delay.shutdown: 20
ups.firmware: 829.D2.I
ups.firmware.aux: D2
ups.load: 2
ups.mfr: APC
ups.mfr.date: 2007/03/06
ups.model: Back-UPS ES 700
ups.productid: 0002
ups.serial: 5B0710U03272  
ups.status: OL CHRG
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d
Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

3 (edytowany przez Bartekk 2014-06-19 19:53:30)

Odp: UPS + NUT - co i jak

Zrobiłem ctrl + c / ctrl + v i otrzymuje

root@Gargoyle:/etc/config# /etc/init.d/ups start
Network UPS Tools upsd 2.6.5
fopen /var/run/upsd.pid: No such file or directory
listening on ::1 port 3493
listening on 127.0.0.1 port 3493
/var/run/nut is world readable
Can't connect to UPS [domowy] (powercom-domowy): No such file or directory
/etc/nut/upsd.users is world readable
Network UPS Tools - UPS driver controller 2.6.5
Network UPS Tools - PowerCom protocol UPS driver 0.13 (2.6.5)

Unable to open auto: No such file or directory

Things to try:

 - Check 'port=' in ups.conf

 - Check owner/permissions of all parts of path

Fatal error: unusable configuration
Driver failed to start (exit status=1)

Zmieniłem driver na powercom.

4

Odp: UPS + NUT - co i jak

Oczywiście nie, nie zrobiłeś. Widać to chociaż by po tym że na ipv6 nasłuchuje, nie mówiąc o driverze Powercom którego u mnie nie było. Więc pytam się - jakie ctrl + c / ctrl + v i czemu tak paskudnie zmyślasz? smile

PS. Z dokumentacji (której nie przeczytałeś...) wynika że BNT-600AP jest przez usbhid właśnie obsługiwany (eksperymentalnie) a nie sterownik powercoma.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

5 (edytowany przez Bartekk 2014-06-19 20:03:31)

Odp: UPS + NUT - co i jak

Faktycznie, wkleiłem cześć do plików z kopii zapasowej big_smile Po poprawkach:

root@Gargoyle:~# /etc/init.d/ups start
Network UPS Tools upsd 2.6.5
fopen /var/run/upsd.pid: No such file or directory
listening on 127.0.0.1 port 3493
/var/run is world readable
Can't connect to UPS [domowy] (powercom-domowy): No such file or directory
/etc/nut/upsd.users is world readable
Network UPS Tools - UPS driver controller 2.6.5
Network UPS Tools - PowerCom protocol UPS driver 0.13 (2.6.5)

Unable to open auto: No such file or directory

Things to try:

 - Check 'port=' in ups.conf

 - Check owner/permissions of all parts of path

Fatal error: unusable configuration

PS

Cezary napisał/a:

PS. Z dokumentacji (której nie przeczytałeś...) wynika że BNT-600AP jest przez usbhid właśnie obsługiwany (eksperymentalnie) a nie sterownik powercoma.


Nieprawda, bo czytałem. Mój ups ma product id: 0002, a do tego przy usbhid wywala

This Powercom device (0d9f/0002) is not supported by usbhid-ups.
Please use the 'powercom' driver instead.

No matching HID UPS found
Driver failed to start (exit status=1)

6

Odp: UPS + NUT - co i jak

Port zmień na /dev/ttyUSB0 czy jaki tam masz, choć wg sterownika on tam rsa normalnego oczekuje.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

7

Odp: UPS + NUT - co i jak

USB.

8 (edytowany przez Bartekk 2014-06-19 20:21:56)

Odp: UPS + NUT - co i jak

W tym problem, że właśnie żadnego ttyUSB nie mam w systemie. W aplikacji na windowsa wszystko działa.

9

Odp: UPS + NUT - co i jak

wpisz sobie /lib/nut/powecom -h spróbuj to z palca uruchomić.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

10

Odp: UPS + NUT - co i jak

Coś takiego wywaliło:

root@Gargoyle:/dev# /lib/nut/powercom -h
Network UPS Tools - PowerCom protocol UPS driver 0.13 (2.6.5)

usage: powercom -a <id> [OPTIONS]
  -a <id>        - autoconfig using ups.conf section <id>
                 - note: -x after -a overrides ups.conf settings

  -V             - print version, then exit
  -L             - print parseable list of driver variables
  -D             - raise debugging level
  -q             - raise log level threshold
  -h             - display this help
  -k             - force shutdown
  -i <int>       - poll interval
  -r <dir>       - chroot to <dir>
  -u <user>      - switch to <user> (if started as root)
  -x <var>=<val> - set driver variable <var> to <val>
                 - example: -x cable=940-0095B

Acceptable values for -x or ups.conf in this driver:

Type of UPS: 'Trust','Egys','KP625AP','IMP','KIN','BNT','BNT-other'
 (default: 'Trust') : -x type=<value>
 Manufacturer name (default: 'PowerCom') : -x manufacturer=<value>
Model name [cannot be detected] (default: Unknown) : -x modelname=<value>
Serial number [cannot be detected] (default: Unknown) : -x serialnumber=<value>
Delay values for shutdown: Minutes, Seconds, UseMinutes?'y'or'n' : -x shutdownArguments=<value>
Line voltage 110-120 or 220-240 V (default: 230) : -x linevoltage=<value>
      The number of bytes in a UPS frame : -x numOfBytesFromUPS=<value>
Flow control method for UPS: 'dtr0rts1' or 'no_flow_control' : -x methodOfFlowControl=<value>
Validation values: ByteIndex, ByteValue x 3 : -x validationSequence=<value>
Frequency conversion values: FreqFactor, FreqConst : -x frequency=<value>
Load conversion values: OffFactor, OffConst, OnFactor, OnConst : -x loadPercentage=<value>
Battery conversion values: OffFactor, LoadFactor, OffConst, OnFactor, OnConst : -x batteryPercentage=<value>
Voltage conversion values: 240VFactor, 240VConst, 120VFactor, 120VConst : -x voltage=<value>

Specify UPS information in the ups.conf file.
 type:          Type of UPS: 'Trust','Egys','KP625AP','IMP','KIN','BNT',
                 'BNT-other' (default: 'Trust')
                'BNT-other' is a special type intended for BNT 100-120V models,
                 but can be used to override ALL models.
You can additional specify these variables:
 manufacturer:  Manufacturer name (default: 'PowerCom')
 modelname:     Model name (default: 'Unknown' or autodetected)
 serialnumber:  Serial number (default: Unknown)
 shutdownArguments: 3 delay arguments for the shutdown operation:
                 {{Minutes,Seconds},UseMinutes?}
                where Minutes and Seconds are integer, UseMinutes? is either
                 'y' or 'n'.
You can specify these variables if not automagically detected for types
                'IMP','KIN','BNT'
 linevoltage:   Line voltage: 110-120 or 220-240 (default: 230)
 numOfBytesFromUPS: Number of bytes in a UPS frame: 16 is common, 11 for 'Trust'
 methodOfFlowControl: Flow control method for UPS:
                'dtr0rts1', 'dtr1' or 'no_flow_control'
 validationSequence: 3 pairs of validation values: {{I,V},{I,V},{I,V}}
                where I is the index into BytesFromUPS (see numOfBytesFromUPS)
                  and V is the value for the ByteIndex to match.
 frequency:     Input & Output Frequency conversion values: {A, B}
                 used in function: 1/(A*x+B)
                If the raw value x IS the frequency, then A=1/(x^2), B=0
 loadPercentage: Load conversion values for Battery and Line load: {BA,BB,LA,LB}
                 used in function: A*x+B
                If the raw value x IS the Load Percent, then A=1, B=0
 batteryPercentage: Battery conversion values for Battery and Line power:
                 {A,B,C,D,E}
                 used in functions: (Battery) A*x+B*y+C, (Line) D*x+E
                If the raw value x IS the Battery Percent, then
                 A=1, B=0, C=0, D=1, E=0
 voltage:       Voltage conversion values for 240 and 120 voltage:
                 {240A,240B,120A,120B}
                 used in function: A*x+B
                If the raw value x IS HALF the Voltage, then A=2, B=0

Example for BNT1500AP in ups.conf:
[BNT1500AP]
    driver = powercom
    port = /dev/ttyS0
    desc = "PowerCom BNT 1500 AP"
    manufacturer = PowerCom
    modelname = BNT1500AP
    serialnumber = 13245678900
    type = BNT-other
#   linevoltage = 120
#   numOfBytesFromUPS = 16
#   methodOfFlowControl = no_flow_control
#   validationSequence = {{8,0},{8,0},{8,0}}
#   shutdownArguments = {{1,30},y}
#   frequency = {0.00027778,0.0000}
#   loadPercentage = {1.0000,0.0,1.0000,0.0}
#   batteryPercentage = {1.0000,0.0000,0.0000,1.0000,0.0000}
#   voltage = {2.0000,0.0000,2.0000,0.0000}

11

Odp: UPS + NUT - co i jak

/lib/nut/powercom -a domowy -x type=BNT

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

12

Odp: UPS + NUT - co i jak

root@Gargoyle:/dev# /lib/nut/powercom -a domowy -x type=BNT
Network UPS Tools - PowerCom protocol UPS driver 0.13 (2.6.5)

Unable to open /dev/ttyUSB0: No such file or directory

Things to try:

 - Check 'port=' in ups.conf

 - Check owner/permissions of all parts of path

Fatal error: unusable configuration

13

Odp: UPS + NUT - co i jak

Port zmień znów na auto i tak go nie masz.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

14

Odp: UPS + NUT - co i jak

root@Gargoyle:/dev# /lib/nut/powercom -a domowy -x type=BNT
Network UPS Tools - PowerCom protocol UPS driver 0.13 (2.6.5)

Unable to open auto: No such file or directory

Things to try:

 - Check 'port=' in ups.conf

 - Check owner/permissions of all parts of path

Fatal error: unusable configuration

15

Odp: UPS + NUT - co i jak

Zainstaluj sobie kmod-usb-serial-cypress-m8 bo to on obsługuje ten powercom, będziesz miał interfejs szeregowy. Wtedy go w konfigu wymień.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

16

Odp: UPS + NUT - co i jak

Faktycznie, interfejs się pojawił lecz nadal otrzymuję

root@Gargoyle:/dev# /lib/nut/powercom -a domowy -x type=BNT
Network UPS Tools - PowerCom protocol UPS driver 0.13 (2.6.5)
writing error
writing error

17

Odp: UPS + NUT - co i jak

Sterownik nie chce gadać z upsem, nie przedstawia się w ogóle.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

18 (edytowany przez Bartekk 2014-06-19 21:01:26)

Odp: UPS + NUT - co i jak

Jak odpalę go przez /etc/init.d/ups start to mam:

root@Gargoyle:/dev# /etc/init.d/ups start
Network UPS Tools upsd 2.6.5
fopen /var/run/upsd.pid: No such file or directory
listening on 127.0.0.1 port 3493
/var/run is world readable
Can't connect to UPS [domowy] (powercom-domowy): No such file or directory
/etc/nut/upsd.users is world readable
Network UPS Tools - UPS driver controller 2.6.5
Network UPS Tools - PowerCom protocol UPS driver 0.13 (2.6.5)
writing error

Logread wali ciągle tym:

Jun 19 21:00:41 Gargoyle daemon.notice powercom[21015]: data receiving error (validation check)
Jun 19 21:00:43 Gargoyle daemon.notice powercom[21015]: data receiving error (validation check)
Jun 19 21:00:45 Gargoyle daemon.notice powercom[21015]: data receiving error (validation check)

Da się coś jeszcze z tym wymodzić?

19

Odp: UPS + NUT - co i jak

Nie wiem. Zmuś powercom jakoś żeby chciał z upsem.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.