APCUPSD 3.14.10 Plugin for unRAID 5b11+


Recommended Posts

Hi,

I´ve been having the same problem with the syslog, can you explain exactly how you solve the problem.

 

Thanks

 

Attached is the modified plugin to fix the problem.  I've also reverted back to Apcupsd 3.14.3 because of potential issues I've seen posted about the later version(s).

 

I moved the start up script to the array being mounted event.  While this fixed the problem in this situation, I wonder if an event to indicate when the WebGui is ready might be better.  The apcupsd is not dependent on the array being mounted, but it appears to want the WebGui available to take html messages?  I see messages on the console at boot up with '<br>' rather than line feeds (/n), so I'm guessing that the start up script is expecting the message to go to the WebGui (not sure what I am talking about here) that is not ready to accept those messages.

 

Tom, is there a plugin event more suited to this situation?  While I was able to get this plugin to work, I'm wondering if down the road there is a better solution.  If the array does not mount, the apcupsd daemon will not start?  Not sure this is all that important here, but could impact other plugins.  I would not hold up any release of 5.0 for these seemingly minor issues.

 

SeeDrs, feel free to review the validity of my changes to see if it is appropriate to include them in your plugin permanently.

 

I re-versioned the plugin just so you can tell the difference between the original and my revised version; I'm not claiming authorship for this plugin.

 

Appreciate the work!  One thing you left in was my SED line which would probably not be good for all:

 

sed -i '/\${SHUTDOWN} -h/ i\ \ \ \ \ \ \ \ ssh -i ~\/id_rsa [email protected] \/home\/ups_shutdown.sh' /etc/apcupsd/apccontrol

 

BTW, passing through a physical USB card to unRAID completely fixed my issues. 

Link to comment
  • Replies 443
  • Created
  • Last Reply

Top Posters In This Topic

Seems I did.  That should be removed.  I honestly thought I used the original plugin I download from the unraid plugins to do my work.

 

Modified apcupsd plugin attached.

 

I'd like to post this version on the unraid plugins, but I wasn't able to upload the file.  If anyone can offer some help, I'd appreciate it.  Seems it was trying to upload the file and then IE timed out with a failed connection.

Apcupsd-3.14.3-i486-3dl.txt

Link to comment

Ok question. I had my first power outtage that lasted more than 5 minutes since I got a UPS. I have this plug-in installed and have seen severl short outtages that work properly, server stays up and all. This long one i had, didnt shutdown cleanly. When i restarted, array was stopped and it tried to do a parity check. I know why this happened, because i have Plex running and the array couldnt stop.

 

Here is where my questions kick in. How long will the script wait while trying to spin-down drives before the server is powered down? Is there a way to have unRAID save syslog's so i can view them after a restart, like a way to archive them where they arent lost? Also, is there a way to modify the script to stop a process before stopping the array, such as Plex?

 

Thanks in advance!

I know nothing about  this plugin, but the apcupsd install script in unMENU also REQUIRES you also install the "powerdown" script, otherwise it cannot stop processes holding disks busy.

 

Do you also have the powerdown script installed?

 

Joe L.

 

This plugin indicates that it includes the clean power down script. On the first post.

 

BTW, thanks for this plugin. I always want my unraid server working together with my UPS.

 

 

Link to comment
  • 2 weeks later...
  • 1 month later...

I would like to know a few things myself:

 

- what is the timeout for exactly?

- what does 'minutes' stand for? And what is the difference with timeout?

- what is the battery level textbox? Shouldn't the package read this from the ups?

 

Basically i want the ups to keep the array up as long as possbile, and only power it down when the ups itself will run out in like 5 or 10 minutes. According to the screenshot the UPS can keep the array up and running for 85 minutes.

 

Lat but not least, why arent these settings discussed in the start topic? :o

ups.jpg.1d2f4903e19f2ec8ae2f0f94b773cc7c.jpg

Link to comment

I would like to know a few things myself:

 

- what is the timeout for exactly?

 

This is how long the system will wait after the power has been cut before initiating a shutdown.

 

- what does 'minutes' stand for? And what is the difference with timeout?

 

This is the number of minutes estimated battery run time should be remaining before initiating a shutdown.

 

- what is the battery level textbox? Shouldn't the package read this from the ups?

 

This is the percentage of battery charge which should be remaining before initiating a shutdown.

 

The shutdown will be initiated when the first of these three conditions is triggered.

Link to comment

Basically i want the ups to keep the array up as long as possbile, and only power it down when the ups itself will run out in like 5 or 10 minutes. According to the screenshot the UPS can keep the array up and running for 85 minutes.

 

You have to keep in mind that the guess of time left is with the current draw of power.

once it sends the shutdown command, the server spins up all the dives and does it quick little sync. that can be very taxing  and suddenly drain the battery. the UPS might think you have 10 min at 50W and you spin up the the system for the shutdown and the next thing you know you have 1 min, the server is pullling 250W.. you suddenly dont have the battery to power it down.

 

the other thing to keep in mind. the UPS batteries are a bit self destructive. every time you use them for an extended period of time, you reduce its overall lifespan. 

 

My  theory is, if the server is on battery for more then 10-15 min (or sooner). shut it down.

1, the power most likely wont be back on anytime before the UPS will full discharge.

2, if it just a blown fuse, i can replace that in that time.

3, overall battery life.

4. more then once, the power company have fooled me. the power flickers on, but a min later the power goes back out (or worse, brownout).. now my server is booting and there is no power left on the ups.. it will crash.. If i left a good amount of juice on the battery, it can just shut the server back down cleanly.. again.

5. i have nothing that can log into and use the server.. why keep it on? the way i see it, the ups is to protect it from power failure and data corruption.. not to host files in the dark.

 

 

Link to comment

Using the 'powerdown' command, at the end i get an APCUPSD related error, see screenshot.

Anyone know what this is all about?

as described in the photo, there is no /etc/apcupsd/powerfail file. 

(apparently, it was not installed or configured properly for your version of apcupsd)

 

Joe L.

Link to comment

Hi all,

 

trying to get this plugin to work with v5.  I saw the post here with the updated file, Apcupsd-3.14.3-i486-3dl.txt  so I dl that file and renamed it to Apcupsd-3.14.3-i486-3dl.tgz, then put that file in my "extras" directory on my flash.

 

Is that all I have to do, or is there more?  Or do you still have to do the command line thing and manually install it?  If the latter, then I would assume we would also need to add this to the Go file so it reloads after reboot?  I just hope its the first, and this is it, auto loads by just dropping it in the extras folder.  :)

 

Thanks!

Link to comment

as described in the photo, there is no /etc/apcupsd/powerfail file. 

(apparently, it was not installed or configured properly for your version of apcupsd)

I got the plg from the unraid plugin site, placed it in the /boot/config/plugin folder, ran installplg on it, it installed succesfully, and i have the menu item in the webgui, which can read my APC ups. So as far as a linux newbie is concerned all is well, and i assume the plg is correct and not faulty? Any ideas on how to check what might be missing and why? What is the 'powerfail' file, is it part of the apcups package?

 

I do want to know upfront and NOT when the power is cut unexpectedly as you can understand...

Link to comment

I think this was a typical SHIT case. Self Healing IT. Re-ran the apcupsd package, and used the powerdown command to shut the device down, no errors, started up nicely afterwards again with no errors, so i guess its solved...

 

All is left is to test a power outage for real. I found some topics on that, will read some more before trying.

Link to comment

Hi all,

 

trying to get this plugin to work with v5.  I saw the post here with the updated file, Apcupsd-3.14.3-i486-3dl.txt  so I dl that file and renamed it to Apcupsd-3.14.3-i486-3dl.tgz, then put that file in my "extras" directory on my flash.

 

Is that all I have to do, or is there more?  Or do you still have to do the command line thing and manually install it?  If the latter, then I would assume we would also need to add this to the Go file so it reloads after reboot?  I just hope its the first, and this is it, auto loads by just dropping it in the extras folder.  :)

 

Thanks!

 

Rename it to .plg, not .tgz and put it in /boot/config/plugins and then run "installplg Apcupsd-3.14.3-i486-3dl.plg" from the command line, or simply reboot. .plg plugins in that directory automatically install on bootup. No need to add anything to the go file.

Link to comment

Thanks mrow!  That is exactly the info I was looking for.  I'm not sure why this isn't just posted at the top of page 1, as it's not that obvious to newbies.

 

APC plug is running with v5 rc6 test.

 

I have not tested a power failure yet, to test the auto shutdown script.  However the APC icon is there and it shows a ton of information about my ups.

 

I read somewhere not to just pull the power cord to test this, so I need to read more....

 

Other than testing, everything looks to be working ok.

 

Thanks!

 

Link to comment

Nevermind.  After I started it with full details, I saw that it's actually seconds.

 

I changed lines 240 thru 251 in the plugin to reflect this in the config, so I don't forget :)...

 

                        <tr>

        <td>Battery Level (% Remaining before shutdown):</td>

        <td><input type="text" name="BATTERYLEVEL" maxlength="40" value="<?=$apcupsd_cfg['BATTERYLEVEL'];?>"></td>

        </tr>

       

                        <tr>

        <td>Minutes (Remaining before shutdown):</td>

        <td><input type="text" name="MINUTES" maxlength="40" value="<?=$apcupsd_cfg['MINUTES'];?>"></td>

        </tr>

       

                        <tr>

        <td>Timeout (Seconds to wait after power loss):</td>

Link to comment

Thanks mrow!  That is exactly the info I was looking for.  I'm not sure why this isn't just posted at the top of page 1, as it's not that obvious to newbies.

 

APC plug is running with v5 rc6 test.

 

I have not tested a power failure yet, to test the auto shutdown script.  However the APC icon is there and it shows a ton of information about my ups.

 

I read somewhere not to just pull the power cord to test this, so I need to read more....

 

Other than testing, everything looks to be working ok.

 

Thanks!

 

 

Ok guys, this one is weird.  As I had said, new APC UPS.  When I installed this plugin, it showed the process was running, showned it was a APC ups and there was a ton of info at the bottom.  I did not change anything, execpt went to v5 rc6 test.  I just powered off and then powered on, and now it says UNKNOWN next to UPS instead of APC and the info section at the bottm is blank.

 

Anyone else have this issue with the latest v5 rc6 build?  Perhaps we need an updated plugin?

 

I'll attach a syslog when I get home tonight.

 

Thanks!

 

 

Link to comment

I'm running 5.0-rc6-r8168-test2 and I see all of my details just fine, no issues.

 

APC UPS Status

APC 001,039,0997

DATE Fri Aug 03 10:13:11 CDT 2012

HOSTNAME media

RELEASE 3.14.3

VERSION 3.14.3 (20 January 2008) slackware

UPSNAME media

CABLE USB Cable

MODEL Back-UPS BX1500G

UPSMODE Stand Alone

STARTTIME Wed Aug 01 08:03:05 CDT 2012

STATUS ONLINE

LINEV 122.0 Volts

LOADPCT 18.0 Percent Load Capacity

BCHARGE 100.0 Percent

TIMELEFT 36.8 Minutes

MBATTCHG 40 Percent

MINTIMEL 20 Minutes

MAXTIME 300 Seconds

Link to comment

ok, the last few lines of the log look like this...

Aug 3 21:45:00 Tower apcupsd[4606]: apcupsd FATAL ERROR in linux-usb.c at line 609 Cannot find UPS device -- For a link to detailed USB trouble shooting information, please see .

Aug 3 21:45:00 Tower apcupsd[4606]: apcupsd error shutdown complete

 

UPS cable is set to UPS

UPS Type was UPS, and working before....but now it says UNKNOWN.  I try the other options and if I select PCNET, then it shows more details, but I loose the connection after a few mintues.  I think that means it really never connected.  My UPS is a Backups 600 NS, so I tried Network as type, and it shows more details, but says Lost connection agian....wtf

 

This is driving me crazy because when I first plugged this in, it worked fine.  Now I get the dam UNKNOWN as my status and with no data below, which means the UPS won't send the Shutdown command if power lose.

 

So if you have a BackUps, what do you set your cable and ups type as?

 

Just to confirm I haven't mixed up files, I'm using Apcupsd-3.14.3-i486-3dl.plg and put it in my boot/config/plugins dir.

 

I have an extra APC UPS cable and tried swapping that, no help.

 

I'm at a lose here.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.