DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2007-12-27 15:18:59

fmenard123
New member
Registered: 2007-12-26
Posts: 4

UPS support

Folks,

Having installed fon_plug & mediatomb, I now feel up for re-igniting the discussion on APCUPSD suport.

1) would APCUPSD work in a Debian CHROOT environment?

2) Can anyone build APCUPSD?  I'm still not ready for the cross-compile stuff...

3) Am I the only one out there wishing for my DNS-323 to gracefully shut down upon power loss?

-=Francois=-

Offline

 

#2 2007-12-28 00:33:28

peterjb
Member
Registered: 2007-12-28
Posts: 7

Re: UPS support

I was thinking of having a crack at this over the next week or so.. :-) I was particularly looking at using NUT ( even though I have an APC UPS ) as it  now supports a number of different vendors USB UPSs through the use of libusb rather than requiring any extra kernel or hotplug related work..

I'll let you know how I get on..

Cheers

   Peter

Offline

 

#3 2007-12-28 01:07:20

gareth
Member
Registered: 2007-06-28
Posts: 50

Re: UPS support

Excellant news, keep me posted. I've a APC UPS with AP9617 network management card. If the DNS's could shutdown from an SMNP event that would be awesome!

Offline

 

#4 2007-12-31 07:49:15

fmenard123
New member
Registered: 2007-12-26
Posts: 4

Re: UPS support

Awaiting a more intelligent solution, I just ended up stringing a new electrical circuit from my UPS nearby my computer to my DNS-323 located above my Cat5 wiring closet in the basement. With this circuit, I power up my DNS-323 from the same UPS than my computer.  I saved the cost of a new UPS at the expense of drawing into my surplus of electrical BX wire.  Anyhow, I have a good UPS at my PC with 650 watts capacity... my PC was drawing about 200 watts, so I had enough surplus for the 323.  Anyways, I created the following script and placed it into the start directory of fun_plug.  It pings my PC and starts by sleeping 2 minutes. The way I see this, I have two minutes to get something for the 323 to ping at 192.168.1.5 in order for it to stay up, or otherwise, with this script, it will always remain in a shutdown loop.  Question: is there any way for the 323 to turn on automatically upon my UPS drawing down, dying, and then power coming back up, just like my PC?

/mnt/HD_a2/fun_plug.d/start # ls -la
-rwxr-xr-x    1 root     root          120 Dec 31 00:30 00ups.sh
/mnt/HD_a2/fun_plug.d/start # more 00ups.sh
#!/bin/sh
while true
do
sleep 120
/bin/ping -c 2 192.168.1.5
UP=$?
if test $UP -eq 1 ; then
touch /tmp/shutdown
fi
done

That's all folks (for the moment)

F.

Offline

 

#5 2007-12-31 16:13:11

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: UPS support

If you put that script into the start directory, it will block all other scripts. Scripts in start are run one by one, and are not supposed to loop and block forever.

Offline

 

#6 2008-01-04 01:54:59

peterjb
Member
Registered: 2007-12-28
Posts: 7

Re: UPS support

Just a quick Update.. I have managed to cross compile both  libusb & NUT..  Which was at times a bit of a struggle :-) So I'm now in a position to start some configuration & testing work..

Cheers

  Peter

Offline

 

#7 2008-01-04 10:26:55

gareth
Member
Registered: 2007-06-28
Posts: 50

Re: UPS support

that's good news Peter. Keep us updated with your progress.

Offline

 

#8 2008-01-07 14:18:33

peterjb
Member
Registered: 2007-12-28
Posts: 7

Re: UPS support

I have managed to successfully compile, configure and deploy NUT & libusb under funplug-0.3 accessing my APC Back-UPS ES 550 - and it works a treat!!  I have the  NUT daemons & drivers currently running under root, as I haven't quite sorted out the user access required to run it under an alternate userid.  The issue appears to be related to update access to /proc/bus/usb and it's sub-directories.  At this stage I also  haven't  stripped the executables & libraries.

I'm more than happy to share the results of my exploits to date and the relevant instructions on how I got this far :-).  I'm assuming that the wiki would be the best place to place these details, is there a facility available for me to upload the relevant tar.gz install package?

Cheers

   Peter

Last edited by peterjb (2008-01-07 14:38:32)

Offline

 

#9 2008-01-07 15:40:45

gareth
Member
Registered: 2007-06-28
Posts: 50

Re: UPS support

Peter, I assume that it shutsdown the DNS-323 via the USB cable. I'm using a APC SmartUPS 1500 and I was wondering if there is anyway that the module could be made to understand the APC network shutdown packet. What do you think?
Gareth.

Offline

 

#10 2008-01-08 14:18:52

peterjb
Member
Registered: 2007-12-28
Posts: 7

Re: UPS support

Gareth,

The shutdown is currently via a local USB cable connection when running the ups in nut 'master' mode.  But if you implemented a 'master-slave' configuration with nut you could have multiple devices on the network with only one device ups cabled via USB and the others merely 'listening' for shutdown requests. This is what I'm planning to do with my two DNS-323 units..

This 'master-slave' nut configuration appears to be similar to that supported by the apcupsd package.  From what I've read, it would appear that apcupsd supports the use of the APC network shutdown packet, but doesn't support libusb and is thus dependent upon various usb kernel modules & drivers within the apcupsd package for ups support..

There is an snmp driver within nut ( which uses libsnmp ), which queries existing SNMP agents.. Information on it appears to be a bit scarce, but I can try and compile it in and you can see how it goes??

Cheers

  Peter

Offline

 

#11 2008-01-08 14:24:43

gareth
Member
Registered: 2007-06-28
Posts: 50

Re: UPS support

I definately would be interested to try it if you were able to compile it in. I don't use any usb cables at all so it be interesting to see if it works just via the APC network SNMP packets.

Offline

 

#12 2008-01-08 18:01:28

mig
Member
From: Seattle, WA
Registered: 2006-12-21
Posts: 532

Re: UPS support

peterjb wrote:

I'm more than happy to share the results of my exploits to date and the relevant instructions on how I got this far :-).  I'm assuming that the wiki would be the best place to place these details, is there a facility available for me to upload the relevant tar.gz install package?

This is great progress, peter!! I'm eagerly awaiting your writeup, I'd love to get UPS support on my DNS-323.


DNS-323 • 2x Seagate Barracuda ES 7200.10 ST3250620NS 250GB SATAII (3.0Gb/s) 7200RPM 16MB • RAID1 • FW1.03 • ext2 
Fonz's v0.3 fun_plug http://www.inreto.de/dns323/fun-plug

Offline

 

#13 2008-01-12 04:02:06

peterjb
Member
Registered: 2007-12-28
Posts: 7

Re: UPS support

Just a quick update, trying to build the snmp support in nut has had me pulling my hair out a bit..  The libsnmp build went OK, but the snmp driver support in nut requires the use of libwrap which is proving to be a PIA to cross compile at the moment.

As such I'll document all the usb ups related stuff and post it and then continue to bash away at snmp support...

Cheers

   Peter

Offline

 

#14 2008-01-13 09:25:57

blabber666
New member
Registered: 2008-01-13
Posts: 3

Re: UPS support

Quick question, when you guys finish this little UPS project, will your fix be able to shutdown the DNS from a windows environment?

example: XP machine monitors UPS, when it shuts down it also sends a shutdown command to the DNS.  Or does your fix monitor the UPS directly........and if thats true is there a way to shutdown a windows machine from the DNS??


Note: I'm a basic Linux noob, I am currently useing Fonz's fun_plug and the mldonkey addon so far.

Last edited by blabber666 (2008-01-13 09:27:48)

Offline

 

#15 2008-07-14 13:24:36

icarus
New member
Registered: 2008-04-02
Posts: 3

Re: UPS support

peterjb wrote:

I have managed to successfully compile, configure and deploy NUT & libusb under funplug-0.3 accessing my APC Back-UPS ES 550 - and it works a treat!!  I have the  NUT daemons & drivers currently running under root, as I haven't quite sorted out the user access required to run it under an alternate userid.  The issue appears to be related to update access to /proc/bus/usb and it's sub-directories.  At this stage I also  haven't  stripped the executables & libraries.

I'm more than happy to share the results of my exploits to date and the relevant instructions on how I got this far :-).  I'm assuming that the wiki would be the best place to place these details, is there a facility available for me to upload the relevant tar.gz install package?

Cheers

   Peter

Sorry for my English....
Any news about it? Someone make it? I' can't find the package in the wiki and in the forum!
If it's possible I need to clean shutdown the dns before the UPS battery is empty! ;-)
Tanks!

Last edited by icarus (2008-07-14 13:25:22)

Offline

 

#16 2008-07-24 22:50:46

rtg20
Member
Registered: 2007-12-23
Posts: 34

Re: UPS support

I can't find any info in the wiki either...I'd love to get this working with my DNS. can anyone help...? thanks!

Offline

 

#17 2008-08-11 00:18:49

rcblackwell
Member
From: Pickering, ON
Registered: 2008-05-19
Posts: 204
Website

Re: UPS support

peterjb wrote:

I haven't quite sorted out the user access required to run it under an alternate userid.  The issue appears to be related to update access to /proc/bus/usb and it's sub-directories.

Peter,

I believe you and I are working on the same issue; attempting to start upsdrvctl using the -u option. As mentioned in another post, I've tried everything I could find related to this issue however to date I've been unsuccessful. Have you had any success in this area?


Bob Blackwell
Pickering, ON

Offline

 

#18 2008-08-11 12:09:20

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: UPS support

Bob, I saw you've started a howto on the wiki. That's great. However, it seems you've misunderstood a small detail about /ffp/var/packages. That directory should be left for use by the funpkg script. It creates a file in that directory for every package that's installed. Please don't use it store real package files, it will confuse funpkg.

Offline

 

#19 2008-08-12 02:52:50

rcblackwell
Member
From: Pickering, ON
Registered: 2008-05-19
Posts: 204
Website

Re: UPS support

fonz wrote:

....it seems you've misunderstood a small detail about /ffp/var/packages. That directory should be left for use by the funpkg script.

fonz,

I was beginning to wonder this after experiencing a little trouble with installation of one of the packages available from your site. Thank you for clearing that up. I'll change the wiki instruction accordingly.

Is is safe to move the *.tgz files that I previously saved to the /ffp/var/packages directory to a directory on the same level as /ffp? I have a directory on /mnt/HD_a2 named Downloads that I believe would be suitable?


Bob Blackwell
Pickering, ON

Offline

 

#20 2008-08-12 09:44:33

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: UPS support

rcblackwell wrote:

Is is safe to move the *.tgz files that I previously saved to the /ffp/var/packages directory to a directory on the same level as /ffp?

Yes, just don't use an existing ffp directory that has its own meaning.

Offline

 

#21 2009-09-02 13:59:37

mrbillions
Member
Registered: 2009-09-02
Posts: 16

Re: UPS support

Hi guys, first let me say FFP is fantastic. Thank you for that great hack.
Now installed nut following the dns-323 nut wiki instructions which is great but i ended up in a complete mess. I went through the following versions:

nut25-2.5_r1814-1.tgz, nut-2.2.2-3.tgz, nut-2.4.0-pre2.tgz, nut-2.4.1-1.tgz

Finally settled for nut-2.4.1-1.tgz which works somewhat on my dns-323. I did implicit uninstalls ffpkg -r nut but most likely ended up with bits and pieces from various versions.  Nevertheless 2.4.1-1.tgz is showing some signs of working as it starts up and connects to ups except with incorrect values. After hours of trying to figure out what is going on I found that upon reboot the box copies:

ups.conf, upsd.conf and upsd.users  into /usr/local/ups everytime from scratch upon reboot.

I can change the above files in the above directory but upon reboot it gets overwritten again.

I also have these and more conf files in /ffp/etc/ which have the correct values after my editing but the system seems to ignore these and run the files from /usr/local/ups/etc instead.

Note that /ffp/start contains no script related to ups/nut.

Can anyone please shed some light on where the files in usr/local/ups/etc get copied from so I can adjust them accordingly or perhaps make the system use the /ffp/etc conf files instead which have the right settings? Any help is much appreciated.

Last edited by mrbillions (2009-09-02 14:32:36)

Offline

 

#22 2009-09-02 15:27:05

rcblackwell
Member
From: Pickering, ON
Registered: 2008-05-19
Posts: 204
Website

Re: UPS support

mrbillions wrote:

Note that /ffp/start contains no script related to ups/nut.

Config files associated with ffp's NUT are stored in the /ffp/etc directory. Files found in the usr/local/ups/etc are not placed there by ffp, there placed there by the DNS323's built in UPS support.

Detail provided in the Wiki for the start-up script relates to DNS323 firmware versions prior to 1.07.  Starting at firmware 1.07 D-Link added UPS support thus it became necessary to stop that process before starting ffp's NUT. The following script is what I use.

Code:

#!/ffp/bin/sh

# PROVIDE: nut

. /ffp/etc/ffp.subr

name="nut"
start_cmd="nut_start"
stop_cmd="nut_stop"

nut_start()
{
#####################
# We're using NUT UPS from ffp; #
#####################

############################################
# Stop built in NUT UPS deamons in preparation for starting ffp NUT UPS #
############################################
    if ps | grep /usr/local/ups/bin/usbhid-ups | grep -v grep
    then
        echo "* Stopping Default UPS Services"
        # Stop NUT Network Server
        /sys/crfs/sbin/upsd -c stop
    
        # Stop NUT driver for UPS hardware.
        /sys/crfs/sbin/upsdrvctl stop
    fi

sleep 2
    
##############
# Start ffp NUT UPS #
##############
    # Start NUT driver for UPS hardware.
    /ffp/bin/upsdrvctl start

    # Start NUT Network Server
    /ffp/sbin/upsd

    # Start NUT monitor agent
    /ffp/sbin/upsmon -u monuser
}

nut_stop()
{
    # Stop NUT monitor agent
    /ffp/sbin/upsmon -c stop

    # Stop NUT Network Server
    /ffp/sbin/upsd -c stop
    
    # Stop NUT driver for UPS hardware.
    /ffp/bin/upsdrvctl stop
}

run_rc_command "$1"

Last edited by rcblackwell (2009-09-02 15:27:25)


Bob Blackwell
Pickering, ON

Offline

 

#23 2009-09-02 16:00:42

mrbillions
Member
Registered: 2009-09-02
Posts: 16

Re: UPS support

Thanks heaps for that. I will try and place this into /ffp/start right as per wiki.

I'm running dns firmware 1.07 and can actually see in the webgui that it recognises my UPS in the Status tab but my undestanding is that it doesn't actually do anything beyond that so that's why i've been working on nut.

Will copy the script you provided and will place it into /ffp/start/ thanks a million...err...a billion. I will try it out shortly!

Offline

 

#24 2009-09-02 18:07:54

mrbillions
Member
Registered: 2009-09-02
Posts: 16

Re: UPS support

rcblackwell wrote:

mrbillions wrote:

Note that /ffp/start contains no script related to ups/nut.

Config files associated with ffp's NUT are stored in the /ffp/etc directory. Files found in the usr/local/ups/etc are not placed there by ffp, there placed there by the DNS323's built in UPS support.

Detail provided in the Wiki for the start-up script relates to DNS323 firmware versions prior to 1.07.  Starting at firmware 1.07 D-Link added UPS support thus it became necessary to stop that process before starting ffp's NUT. The following script is what I use.

Code:

#!/ffp/bin/sh

# PROVIDE: nut

. /ffp/etc/ffp.subr

name="nut"
start_cmd="nut_start"
stop_cmd="nut_stop"

nut_start()
{
#####################
# We're using NUT UPS from ffp; #
#####################

############################################
# Stop built in NUT UPS deamons in preparation for starting ffp NUT UPS #
############################################
    if ps | grep /usr/local/ups/bin/usbhid-ups | grep -v grep
    then
        echo "* Stopping Default UPS Services"
        # Stop NUT Network Server
        /sys/crfs/sbin/upsd -c stop
    
        # Stop NUT driver for UPS hardware.
        /sys/crfs/sbin/upsdrvctl stop
    fi

sleep 2
    
##############
# Start ffp NUT UPS #
##############
    # Start NUT driver for UPS hardware.
    /ffp/bin/upsdrvctl start

    # Start NUT Network Server
    /ffp/sbin/upsd

    # Start NUT monitor agent
    /ffp/sbin/upsmon -u monuser
}

nut_stop()
{
    # Stop NUT monitor agent
    /ffp/sbin/upsmon -c stop

    # Stop NUT Network Server
    /ffp/sbin/upsd -c stop
    
    # Stop NUT driver for UPS hardware.
    /ffp/bin/upsdrvctl stop
}

run_rc_command "$1"

----------------------------------------------------
fantastic it worked!

All I did is replace the usbhid-ups with my usb pw3105 required driver so instead of

if ps | grep /usr/local/ups/bin/usbhid-ups | grep -v grep

it became

if ps | grep /usr/local/ups/bin/bcmxcp_usb | grep -v grep


we have a winner. thanks a billion!

Offline

 

#25 2009-09-02 21:43:23

rcblackwell
Member
From: Pickering, ON
Registered: 2008-05-19
Posts: 204
Website

Re: UPS support

mrbillions wrote:

we have a winner. thanks a billion!

Glad to hear I was able to help smile


Bob Blackwell
Pickering, ON

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB