How to get more ups compatibility
-
- New here
- Posts: 4
- Joined: Fri Jul 23, 2010 5:17 am
How to get more ups compatibility
You get more ups compatibility with nut - 2.4.1-1 - Network UPS tools from ipkg repository (optware qpkg is necessary).
ipkg update
ipkg install nut
Change these files.
mv /usr/bin/upsdrvctl /usr/bin/upsdrvctl.bck
mv /usr/sbin/upsd /usr/sbin/upsd.bck
mv /usr/sbin/upsmon /usr/sbin/upsmon.bck
ln -s /opt/bin/upsdrvctl /usr/bin/upsdrvctl
ln -s /opt/sbin/upsd /usr/sbin/upsd
ln -s /opt/sbin/upsmon /usr/sbin/upsmon
ln -s /etc/config/ups/ups.conf /opt/etc/ups.conf
ln -s /etc/config/ups/upsd.conf /opt/etc/upsd.conf
ln -s /etc/config/ups/upsd.users /opt/etc/upsd.users
ln -s /etc/config/ups/upsmon.conf /opt/etc/upsmon.conf
In /opt/bin you have many ups drivers. Make a backup of usbhid-ups driver and make symbolic link of your driver to usbhid-ups.
Check here the correct driver for your ups http://www.networkupstools.org/compat/stable.html
mv /opt/bin/usbhid-ups /opt/bin/usbhid-ups.bck
ln -s /opt/bin/<your-drive> /opt/bin/usbhid-ups
In /opt/etc/ups.conf change the ups port to auto. This is my configuration to Mustek PowerMust 800 USB:
[qnapups]
driver = usbhid-ups
port = auto
mfr = "Mustek"
model = "PowerMust 800 USB"
serial = "L53810C01504"
desc = "Workstation"
pollinterval=1
In /opt/etc/upsd.con change these lines:
#ACL all 0.0.0.0/0
#ACL localhost 127.0.0.1/32
#ACCEPT localhost
#REJECT all
LISTEN localhost 3493
LISTEN <your qnap ip> 3493
in /opt/etc/upsmon.conf add/uncomment these lines:
NOTIFYCMD /opt/etc/notifyme
NOTIFYMSG ONLINE "UPS %s on line power"
NOTIFYMSG ONBATT "UPS %s on battery"
NOTIFYMSG LOWBATT "UPS %s battery is low"
NOTIFYMSG FSD "UPS %s: forced shutdown in progress"
NOTIFYMSG COMMOK "Communications with UPS %s established"
NOTIFYMSG COMMBAD "Communications with UPS %s lost"
NOTIFYMSG SHUTDOWN "Auto logout and shutdown proceeding"
NOTIFYMSG REPLBATT "UPS %s battery needs to be replaced"
NOTIFYMSG NOCOMM "UPS %s is unavailable"
NOTIFYMSG NOPARENT "upsmon parent process died - shutdown impossible"
NOTIFYFLAG ONLINE EXEC+SYSLOG+WALL
NOTIFYFLAG ONBATT EXEC+SYSLOG+WALL
Create a script /opt/etc/notifyme for something like that:
#! /bin/bash
if [ $NOTIFYTYPE = "ONBATT" ];
then
echo "Ups on battery" | sendmail yourmail
upsmon -c fsd # immediate shutdown
fi
if [ $NOTIFYTYPE = "ONLINE" ];
then
echo "Ups on line power" | sendmail yourmail
fi
upsmon dosen't start with ups start script then create a script in /opt/etc/init.d to start upsmon.
The command is /sbin/daemon_mgr upsmon start "/usr/sbin/upsmon &" 2>/dev/null 1>/dev/null.
I hope qnap use this version of nut in next releases.
Good luck.
ipkg update
ipkg install nut
Change these files.
mv /usr/bin/upsdrvctl /usr/bin/upsdrvctl.bck
mv /usr/sbin/upsd /usr/sbin/upsd.bck
mv /usr/sbin/upsmon /usr/sbin/upsmon.bck
ln -s /opt/bin/upsdrvctl /usr/bin/upsdrvctl
ln -s /opt/sbin/upsd /usr/sbin/upsd
ln -s /opt/sbin/upsmon /usr/sbin/upsmon
ln -s /etc/config/ups/ups.conf /opt/etc/ups.conf
ln -s /etc/config/ups/upsd.conf /opt/etc/upsd.conf
ln -s /etc/config/ups/upsd.users /opt/etc/upsd.users
ln -s /etc/config/ups/upsmon.conf /opt/etc/upsmon.conf
In /opt/bin you have many ups drivers. Make a backup of usbhid-ups driver and make symbolic link of your driver to usbhid-ups.
Check here the correct driver for your ups http://www.networkupstools.org/compat/stable.html
mv /opt/bin/usbhid-ups /opt/bin/usbhid-ups.bck
ln -s /opt/bin/<your-drive> /opt/bin/usbhid-ups
In /opt/etc/ups.conf change the ups port to auto. This is my configuration to Mustek PowerMust 800 USB:
[qnapups]
driver = usbhid-ups
port = auto
mfr = "Mustek"
model = "PowerMust 800 USB"
serial = "L53810C01504"
desc = "Workstation"
pollinterval=1
In /opt/etc/upsd.con change these lines:
#ACL all 0.0.0.0/0
#ACL localhost 127.0.0.1/32
#ACCEPT localhost
#REJECT all
LISTEN localhost 3493
LISTEN <your qnap ip> 3493
in /opt/etc/upsmon.conf add/uncomment these lines:
NOTIFYCMD /opt/etc/notifyme
NOTIFYMSG ONLINE "UPS %s on line power"
NOTIFYMSG ONBATT "UPS %s on battery"
NOTIFYMSG LOWBATT "UPS %s battery is low"
NOTIFYMSG FSD "UPS %s: forced shutdown in progress"
NOTIFYMSG COMMOK "Communications with UPS %s established"
NOTIFYMSG COMMBAD "Communications with UPS %s lost"
NOTIFYMSG SHUTDOWN "Auto logout and shutdown proceeding"
NOTIFYMSG REPLBATT "UPS %s battery needs to be replaced"
NOTIFYMSG NOCOMM "UPS %s is unavailable"
NOTIFYMSG NOPARENT "upsmon parent process died - shutdown impossible"
NOTIFYFLAG ONLINE EXEC+SYSLOG+WALL
NOTIFYFLAG ONBATT EXEC+SYSLOG+WALL
Create a script /opt/etc/notifyme for something like that:
#! /bin/bash
if [ $NOTIFYTYPE = "ONBATT" ];
then
echo "Ups on battery" | sendmail yourmail
upsmon -c fsd # immediate shutdown
fi
if [ $NOTIFYTYPE = "ONLINE" ];
then
echo "Ups on line power" | sendmail yourmail
fi
upsmon dosen't start with ups start script then create a script in /opt/etc/init.d to start upsmon.
The command is /sbin/daemon_mgr upsmon start "/usr/sbin/upsmon &" 2>/dev/null 1>/dev/null.
I hope qnap use this version of nut in next releases.
Good luck.
-
- Starting out
- Posts: 19
- Joined: Tue Sep 28, 2010 1:56 am
Re: How to get more ups compatibility
Hi,
did you try the function "POWERDOWNFLAG" ?
I add in upsmon.conf
here my shutdown script
Any idea
R.
did you try the function "POWERDOWNFLAG" ?
I add in upsmon.conf
In /opt/etc/upsd.conf change these lines:MONITOR qnapups@localhost 1 upsmon admin 123456 master
SHUTDOWNCMD "/opt/etc/Myshutdown.sh"
POWERDOWNFLAG /etc/killpower
NOTIFYFLAG ONLINE SYSLOG+EXEC
NOTIFYFLAG ONBATT SYSLOG+EXEC
NOTIFYFLAG LOWBATT SYSLOG+EXEC
NOTIFYFLAG FSD SYSLOG+EXEC
NOTIFYFLAG COMMOK SYSLOG
NOTIFYFLAG COMMBAD SYSLOG
NOTIFYFLAG SHUTDOWN SYSLOG
NOTIFYFLAG REPLBATT SYSLOG
NOTIFYFLAG NOCOMM SYSLOG
NOTIFYFLAG NOPARENT SYSLOG
UPS mon is starting with this messageACL all 0.0.0.0/0
ACL localhost 127.0.0.1/32
ACCEPT localhost
REJECT all
LISTEN localhost 3493
But when I runNetwork UPS Tools upsmon 2.4.1
UPS: qnapups@localhost (slave) (power value 1)
Using power down flag file /etc/killpower
I get the messageupsmon -c fsd
Folder is existing, but upsmon seems not to run. I do not found any .pid file.fopen /opt/var/run/upsmon.pid: No such file or directory
here my shutdown script
if (test -f /etc/killpower)
then
echo "Killing the power, bye!"
/usr/bin/upsdrvctl shutdown
/sbin/halt
sleep 120
# uh oh... the UPS poweroff failed!
# you probably should reboot here to avoid getting stuck
# *** see the section on power races below ***
fi
Any idea
R.
Last edited by ritchie on Sun Oct 31, 2010 7:17 pm, edited 1 time in total.
-
- New here
- Posts: 4
- Joined: Fri Jul 23, 2010 5:17 am
Re: How to get more ups compatibility
Did you make symbolic links?
"
mv /usr/sbin/upsmon /usr/sbin/upsmon.bck
ln -s /opt/sbin/upsmon /usr/sbin/upsmon
"
I didn't try POWERDOWNFLAG.
"
mv /usr/sbin/upsmon /usr/sbin/upsmon.bck
ln -s /opt/sbin/upsmon /usr/sbin/upsmon
"
I didn't try POWERDOWNFLAG.
-
- Starting out
- Posts: 19
- Joined: Tue Sep 28, 2010 1:56 am
Re: How to get more ups compatibility
Hi,
I just used the following script for installation in the autorun.sh
descripted here. (rcD/rcS)
http://forum.qnapclub.de/viewtopic.php? ... min#p62315
(it is in german, but I guess yu will know what happen there).
Since I started your solution, the original ups.sh didn't start automatically. (I have to started it manually, to see ups-state on the admin-web side.
Now I get a message "re-launch" in the syslog? how can I disable the original "ups-service" ?
Thanks
R.
I just used the following script for installation in the autorun.sh
and I also start to install the start of the services as/bin/date >> /share/MD0_DATA/Public/MyInstall.log
echo "Start of InstallMyStuff.sh" >> /share/MD0_DATA/Public/MyInstall.log
#
# make a test, if /opt is existing
#
if !(/sbin/test -d /opt ) then
rm /opt
# create a Symlink Optware to /opt n the real hard disc
/bin/ln -sf /share/MD0_DATA/.qpkg/Optware /opt
# export the new path
echo "export PATH=$PATH:/opt/bin:/opt/sbin" >> /etc/profile
fi
# save the old existing ups driver if not done before
# only needed, if your are testing the script,
# otherwise the orginal file will deleted
#
if !(/sbin/test -f /usr/bin/upsdrvctl.bck ) then
/bin/mv /usr/bin/upsdrvctl /usr/bin/upsdrvctl.bck
/bin/ln -s /opt/bin/upsdrvctl /usr/bin/upsdrvctl
fi
if !(/sbin/test -f /usr/sbin/upsd.bck ) then
/bin/mv /usr/sbin/upsd /usr/sbin/upsd.bck
/bin/ln -s /opt/sbin/upsd /usr/sbin/upsd
fi
if !(/sbin/test -f /usr/sbin/upsmon.bck ) then
/bin/mv /usr/sbin/upsmon /usr/sbin/upsmon.bck
/bin/ln -s /opt/sbin/upsmon /usr/sbin/upsmon
fi
if !(/sbin/test -f /etc/ups/ups.conf.bck ) then
/bin/mv /etc/ups/ups.conf /etc/ups/ups.conf.bck
/bin/ln -s /opt/etc/ups.conf /etc/ups/ups.conf
fi
if !(/sbin/test -f /etc/ups/upsd.conf.bck ) then
/bin/mv /etc/ups/upsd.conf /etc/ups/upsd.conf.bck
/bin/ln -s /opt/etc/upsd.conf /etc/ups/upsd.conf
fi
if !(/sbin/test -f /etc/ups/upsd.users.bck ) then
/bin/mv /etc/ups/upsd.users /etc/ups/upsd.users.bck
/bin/ln -s /opt/etc/upsd.users /etc/ups/upsd.users
fi
if !(/sbin/test -f /etc/ups/upsmon.conf.bck ) then
/bin/mv /etc/ups/upsmon.conf /etc/ups/upsmon.conf.bck
/bin/ln -s /opt/etc/upsmon.conf /etc/ups/upsmon.conf
fi
# end of script
descripted here. (rcD/rcS)
http://forum.qnapclub.de/viewtopic.php? ... min#p62315
(it is in german, but I guess yu will know what happen there).
Since I started your solution, the original ups.sh didn't start automatically. (I have to started it manually, to see ups-state on the admin-web side.
Now I get a message "re-launch" in the syslog? how can I disable the original "ups-service" ?
Thanks
R.
-
- Starting out
- Posts: 19
- Joined: Tue Sep 28, 2010 1:56 am
Re: How to get more ups compatibility
How did you solve the autostartup of the new ups-service ?
I just get the automatically start of the service to run.
Just create a srcipt in rcS.d which will stop the old driver, before you the new driver starts.
All commands are working,
like
upscmd <- used to switch off the UPS, or send other commands
upsc <- just the check state var of the ups
Here are my used codes "notifyme.sh"
Here you can configure your commands as I have done
upsmon.sh
stopups.sh
Greatings
R.
I just get the automatically start of the service to run.
Just create a srcipt in rcS.d which will stop the old driver, before you the new driver starts.
All commands are working,
like
upscmd <- used to switch off the UPS, or send other commands
upsmon <- just to monitor the behavoiur[~] # upsc qnapups
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: 2010/05/12
battery.mfr.date: 2010/05/12
battery.runtime: 2812
battery.runtime.low: 120
battery.temperature: 3022999999999999855
battery.type: PbAc
battery.voltage: 13.5
battery.voltage.nominal: 12.0
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 1
driver.parameter.port: /dev/ttyS1
driver.parameter.serial: 4B1020P08157
driver.version: 2.4.1
driver.version.data: APC HID 0.93
driver.version.internal: 0.34
input.voltage: 226.0
input.voltage.nominal: 230
output.voltage: 230.0
output.voltage.nominal: 230.0
ups.beeper.status: disabled
ups.delay.shutdown: 20
ups.firmware: 808.q8.I
ups.firmware.aux: q8
ups.load: 699999999999999954409217601299837011224822670629708618734892362773210289401774245334406271212081319283448681396478040543277747961348059682393933110203249595405945996013794505066651998819215104584912256000725479190519733309333698577242578497727734902591324
ups.mfr: American Power Conversion
ups.mfr.date: 2010/05/12
ups.model: Back-UPS CS 500
ups.productid: 0002
ups.serial: 4B1020P08157
ups.status: OL
ups.test.result: No test initiated
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d
It will show you the state of the UPS. If you disconnect the power, the state will change.[~] # upsmon -D -u admin -p <my password of admin>
Network UPS Tools upsmon 2.4.1
UPS: qnapups@localhost (slave) (power value 1)
Using power down flag file /etc/killpower
Warning: running as one big root process by request (upsmon -p)
Trying to connect to UPS [qnapups@localhost]
Logged into UPS qnapups@localhost
polling ups: qnapups@localhost
get_var: qnapups@localhost / status
status: [OL]
parsing: [OL]: ups_on_line(qnapups@localhost) (first time)
polling ups: qnapups@localhost
get_var: qnapups@localhost / status
status: [OL]
parsing: [OL]: ups_on_line(qnapups@localhost) (no change)
Signal 2: exiting
Dropping connection to UPS [qnapups@localhost]
upsc <- just the check state var of the ups
But not shutdown.return which i need for my requested function ![~] # upscmd -l qnapups
Instant commands supported on UPS [qnapups]:
beeper.disable - Disable the UPS beeper
beeper.enable - Enable the UPS beeper
beeper.mute - Temporarily mute the UPS beeper
beeper.off - Obsolete (use beeper.disable or beeper.mute)
beeper.on - Obsolete (use beeper.enable)
load.off - Turn off the load immediately
load.off.delay - Turn off the load with a delay (seconds)
shutdown.reboot - Shut down the load briefly while rebooting the UPS
shutdown.stop - Stop a shutdown in progress
test.panel.start - Start testing the UPS panel
test.panel.stop - Stop a UPS panel test
Here are my used codes "notifyme.sh"
Code: Select all
#!/bin/sh
#
# Notify script, if ups state is changing
#
if [ "$NOTIFYTYPE" = "ONBATT" ]
then
echo "Ups on battery, init shutdown ..."
opt/bin/upscmd -u admin -p <here your valid password> qnapups load.off.delay 150
sbin/halt
fi
if [ "$NOTIFYTYPE" = "ONLINE" ]
then
echo "Ups on line power"
fi
if [ "$NOTIFYTYPE" = "" ]
then
echo "Empty state var !"
fi
upsmon.sh
Code: Select all
#!/bin/sh
case "$1" in
start)
# Start daemons.
/sbin/daemon_mgr upsmon start "/opt/sbin/upsmon -u admin -p <your password>"
;;
stop)
# Stop daemons.
/sbin/daemon_mgr upsmon stop "/opt/sbin/upsmon -u admin -p <your password>"
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
Code: Select all
#!/bin/sh
echo "Stop old UPS daemon"
# Stop daemons.
/etc/init.d/usb_ups.sh stop
/etc/init.d/snmp_ups.sh stop
Greatings
R.
-
- New here
- Posts: 4
- Joined: Fri Jul 23, 2010 5:17 am
Re: How to get more ups compatibility
Hi,
I didn't have this issue. I use the same startup script provided by QNAP NAS.
Regards.
I didn't have this issue. I use the same startup script provided by QNAP NAS.
Regards.
-
- Starting out
- Posts: 19
- Joined: Tue Sep 28, 2010 1:56 am
Re: How to get more ups compatibility
Hi,
Can you run the following command on your unit:
Best regards
R.
Can you run the following command on your unit:
upscmd -l qnapups
Best regards
R.
-
- Starting out
- Posts: 21
- Joined: Sun Nov 21, 2010 1:31 am
Re: How to get more ups compatibility
Hi All,
I'm new to the world of QNAP NAS's and Linux for that matter so softly softly please..... I'd like to implement the changes in this thread to allow my NAS to monitor my PLEXUS UPS however the article assumes a certain level of knowledge. Has any one come across a 101 style guide on how to implement these changes from the ground up?
Cheers,
Jon C
I'm new to the world of QNAP NAS's and Linux for that matter so softly softly please..... I'd like to implement the changes in this thread to allow my NAS to monitor my PLEXUS UPS however the article assumes a certain level of knowledge. Has any one come across a 101 style guide on how to implement these changes from the ground up?
Cheers,
Jon C
NAS: TS-412 4xSamsung F4EG/HD204UI F/W 1AQ10001, RAID5/EXT4/No encryption F/W: 3.7.3 build 20120801
Clients: (all Win7 Professional RTM): Q6600 Desktop 64bits, Sony AW11
Network: Netgear GS108 Gigabit Switch, DrayTek Vigor 2600i Router, Various WAP's
Clients: (all Win7 Professional RTM): Q6600 Desktop 64bits, Sony AW11
Network: Netgear GS108 Gigabit Switch, DrayTek Vigor 2600i Router, Various WAP's
-
- First post
- Posts: 1
- Joined: Thu Nov 01, 2012 4:33 am
Re: How to get more ups compatibility
I am running a QNAP TS-669 PRO.
My UPS is a Powercom BNT-1000AP (Black Knight) with a USB port.
I expected to see my BNT listed as an option in the Admin Client --> UPS Settings page.
But I only got the two 'network slave' options.
After a long toil I got it working with my QNAP.
Here is my story...
The USB on the BNT-1000AP is a USBHID device.
In other words it is supposed to use very simple protocol over USB, much like a keyboard or mouse.
(Windows picks it up without trouble).
Anyway, my out-the-box QNAP did not recognize the BNT.
So, I first tried the IPKG route as mentioned by erivanamaral. It did not work for me.
The nut version on ipkg for 686 is still 2.4.1. According to the nut site the PowerCom is supported from 2.6.3 onwards.
I suppose the ipkg route will work when 2.6.3 or later us ipkg'ed.
I then uninstalled nut and undid the steps from provided by erivanamaral:
I then went on to build the latest nut as described below and use the newly built usbhid-ups driver.
Luckily, I did not have to make any changes in the ups.conf file.
I suggest that you first try the default ups.cond file provided by qnap before adding properties.
The usbhid-ups driver failed to see the BNT until I cleared out the properties. And then it started seeing it.
Below is the content my (working) ups.conf file:
In the QNAP Admin client go to
Home --> Applications --> QPKG Center
a page opens with 3 tabs: "Installed", "Available" and "Get More"
In the Available tab look for Optware and install.
Alternatively find it in "Get More" and install.
Once Optware is installed you should be able to use ipkg in a shell session on the QNAP.
Open a shell session on the QNAP. I used PuTTY with SSH. Log in as admin.
Run the following commands on the command line:
It takes a while for some of them to install so just be patient.
Get the nut tar onto the QNAP filesystem
1. download latest nut tar from
for example: http://www.networkupstools.org/source/2 ... 6.5.tar.gz
I downloaded it in windows and then copied the gz file into
\\<my QNAP>\Public\<location>/nut/nut-2.6.5.tar.gz
On the QNAP the above location maps to
/share/<location>/nut/nut-2.6.5.tar.gz
I suppose I could have used wget as well.
Now it is time to extract the tar.gz and build the code (make).
Create a directory to extract and build. I created "/usr/local/nut".
Note: The path is a pain in the rear for 'configure', 'make' and 'tar' so make sure you save copy of the PATH variable somewhere
because your are going to change it as you go along.
# save/copy-paste the content somewhere for later
set the path so that the normal bins are first.
All the tar contents are extracted into "/usr/local/nut/nut-2.6.5"
Set the path so that the opt bins are first.
A lot of things happen here. Keep your eyes open for error messages.
Once configure is done you are ready to build.
Wait some more...
Once make is done you are ready to use you new driver.
To use the new driver we need to spoof the old QNAP driver by replacing it or creating a symbolic link to it. I replaced it.
First, backup the original:
Copy the new usbhid-ups driver into the QNAP location:
Also, create a link to where the new driver wants to find the ups.conf file.
If you run the new usbhid-ups it will tell you it can't find the conf file at a certain location.
In my case it was /usr/local/ups/etc/ups.conf
Create a link to that location:
restart the UPS monitor and related services:
You should see something like this:
My UPS is a Powercom BNT-1000AP (Black Knight) with a USB port.
I expected to see my BNT listed as an option in the Admin Client --> UPS Settings page.
But I only got the two 'network slave' options.
After a long toil I got it working with my QNAP.
Here is my story...
The USB on the BNT-1000AP is a USBHID device.
In other words it is supposed to use very simple protocol over USB, much like a keyboard or mouse.
(Windows picks it up without trouble).
Anyway, my out-the-box QNAP did not recognize the BNT.
So, I first tried the IPKG route as mentioned by erivanamaral. It did not work for me.
The nut version on ipkg for 686 is still 2.4.1. According to the nut site the PowerCom is supported from 2.6.3 onwards.
I suppose the ipkg route will work when 2.6.3 or later us ipkg'ed.
I then uninstalled nut and undid the steps from provided by erivanamaral:
Code: Select all
ipkg remove nut.
Luckily, I did not have to make any changes in the ups.conf file.
I suggest that you first try the default ups.cond file provided by qnap before adding properties.
The usbhid-ups driver failed to see the BNT until I cleared out the properties. And then it started seeing it.
Below is the content my (working) ups.conf file:
Make sure you have Optware installed on your QNAP because you are going to download/install some extras.[qnapups]
driver=usbhid-ups
port=auto
desc="Workstation"
pollinterval=1
In the QNAP Admin client go to
Home --> Applications --> QPKG Center
a page opens with 3 tabs: "Installed", "Available" and "Get More"
In the Available tab look for Optware and install.
Alternatively find it in "Get More" and install.
Once Optware is installed you should be able to use ipkg in a shell session on the QNAP.
Open a shell session on the QNAP. I used PuTTY with SSH. Log in as admin.
Run the following commands on the command line:
Code: Select all
ipkg install make
ipkg install gcc
ipkg install gawk
ipkg install yawk
ipkg install grep
ipkg install busybox
Get the nut tar onto the QNAP filesystem
1. download latest nut tar from
for example: http://www.networkupstools.org/source/2 ... 6.5.tar.gz
I downloaded it in windows and then copied the gz file into
\\<my QNAP>\Public\<location>/nut/nut-2.6.5.tar.gz
On the QNAP the above location maps to
/share/<location>/nut/nut-2.6.5.tar.gz
I suppose I could have used wget as well.
Now it is time to extract the tar.gz and build the code (make).
Create a directory to extract and build. I created "/usr/local/nut".
Note: The path is a pain in the rear for 'configure', 'make' and 'tar' so make sure you save copy of the PATH variable somewhere
because your are going to change it as you go along.
Code: Select all
echo $PATH
set the path so that the normal bins are first.
Code: Select all
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/local/sbin:/opt/bin:/opt/sbin
cd /usr/local
mkdir nut
cd nut
cp /share/<location>/nut/nut-2.6.5.tar.gz .
gzip -d nut-2.6.5.tar.gz
tar xvzf nut-2.6.5.tar
Set the path so that the opt bins are first.
Code: Select all
PATH=/opt/bin:/opt/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/local/sbin
cd /usr/local/nut/nut-2.6.5
./configure
Once configure is done you are ready to build.
Code: Select all
make
Once make is done you are ready to use you new driver.
To use the new driver we need to spoof the old QNAP driver by replacing it or creating a symbolic link to it. I replaced it.
First, backup the original:
Code: Select all
mv /usr/local/ups/bin/usbhid-ups /usr/local/ups/bin/usbhid-ups.bak_orig
Code: Select all
cp /usr/local/nut/nut-2.6.5/drivers/usbhid-ups /usr/local/ups/bin/usbhid-ups
If you run the new usbhid-ups it will tell you it can't find the conf file at a certain location.
In my case it was /usr/local/ups/etc/ups.conf
Create a link to that location:
Code: Select all
ln -s /etc/config/ups/ups.conf /usr/local/ups/etc/ups.conf
Code: Select all
/etc/init.d/usb_ups.sh stop
/etc/init.d/usb_ups.sh start
<pid> is the process of the running usbhid-ups driver.Starting UPS monitoring:Network UPS Tools - UPS driver controller 2.2.2
Network UPS Tools - Generic HID driver 0.37 (2.6.5)
USB communication driver 0.31
Using subdriver: PowerCOM HID 0.3
Network UPS Tools upsd 2.2.2
<pid>
-
- New here
- Posts: 4
- Joined: Thu Apr 21, 2016 10:00 pm
Re: How to get more ups compatibility
Thanks for the guide on compiling the nut driver. I have a TS-563 (x86 based) One problem I'm having is that in 2016 (4 years later) libusb doesn't seem to be available in opkg repositories so I can't easily make the 2.6.5 driver usbhid-ups using . The same problem occurs with nut 2.7.4. I'm a little reluctant to compile an entire dependency tree for something that isn't quite essential. Does anyone have insight?
Code: Select all
./configure --with-usb