Odd UPS Issues

Status
Not open for further replies.

RaynMan

Dabbler
Joined
Aug 12, 2011
Messages
12
Okay,

So I am using the latest 8.01Beta4 installation. I have a test scenario up and running, everything is happy, performance is great, networking works, etc.

My only issue at the moment is that I cannot get the UPS functionality to work.

The UPS is monitored by USB. I do have the correct USB port. I have all the settings correct that I can see.

identifier: ups
driver: usbhid-ups
port: /dev/cuau0 (also tried /dev/ugen4.2, both work)
shutdown mode: UPS goes on battery
shutdown timer: 30

I can check the UPS status using the upsc ups@localhost command and I get back verifiable data. This tells me that the connection is correct. The log tells me that the software and drivers are correctly loading.

Now, what *isn't* happening, is if I unplug the power from the UPS then the UPS just counts down to zero battery and turns off. The FreeNAS system itself does not seem to register it at all.

Any suggestions?

Ray
 

Tekkie

Patron
Joined
May 31, 2011
Messages
353
Ray please read the forum rules and do a search for UPS there is a multi page thread on this very subject... ;)
 

RaynMan

Dabbler
Joined
Aug 12, 2011
Messages
12
I did search for stuff on UPS, looks like I missed it. Essentially it doesn't work it seems. Will need to regress to v7.2 again.

But, before I do that, let me see if I can hack/find a fix for us. Got nothing else on this weekend :)

Ray
 

RaynMan

Dabbler
Joined
Aug 12, 2011
Messages
12
Things I have found so far...

FreeNAS v7.2 build 6694 seems to have a newer version of NUT, 2.6.1 vs 2.4.1 on v8.0.1.

There are a couple of UPS related processes running on v7.2 that are not running on v8.0.1.

upsmon and upslog are both running on v7.2 but not v8.0.1

Will look some more...

Ray
 

RaynMan

Dabbler
Joined
Aug 12, 2011
Messages
12
Potential Hacked Temporary Fix

Okay.

So I managed to get it working (mostly).

PLEASE NOTE: I am only posting this fairly nasty hack job so the devs can maybe sort out the problem we are experiencing. Also, I am a relative n00B to BSD of any sort, but have a fair background to troubleshooting and problem-solving in linux, so bear with me if there are easier ways of doing things, because I was struggling to find the locations of various files.

I have double checked this, but might have missed a step. Please let me know if this works or not so I can check again.

Seems that the upsmon program is not being loaded. Two reasons for this. The script generating the upsmon.conf is faulty and generates a script that doesn't work. Also, upsmon_enable is set to no, so the program will not start anyway.

There are several changes that need to be made to make it work, but be warned that the changes are *not* a permanent solution. There are permission changes and such-like that should not be necessary in a working system. There also seems to be a problem with the notification email being sent off which I have not traced yet.

All the changes below should get your system to shutdown with a power failure.

First make your file system read/write.
mount -uw /

Compare the following (/usr/local/etc/nut/upsmon.conf):
FINALDELAY 30
MONITOR ups 1 upsmon fixmepass master
NOTIFYCMD "/var/tmp/nut_notify.sh"
NOTIFYFLAG ONBATT SYSLOG+WALL+EXECNOTIFYFLAG LOWBATT SYSLOG+WALL+EXECSHUTDOWNCMD "/sbin/shutdown -p now"

FINALDELAY 30
MONITOR ups 1 upsmon fixmepass master
NOTIFYCMD "/var/tmp/nut_notify.sh"
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC
SHUTDOWNCMD "/sbin/shutdown -p now"

To fix that, you need to change the /conf/base/etc/rc.d/ix-ups file.
Search for the following:
echo -n "NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC"
echo -n "NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC"
echo "SHUTDOWNCMD \"/sbin/shutdown -p now\""
done
}
and change to
echo "NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC"
echo "NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC"
echo "SHUTDOWNCMD \"/sbin/shutdown -p now\""
done
}

Create a sub-folder in the /root folder (I called mine ups_stuff) and copy the nut files from /usr/local/etc/rc.d folder in the newly created sub-folder:
cd /root
mkdir ups_stuff
cp /usr/local/etc/rc.d/nut* /root/ups_stuff

Edit the files in the subfolder:
nut (insert the the nut_flags line below the pidfile line as below)
pidfile="/var/db/nut/upsd.pid"
nut_flags=${nut_flags-"-u root"}

nut_upslog (change the following lines)
nut_upslog_ups=${nut_upslog_ups-"ups@localhost"}
nut_upslog_flags=${nut_upslog_flags-"-s ${nut_upslog_ups} -l ${nut_upslog_logfile} -i ${nut_upslog_interval} -u root"}

nut_upsmon (change the following line)
nut_upsmon_flags=${nut_upsmon_flags-"-p localhost"}

The final changes that are required (/conf/base/etc/rc.conf):
Original
# *** need to clean this up

hostname="freenas"

Changed
# *** need to clean this up

chmod 777 /dev/ugen4.2

nut_upslog_enable="YES"
nut_upsmon_enable="YES"

cp /root/ups_stuff/nut* /usr/local/etc/rc.d

hostname="freenas"
NOTE: /dev/ugen4.2 should be changed to your UPS USB port

You will need to reboot after all the changes are made.
 

William Grzybowski

Wizard
iXsystems
Joined
May 27, 2011
Messages
1,754
Hello RaynMan,

I really appreciate your help.
I've merge your fixes into freenas in svn r7175:r7177, except for the use of root that should not be necessary if the usb port permissions are set correctly.

Hopefully it'll just work in BETA5.

Thank you again
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,995
I have been trying r7209 for a few hours and cannot get the UPS to even be recognized.

I guess I have a few questions:

1) When using a USB port connection, what is the value which should be entered into the Port field? A drop down would be preferred here. I tried "usbus1" and "ugen1.2", both which corolate to the USB port which recognizes the APC Smart UPS connected.

2)freenas# upsc ups@localhost now displays the following error message vice a listing of UPS values:
Error: Connection failure: Connection refused

3) Doesn't the developers have a USB UPS to utilize for testing?

Unfortunately the language used in this project makes no sense to me so I don't see how many of the modification above were made in the three svn changes.

I reopened the ticket.

-Mark
 
J

Joshua Parker Ruehlig

Guest
I have been trying r7209 for a few hours and cannot get the UPS to even be recognized.

I guess I have a few questions:

1) When using a USB port connection, what is the value which should be entered into the Port field? A drop down would be preferred here. I tried "usbus1" and "ugen1.2", both which corolate to the USB port which recognizes the APC Smart UPS connected.

2)freenas# upsc ups@localhost now displays the following error message vice a listing of UPS values:
Error: Connection failure: Connection refused

3) Doesn't the developers have a USB UPS to utilize for testing?

Unfortunately the language used in this project makes no sense to me so I don't see how many of the modification above were made in the three svn changes.

I reopened the ticket.

-Mark

Mark make sure to not exclude '/dev/' in the Port field.

The trick for me was following RaynMan's instruction, unplugging and replugging my UPS's usb cable and seeing the output. I then edited rc.conf to have my port '/dev/ugen2.2' and that's also what I used in the Port Value.

After everything was setup I could unplug my UPS and my FreeNAS box successfuly turned off. Thanks RaynMan!
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,995
In my opinion the port should be a drop down with a list of what is connected to the respective port. This would aid in proper configuration. Since this will be used in a formal product I would think configuration shouldn't need to be that difficult.

An update was done to the FreeNAS code, something about a permissions issue. It looks like 8.0.1-Release will be hitting the streets possibly tonight, or within a few days. I will wait for the nightly build vice compiling on my own. I still don't know how to force my computer to use all it's cores during the compiling which forces the job to take about 5 hours. I'd like to see 1 hour compile times. That's another story.

-Mark
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,995
It Works !

In 8r7248 I have been able to get the UPS to connect and shutdown when power is removed from the UPS. No to figure out the proper delay. For me it shuts down immediately, I would of course want to wait a minimum of 15 minutes or until the UPS is within 10 minutes of exhausted.

-Mark
 
J

Joshua Parker Ruehlig

Guest
It Works !

In 8r7248 I have been able to get the UPS to connect and shutdown when power is removed from the UPS. No to figure out the proper delay. For me it shuts down immediately, I would of course want to wait a minimum of 15 minutes or until the UPS is within 10 minutes of exhausted.

-Mark

Yeah I'm using the hackjob and it works, I'll probably switch the next release candidate, thanks for testing this. Now we gotta get emails going. I personally am using "UPS reaches low battery" and shutdown timer 30. Though I don't know what any of it means. Can't wait to get email alerts so I know to come home and flip the circuit braker. =]
---
BTW if I update do I need to back any configs up to get my raidz volume up and running again? Or will it just find it if I import it?
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,995
The Shutdown Timer does not work when you use the "Goes on battery" setting. The FreeNAS box shuts down immediately. I have placed a ticket in for this. I have not tested out to see if when my UPS gets drained if the shutdown occurs. Maybe later.

@Joshua,
You should always backup your config file before an upgrade. This saves the hassle if you regress back. When you install the update it should retain all your configuration data but that still doesn't always work.

-Mark
 
J

Joshua Parker Ruehlig

Guest
http://97.95.43.80:10080/725/

Setup emailing for gmail, just tested this myself and it worked for a test email. I unplugged my UPS to test recieveing an email and got nothing... Maybe another case of the user UPS service is running from, or I may have not unplugged it long enough? (It beeps and my housemates might get pissed)
 
J

Joshua Parker Ruehlig

Guest
It Works !

In 8r7248 I have been able to get the UPS to connect and shutdown when power is removed from the UPS. No to figure out the proper delay. For me it shuts down immediately, I would of course want to wait a minimum of 15 minutes or until the UPS is within 10 minutes of exhausted.

-Mark

Where'd you get the build? Did you need to compile it or are there prebuilt iso's somewhere? Thanks

EDIT
Found it - http://sourceforge.net/projects/freenas/files/FreeNAS-8-nightly/
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,995
Glad you found it. Hopefully it works for you.
 
Status
Not open for further replies.
Top