Discussion:
[Nut-upsuser] multiple identical UPS on same server
Marcello Vezzelli
2014-08-13 10:41:24 UTC
Permalink
Hi everyone,

I installed latest version of Nut on Debian Wheezy 64bit.
This is a virtual server hosted by VMware ESXi. It's a Nagios monitoring server.
I configured one Sweex UPS in ups.conf and everything is working.

ups.conf:

[sweex1]
driver = blazer_usb
port = auto
runtimecal = 1100,100,2200,50

Now I want to connect two more identical UPSes to the same server, total of
3 UPSes.
I see from nut documentation that for driver blazer_usb I can specify a Bus
parameter.

root at nagios:~# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 046: ID 0665:5161 Cypress Semiconductor USB to Serial
Bus 002 Device 085: ID 0665:5161 Cypress Semiconductor USB to Serial
Bus 002 Device 098: ID 0665:5161 Cypress Semiconductor USB to Serial

The problem is that all UPSes are connected to the same bus and I cannot
change this, because ESXi gives you only one virtual USB controller.
Unluckily, "serial" field is empty so I cannot use this to detect single UPS.
This is my current configuration, but of course only one UPS is detected and
running.

[sweex1]
driver = blazer_usb
port = auto
runtimecal = 1100,100,2200,50
bus = 002

[sweex2]
driver = blazer_usb
port = auto
runtimecal = 1100,100,2200,50
bus = 002

[sweex3]
driver = blazer_usb
port = auto
runtimecal = 1100,100,2200,50
bus = 002

It would be great if I could specify Device #id (taken from lsusb) in
ups.conf file for each UPS. This way I can identify precisely one UPS in
every case.

Does someone have any hints with my problem?

Thanks in advance.

regards
Marcello
Charles Lepple
2014-08-13 13:14:13 UTC
Permalink
On Wed, Aug 13, 2014 at 6:41 AM, Marcello Vezzelli
Post by Marcello Vezzelli
It would be great if I could specify Device #id (taken from lsusb) in
ups.conf file for each UPS. This way I can identify precisely one UPS in
every case.
Slightly different situation than this, but for reference:

http://article.gmane.org/gmane.comp.monitoring.nut.user/8609

The problem is that the device ID is not stable - it usually increases
monotonically (until it wraps), but it is probably not predictable
enough to be used for anything but monitoring (you wouldn't want to
shut down the wrong UPS).

The libusb-1.0 API has the concept of a "port number" which should be
slightly more stable, but we haven't made plans to transition to that
API. If someone is interested in porting all of the drivers, we could
discuss that.

We have been organizing some of the upsc output that people have
posted to the mailing lists over the years:

http://buildbot.networkupstools.org/~buildbot/cayman/docs/latest/ddl/

This should help when buying to see if the UPS has a unique serial
number available.
--
- Charles Lepple
Charles Lepple
2014-08-13 14:27:18 UTC
Permalink
[please keep the list CC'd. Thanks!]
I noticed that 2 of Sweex UPS have an identical serial number 20100813,
which looks like a date.
The other one has an empty serial number.
The blew one had the serial number, so I'm left with two different UPSes
from the serial number point of view.
I wonder if an empty serial number is a valid serial number!
I haven't tried it, but an empty string (that is, iSerial is not zero,
but the string has length zero) should match the regex "".
--
- Charles Lepple
Marcello Vezzelli
2014-08-14 07:55:17 UTC
Permalink
Post by Charles Lepple
The blew one had the serial number, so I'm left with two different UPSes
from the serial number point of view.
I wonder if an empty serial number is a valid serial number!
I haven't tried it, but an empty string (that is, iSerial is not zero,
but the string has length zero) should match the regex "".
I've found another strange issue that prevented me to test this solution.
VMware ESXi is filtering out serial number information, together with
iManufacturer and iProduct.

This is from lsusb -v done from server host:

Bus 02 Device 07: ID 0665:5161 Cypress Semiconductor USB to Serial
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x0665 Cypress Semiconductor
idProduct 0x5161 USB to Serial
bcdDevice 0.02
iManufacturer 1 INNO TECH
iProduct 2 USB to Serial
iSerial 3 20100813
bNumConfigurations 1

This is from lsusb -v done inside virtual server:

Bus 002 Device 004: ID 0665:5161 Cypress Semiconductor USB to Serial
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x0665 Cypress Semiconductor
idProduct 0x5161 USB to Serial
bcdDevice 0.02
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 1


At this point I'm stuck again.
To support devices connected to VMware virtual servers some extra identifier
is needed.
Serial number won't work even if it is different.

Thanks for your help.
--
Marcello Vezzelli
Software Development Department
E-Works s.r.l.
tel. +39 059 2929081 (ext 18)
fax +39 059 2925035
via G. Di Vittorio, 28
41011 Campogalliano (MO) - Italy
web: http://www.e-works.it
meeting room: http://team.e-works.com/join/m.vezzelli at e-works.it

------------------------------------------------------------------------
Avvertenze ai sensi del D.Lgs.196 del 30/06/2003 Le informazioni
contenute in questo messaggio di posta elettronica e/o files allegati,
sono da considerarsi strettamente riservati. Il loro utilizzo ?
consentito esclusivamente al destinatario del messaggio, per le finalit?
indicate nello stesso. Costituisce violazione ai principi dettati dal
D.Lgs. 196/2003: trattenere il messaggio stesso oltre il tempo necessario,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo od
utilizzarlo per finalit? diverse. Ricordiamo che in ogni momento potrete
richiederci la sospensione da parte nostra dell'impiego dei vostri dati,
ad esclusione delle comunicazioni effettuate in esecuzione di obblighi di
legge. Qualora riceveste questo messaggio senza esserne il destinatario Vi
preghiamo cortesemente di darcene notizia via e-mail e di procedere alla
distruzione del messaggio stesso, cancellandolo dal Vostro sistema
------------------------------------------------------------------------
This e-mail (including attachments) is intended only for the recipient(s)
named above. It may contain confidential or privileged information and
should not be read, copied or otherwise used by any other person. If you are
not the named recipient, please contact the sender immediately and delete
the e-mail from your system.
------------------------------------------------------------------------
Charles Lepple
2014-08-14 12:51:24 UTC
Permalink
This post might be inappropriate. Click to display it.
Marcello Vezzelli
2014-08-14 13:14:29 UTC
Permalink
Post by Charles Lepple
On Thu, Aug 14, 2014 at 3:55 AM, Marcello Vezzelli
Post by Marcello Vezzelli
I've found another strange issue that prevented me to test this solution.
VMware ESXi is filtering out serial number information, together with
iManufacturer and iProduct.
Is it a permissions issue? The NUT udev configuration file changes the
ownership and permissions to allow the NUT system user to write to the
UPS without root permissions, but it might also mean that you would
need to run lsusb as that user (or root).
You're definitely right. Thanks for your hint.

sudo lsusb -v
gives the correct output on virtual server too.

Now, one UPS gives

iProduct 2 USB to Serial
iSerial 3 20100813

while the other

iProduct 2 USB to Serial
iSerial 0

So I modified ups.conf like this:

[sweex2]
driver = blazer_usb
port = auto
runtimecal = 1100,100,2200,50
bus = 002
serial = "20100813"

[sweex3]
driver = blazer_usb
port = auto
runtimecal = 1100,100,2200,50
bus = 002
serial = ""


If I run (as root)

blazer_usb -a sweex2

it works. I get this:

Broadcast Message from nut at nagi
(somewhere) at 15:08 ...
Communications with UPS sweex2 at localhost established

But if I restart ups-monitor service or reboot the server, sweex2 stop
responding.

Broadcast Message from nut at nagi
(somewhere) at 15:09 ...
UPS sweex2 at localhost is unavailable

I'm puzzled.

regards
--
Marcello Vezzelli
Software Development Department
E-Works s.r.l.
tel. +39 059 2929081 (ext 18)
fax +39 059 2925035
via G. Di Vittorio, 28
41011 Campogalliano (MO) - Italy
web: http://www.e-works.it
meeting room: http://team.e-works.com/join/m.vezzelli at e-works.it

------------------------------------------------------------------------
Avvertenze ai sensi del D.Lgs.196 del 30/06/2003 Le informazioni
contenute in questo messaggio di posta elettronica e/o files allegati,
sono da considerarsi strettamente riservati. Il loro utilizzo ?
consentito esclusivamente al destinatario del messaggio, per le finalit?
indicate nello stesso. Costituisce violazione ai principi dettati dal
D.Lgs. 196/2003: trattenere il messaggio stesso oltre il tempo necessario,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo od
utilizzarlo per finalit? diverse. Ricordiamo che in ogni momento potrete
richiederci la sospensione da parte nostra dell'impiego dei vostri dati,
ad esclusione delle comunicazioni effettuate in esecuzione di obblighi di
legge. Qualora riceveste questo messaggio senza esserne il destinatario Vi
preghiamo cortesemente di darcene notizia via e-mail e di procedere alla
distruzione del messaggio stesso, cancellandolo dal Vostro sistema
------------------------------------------------------------------------
This e-mail (including attachments) is intended only for the recipient(s)
named above. It may contain confidential or privileged information and
should not be read, copied or otherwise used by any other person. If you are
not the named recipient, please contact the sender immediately and delete
the e-mail from your system.
------------------------------------------------------------------------
Charles Lepple
2014-08-15 13:24:55 UTC
Permalink
But if I restart ups-monitor service or reboot the server, sweex2 stop responding.
Broadcast Message from nut at nagi
(somewhere) at 15:09 ...
UPS sweex2 at localhost is unavailable
The output of syslog (/var/log/messages or similar) should have some log entries from the driver starting up.
--
Charles Lepple
clepple at gmail
Loading...