Jump to content

UnRaid graceful shutdown with UPS APC BVX1600LI-GR


TengaM

Recommended Posts

Hi everyone, 

 

It's my first post here but I am a proud UnRaid owner for the past year or so. 

I have built a decent machine for my use case which is mainly storing files and movies and streaming with Plex but recently we started getting power outages and It's always annoying to do parity check after an outage and sometimes it happens couple of times in a row. My Parity is 8TB and it takes a while to complete.

 

So, I decided to do the smart thing and get an UPS just for the sole purpose of shutting down my server gracefully and keeping the network gear operational. But I made a tiny, small mistake while ordering the UPS from a local reseller and I selected the wrong model - APC BVX1600LI-GR (instead of BX1600MI-GR) and I received the unmanaged version without any connectivity. 

 

Given that I cannot return or swap the UPS and I do want to use it I am now looking at other options for triggering a shutdown event when the power is out.

I have a spare Raspberry Pi laying around and I had the idea of connecting it to the network and not on the UPS so when the power goes out the Pi will be offline. Then I just need to write a script to ping the Pi (or an API running on it) and after "n" number of failed pings for a given period (e.g. 5 consecutive failed pings with 30 seconds apart) to shut down the server gracefully.

 

I think this will be a working solution with some potential problems, but I am looking for a ready solution in such scenarios where the UPS cannot communicate with the UnRaid server. Any suggestions?

Link to comment
1 hour ago, TengaM said:

I have a spare Raspberry Pi laying around

Sell the Raspi and buy a cheap 500VA UPS with USB connectivity. Hook a few pieces of network gear up to the cheap UPS, just so it has a job, and connect the USB to Unraid so it knows when the power is out, and keep the big UPS serving as the actual power source for the heavy draw equipment.

 

(or keep the Raspi, but given the shortage, you could probably get double what you paid for it if you sell it)

Link to comment

That is not a bad suggestion at all (at least the second part of getting a small USB connected UPS), but I will have to see if there is enough space to put the second UPS under my desk as well. 

 

On the topic of software solutions of this problem any other suggestions? 

Link to comment
4 hours ago, TengaM said:

On the topic of software solutions of this problem any other suggestions? 

No good solutions come to mind. Any software solution MUST be able to monitor the state of the input power of the UPS, and I don't know of a reliably consistent way of doing that without adding some piece of hardware to the mix. Any indirect monitoring like checking the status of an unrelated piece of equipment is fraught with issues, the most obvious being that if any part of the communication chain fails, you either shut down unnecessarily, with lots of problems getting things back up because the script will keep trying to shut you down, or you fail to catch a real event, causing uncontrolled shutdowns.

 

The UPS monitoring and action scripts are already proven, why reinvent the wheel?

 

4 hours ago, TengaM said:

I will have to see if there is enough space to put the second UPS under my desk as well. 

The small UPS's are barely bigger than a fat power strip, and can typically be wall mounted, so attaching it to the back or side of the desk may be an option.

Link to comment

As of now I've decided to go with the cheapest option and write a scheduled bash script which pings 3 devices in my network: 

1. Main router which is on the UPS

2. Raspi directly on the grid

3. Second Wifi node directly on the grid

 

Why 3 devices? Well the main router is to control the cases where the there is a network outage or the router is updating or restarting. The other two are to exclude cases where one devices is restarting or shut down. I do 5 pings each and the logic is:

[ $pi_count = 0 ] && [ $node_count = 0 ] && [ $router_main_count != 0 ];

So the server will shutdown if the two grid devices are not responding at all and the router on the UPS is still available. I know there are scenarios where this can be problematic but I think it will cover 95% of the cases.

 

I plan to do some more testing and share the script for the benefit everyone having the same issue. 

 

The official solution for me will be to get the correct UPS and sell this one or give it away to a friend. But before I go that route out of curiosity I want to test this approach.

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.

×
×
  • Create New...