[Nut-upsuser] using nut in cacti

2006-07-13 Thread Rodrigo Ventura

Hi. Are there any off-the-shelf solutions to monitor nut ups' with cacti? I 
suppose snmp could be used, but since upsc can be run locally in the cacti 
server, it might be easier to use a simple script.

Cheers,

Rodrigo

-- 

*** Rodrigo Martins de Matos Ventura [EMAIL PROTECTED]
***  Web page: http://www.isr.ist.utl.pt/~yoda
***   Teaching Assistant and PhD Student at ISR:
***Instituto de Sistemas e Robotica, Polo de Lisboa
*** Instituto Superior Tecnico, Lisboa, PORTUGAL
*** PGP fingerprint = 0119 AD13 9EEE 264A 3F10  31D3 89B3 C6C4 60C6 4585

___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


[Nut-upsuser] tracing a problem with newhidups

2006-07-06 Thread Rodrigo Ventura

Hi. I'm having trouble with nut-2.0.3 on a linux kernel 2.4.32 machine and a 
MGE Evolution 3000. The problem is that I'm getting the following message, 
repeatidly, on dmesg:

usbdevfs: usb_submit_urb returned -22

(-22 means -EINVAL)

I traced the problem with newhidups -DD auto and found out that the -22 
error appears in a line none (-22) of the output as:

--
upsdrv_updateinfo...
Waiting for notifications...
 none (-22)
entering string_to_path()
parsing UPS
Looking up UPS
--

The function calls in userspace are:

[newhidups.c] upsdrv_updateinfo()
   [libhid.c] HIDGetEvents()
  [libusb.c] libusb_get_interrupt()
 [libusb] usb_interrupt_read()
[libusb] usb_urb_transfer()

In the usb_urb_transfer() function one can find that

--
urb.number_of_packets = 0;  /* don't do isochronous yet */
urb.usercontext = NULL;

ret = ioctl(dev-fd, IOCTL_USB_SUBMITURB, urb);
--

and in the kernel code of linux/drivers/usb/host/uhci.c:

--
static int uhci_submit_urb(struct urb *urb)
[...]
case PIPE_ISOCHRONOUS:
if (urb-bandwidth == 0) {  /* not yet checked/allocated 
*/
if (urb-number_of_packets = 0) {
ret = -EINVAL;
--

So it seems that setting number_of_packets to zero is directly related with 
the kernel error.

What is going on here? Is it a bug in nut?

Cheers,

Rodrigo

-- 

*** Rodrigo Martins de Matos Ventura [EMAIL PROTECTED]
***  Web page: http://www.isr.ist.utl.pt/~yoda
***   Teaching Assistant and PhD Student at ISR:
***Instituto de Sistemas e Robotica, Polo de Lisboa
*** Instituto Superior Tecnico, Lisboa, PORTUGAL
*** PGP fingerprint = 0119 AD13 9EEE 264A 3F10  31D3 89B3 C6C4 60C6 4585

___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] nutups with MGE Evolution via USB

2006-06-09 Thread Rodrigo Ventura
On Friday 09 June 2006 18:09, Charles Lepple wrote:
 On 6/9/06, Rodrigo Ventura [EMAIL PROTECTED] wrote:
  I'm getting dmesg flooded with messages like this one:
 
  usbdevfs: usb_submit_urb returned -28
 
  What's wrong? I'm using Linux kernel 2.4.32 and nut-2.0.3.

 Can you describe your setup a little more? Do you have other USB
 devices in the system? Are they plugged into the same external or root
 hub?

Sure. The machine is a Compaq Proliant ML350 (G3), P4 Xeon, the UPS is the 
only device on the bus. It is the central server of the institution, running 
all mail (MTA and IMAP), UNIX accounts, and user web pages.

The USB tree is dead simple:

# cat /proc/bus/usb/devices
T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 4
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor= ProdID= Rev= 0.00
S:  Product=USB OHCI Root Hub
S:  SerialNumber=f88ba000
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms
T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=1.5 MxCh= 0
D:  Ver= 1.10 Cls=00(ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0463 ProdID= Rev= 1.00
S:  Manufacturer=MGE UPS SYSTEMS
S:  Product=Evolution
S:  SerialNumber=AF3G03062
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 40mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=20ms

Maybe the server MB is old, and USB not quite supported, or buggy hardware, or 
maybe a BIOS firmware update might help (but I guess the kernel handles the 
USB hardware directly).

Cheers,

Rodrigo


-- 
Rodrigo Ventura
ISR/IST

___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


[Nut-upsuser] MGE Evolution, USB and linux

2006-06-07 Thread Rodrigo Ventura

I have a MGE Evolution 3000 connected via USB to a linux server (HP
Proliant G3). The server is running kernel 2.4.30 and nut-2.0.3. But
before nut trying to connect to the UPS, I guess HID doesn't work as
long as I get a message like this in dmesg:

--
usb.c: new device strings: Mfr=4, Product=136, SerialNumber=50
usb.c: USB device number 2 default language ID 0x409
Manufacturer: MGE UPS SYSTEMS
Product: Evolution
SerialNumber: AF3G03062
usb.c: unhandled interfaces on device
usb.c: USB device 2 (vend/prod 0x463/0x) is not claimed by any active 
driver.

  Length  = 18
  DescriptorType  = 01
  USB version = 1.10
  Vendor:Product  = 0463:
  MaxPacketSize0  = 8
  NumConfigurations   = 1
  Device version  = 1.00
  Device Class:SubClass:Protocol = 00:00:00
Per-interface classes
Configuration:
  bLength =9
  bDescriptorType =   02
  wTotalLength= 0022
  bNumInterfaces  =   01
  bConfigurationValue =   01
  iConfiguration  =   00
  bmAttributes=   e0
  MaxPower=   40mA

  Interface: 0
  Alternate Setting:  0
bLength =9
bDescriptorType =   04
bInterfaceNumber=   00
bAlternateSetting   =   00
bNumEndpoints   =   01
bInterface Class:SubClass:Protocol =   03:00:00
iInterface  =   00
Endpoint:
  bLength =7
  bDescriptorType =   05
  bEndpointAddress=   81 (in)
  bmAttributes=   03 (Interrupt)
  wMaxPacketSize  = 0008
  bInterval   =   14
--

cat /proc/bus/usb/devices:

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 4
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor= ProdID= Rev= 0.00
S:  Product=USB OHCI Root Hub
S:  SerialNumber=f88bb000
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms
T:  Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=1.5 MxCh= 0
D:  Ver= 1.10 Cls=00(ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0463 ProdID= Rev= 1.00
S:  Manufacturer=MGE UPS SYSTEMS
S:  Product=Evolution
S:  SerialNumber=AF3G03062
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 40mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=20ms

So the kernel correctly identifies the device as a HID class, but the
hiddev dev refuses to claim the device.

What's happening here? How can I fix this?

Cheers,

Rodrigo Ventura

-- 

*** Rodrigo Martins de Matos Ventura [EMAIL PROTECTED]
***  Web page: http://www.isr.ist.utl.pt/~yoda
***   Teaching Assistant and PhD Student at ISR:
***Instituto de Sistemas e Robotica, Polo de Lisboa
*** Instituto Superior Tecnico, Lisboa, PORTUGAL
*** PGP fingerprint = 0119 AD13 9EEE 264A 3F10  31D3 89B3 C6C4 60C6 4585

___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] MGE Evolution, USB and linux

2006-06-07 Thread Rodrigo Ventura

Thanks Arnaud.

Now I'm getting the error::


# cat /etc/ups.conf
[mgeups]
driver = newhidups
port = auto
desc = MGE UPS at servers room

# /usr/local/nutups/bin/upsdrvctl start
Network UPS Tools - UPS driver controller 2.0.3
Network UPS Tools: New USB/HID UPS driver 0.28 (2.0.3)

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

How can I figure out what's wrong?

Cheers,

Rodrigo

-- 

*** Rodrigo Martins de Matos Ventura [EMAIL PROTECTED]
***  Web page: http://www.isr.ist.utl.pt/~yoda
***   Teaching Assistant and PhD Student at ISR:
***Instituto de Sistemas e Robotica, Polo de Lisboa
*** Instituto Superior Tecnico, Lisboa, PORTUGAL
*** PGP fingerprint = 0119 AD13 9EEE 264A 3F10  31D3 89B3 C6C4 60C6 4585

___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] MGE Evolution, USB and linux

2006-06-07 Thread Rodrigo Ventura

Let me add the following to my previous email: a strace of upsdrvctl

# strace -ff /usr/local/nutups/bin/upsdrvctl start
execve(/usr/local/nutups/bin/upsdrvctl, [/usr/local/nutups/bin/upsdrvctl, 
start], [/* 34 vars */]) = 0
[...]
[pid  7422] open(/proc/bus/usb/001/002, O_RDONLY) = 5
[pid  7422] read(5, \22\1\20\1\0\0\0\10c\4\377\377\0\1\4\2102\1, 18) = 18
[pid  7422] read(5, \t\2\\0\1\1\0\340, 8) = 8
[pid  7422] read(5, 
\24\t\4\0\0\1\3\0\0\0\t!\0\1!\1\T\6\7\5\201\3\10\0\24..., 26) = 26
[pid  7422] close(5)= 0
[pid  7422] getdents64(4, /* 0 entries */, 4096) = 0
[pid  7422] close(4)= 0
[pid  7422] open(/proc/bus/usb/001/001, O_RDWR) = -1 EACCES (Permission 
denied)
[pid  7422] open(/proc/bus/usb/001/001, O_RDONLY) = 4
[pid  7422] ioctl(4, USBDEVFS_CONTROL, 0xbfffc550) = -1 EPERM (Operation not 
permitted)
[pid  7422] ioctl(4, USBDEVFS_CONTROL, 0xbfffc550) = -1 EPERM (Operation not 
permitted)
[pid  7422] close(4)= 0
[pid  7422] open(/proc/bus/usb/001/002, O_RDWR) = -1 EACCES (Permission 
denied)
[pid  7422] open(/proc/bus/usb/001/002, O_RDONLY) = 4
[pid  7422] ioctl(4, USBDEVFS_CONTROL, 0xbfffc550) = -1 EPERM (Operation not 
permitted)
[pid  7422] ioctl(4, USBDEVFS_CONTROL, 0xbfffc550) = -1 EPERM (Operation not 
permitted)
[pid  7422] ioctl(4, USBDEVFS_CONTROL, 0xbfffc550) = -1 EPERM (Operation not 
permitted)
[pid  7422] ioctl(4, USBDEVFS_CLAIMINTERFACE, 0xbfffc6f4) = -1 EPERM (Operation 
not permitted)
[pid  7422] ioctl(4, USBDEVFS_IOCTL, 0xbfffc6d0) = -1 EPERM (Operation not 
permitted)
[pid  7422] ioctl(4, USBDEVFS_CLAIMINTERFACE, 0xbfffc6f4) = -1 EPERM (Operation 
not permitted)
[pid  7422] ioctl(4, USBDEVFS_IOCTL, 0xbfffc6d0) = -1 EPERM (Operation not 
permitted)
[pid  7422] ioctl(4, USBDEVFS_CLAIMINTERFACE, 0xbfffc6f4) = -1 EPERM (Operation 
not permitted)
[pid  7422] ioctl(4, USBDEVFS_IOCTL, 0xbfffc6d0) = -1 EPERM (Operation not 
permitted)
[pid  7422] ioctl(4, USBDEVFS_CLAIMINTERFACE, 0xbfffc6f4) = -1 EPERM (Operation 
not permitted)
[pid  7422] ioctl(4, USBDEVFS_CONTROL, 0xbfffc6c0) = -1 EPERM (Operation not 
permitted)
[pid  7422] close(4)= 0
[pid  7422] write(2, No matching USB/HID UPS found\n, 30No matching USB/HID 
UPS found
) = 30
[...]

Seems the driver has no R/W permission, probably because of a change
of UID of the driver.

# ls -laF /proc/bus/usb/001/
total 0
dr-xr-xr-x1 root root0 Jun  7 11:07 ./
dr-xr-xr-x1 root root0 Jun  7 11:07 ../
-rw-r--r--1 root root   18 Jun  7 11:07 001
-rw-r--r--1 root root   18 Jun  7 11:07 002

Since this is a usbdevfs, how can I make this read/writable by nutups user?

Cheers,

Rodrigo Ventura

-- 

*** Rodrigo Martins de Matos Ventura [EMAIL PROTECTED]
***  Web page: http://www.isr.ist.utl.pt/~yoda
***   Teaching Assistant and PhD Student at ISR:
***Instituto de Sistemas e Robotica, Polo de Lisboa
*** Instituto Superior Tecnico, Lisboa, PORTUGAL
*** PGP fingerprint = 0119 AD13 9EEE 264A 3F10  31D3 89B3 C6C4 60C6 4585

___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser