[Support] Electric Brain Unraid API


Recommended Posts

Overview: Support for Docker image unraid-api in the electricbrain repo.

Docker Hub: https://hub.docker.com/r/electricbrainuk/unraidapi

Github/ Docs: https://github.com/ElectricBrainUK/UnraidAPI

Discord: https://discord.gg/Qa3Bjr9

If you feel like supporting our work: https://www.paypal.me/electricbrain

 

Thanks a lot guys, I hope this is useful!

Edited by ElectricBrainUK
  • Thanks 3
Link to comment

Not working for all of my docker containers at my side.

 

Log says:
There was a problem retrieving a field for a docker image
Cannot read property 'contents' of undefined

 

Docker images will be build on my side over docker-compose and not over the app center.

 

what do you need for analysis?

 

 

Question by the way.

Why did you not build a general unraid-mqtt-interface?

I'm using iobroker and nodered and this has not the format of Home Assistant.

I must no badly change this to my needs.

So the idea could be a general unraid-mqtt-interface and adapter for every smarthome-system if needed.

Edited by Karatekid
Link to comment

Hey Karatekid,

Sorry it's not working for you. Does the UI work and show and control the dockers as you'd expect? Or does it not work their either? Does it connect to your mqtt broker at all? 

 

Regarding why I chose the route I did for mqtt was just because I'd only integrated it with Homeassistant for my personal use and I liked posting a single topic per device and several topics for the switches and sensors. That doesn't mean I'm not open to adapting it to suit your needs better. Perhaps we should talk on discord though if there will be a lot of back and forth about that? Your call though 

Link to comment

Well i'm not a Homeassistant guy, Openhab here (As i know at least one other Unraid user is).  I was looking at doing some of this over ssh, but this works alot better from a home automation standpoint in general.  Thanks for making it.

 

As it is it works better for openHab, if your going to change it it might be worth giving the option ether way?

 

I had a quick look and adding load values, cpu/memory usage would be nice (if its not in there and i didn't see it).

Link to comment

No problem, it's been a pleasure! 

 

You don't have to worry about that, I certainly won't be breaking compatibility. As you say it'll either be an option (with current functionality being the default) or best case both working in harmony. 

 

I'll look at getting utilisation in there, shouldn't be too difficult. Will let you know when there's an update.  

Link to comment
6 hours ago, ElectricBrainUK said:

Hey Karatekid,

Sorry it's not working for you. Does the UI work and show and control the dockers as you'd expect? Or does it not work their either? Does it connect to your mqtt broker at all? 

 

Regarding why I chose the route I did for mqtt was just because I'd only integrated it with Homeassistant for my personal use and I liked posting a single topic per device and several topics for the switches and sensors. That doesn't mean I'm not open to adapting it to suit your needs better. Perhaps we should talk on discord though if there will be a lot of back and forth about that? Your call though 

Hey,

 

sorry I also forget that you made awesome work!! I would like to have the ability to do something like it.

 

The UI just shows some dockers and not all of them.

MQTT is now working, was because of my network structure.

I need to made that all containers are able to speak to each other and also to unraid.

 

I thought on a structure like that, where all points have a single message.

Json is fine but I think at smarthome systems its better to have single messages for every status. 

That makes it easy to put it as a new json together for the display.

I checked my adapters at iobroker and see that for example kodi does put every channel or switch in a single message/object.

 

servername
    systeminfo
        arrayStatus
        arrayProtection
        ...
    vm
        vm1
            switch_1
            id
            status
            usb
                name
                attached
            ...
            
    docker
        container1
            switch_1
            imageUrl
            name
            status
            ...

Link to comment

Thanks a lot! Im glad you think so.

Interesting, the dockers that arent showing, is there anything unusual about them? Perhaps you could send me a private message with a screen shot of some of the dockers in your unraid UI that arent showing up, if that's alright with you? 

Okay that is interesting, I'll raise an issue to remind myself to add a more segmented version of the mqtt side as an option. Might take a bit though as things will be slow over the holiday period! 

Edit: (Issue for tracking https://github.com/ElectricBrainUK/UnraidAPI/issues/5)

Edited by ElectricBrainUK
  • Like 1
Link to comment
  • 2 weeks later...

Hi

 

tried to get this up and running but no joy. Maybe I'm just using it wrong or have incorrect expectations;

 

I'm trying to stay away from HA in my setup as it's just introducing another layer of complexity. I'm trying to build everything in Node-Red with MQTT as the messaging platform.

 

As such, I set up this docker and tried sending it a direct MQTT message: meehab/api/getServers

 

Am I wrong to expect the docker to respond on the mqtt base topic with a list of servers?

 

Further, It's unclear what I'm supposed to see when I access the docker UI. Here's what I have;

 

dockerlogin.thumb.PNG.81aee87adc724f580a27e5bc7c9bd7c5.PNG

 

To get here, I had to enter my unraid username & password twice, first in the above box, then again in a pop up a few seconds later. The only affect seems to be the appearance of the shallow  grey box on the right. What should i expect to see here?

 

if I click on 'API Docs' and then back to welcome, I seem to be logged out (not connected) and must log in again.

 

Here's my docker config;

dockersetup.thumb.PNG.8c5a655ccfc094d35598c65788efd083.PNG

 

Link to comment
On 1/7/2020 at 4:34 PM, ElectricBrainUK said:

Hi, that all seems correct to me. I will get rid of the second log in at a later date as it's not necessary. 

 

Are you using https for your unraid instance? If so you need to add the https:// part in the IP section. Will make this more clear in the docs. 

 

Otherwise what information is in the logs?

Thanks.

 

My docker log is filled with multiple instances of the following (ip obfuscated by me);

 

The secure keys for mqtt may have not been generated, you need to make 1 authenticated request via the API first for this to work
Get Dashboard Details for ip: 192.168.n.n Failed with status code: undefined
Request failed with status code 404
Get Docker Details for ip: 192.168.n.n Failed with status code: undefined
Request failed with status code 404
Get VM Details for ip: 192.168.n.n Failed with status code: undefined
Request failed with status code 404
Get Main Details for ip: 192.168.n.n Failed with status code: undefined
Request failed with status code 404

 

This repeats over and over. There are no timestamps.

Link to comment

Hi 

  • unraid UI is served over http
  • PlugIn list attached, nothing too unusual, I believe.
  • My unraidAPi network is configured as per screenshot in original post: Bridget, privileges off.

Maybe the following would have an impact?

 

1. My MQTT docker is configured as host;
 

mqtt.thumb.PNG.4230d5c7d1619d08029919e0b7a11a5a.PNG

 

(I'm not sure why it's set like this, I think it's the only way I could Node-Red to talk to it because....

 

2. My unRaid UI is running on a non-standard port (I needed to map port 80 directly to port 80 in a NodeRed docker as my Alexa LAN discovery node insists it is configurerd so)

 

 

 

 

screencapture-192-168-1-199-1234-Plugins-2020-01-10-15_50_43 (2).png

Link to comment

Actually, thinking about it, the non-standard port is likely the issue? If your docker is attempting to make calls to port 80, it won't work for me.

 

As indicated, sometimes it's necessary to run UnRaid on an alternative port. Would you need to expose a variable for unRaid UI host port in the docker config?

Link to comment

OK, have it working. Many thanks!

 

One thing I missed after updating the server details was that I needed to login via the docker UI. I'd stopped and started unraid-API a few times as I wasn't getting the response to the MQTT request. Once I logged in, I was golden.

 

I'll have a play over the weekend to see what I can do with this.

Link to comment
  • 1 month later...
41 minutes ago, TheBuz said:

maximize the amount of time the server can stay on battery for.

Unless you have an industrial grade UPS with additional battery packs, that is not a good strategy. Most consumer level battery backups are sized in such a way that running them for more than 10 minutes or so drains the batteries to the point that long term battery health is negatively impacted.

 

You need to accurately measure the draw with your server at full power with all services running on your UPS, find the runtime chart for your specific model, and plot how many minutes until 50% battery depletion.

 

That's how long you have to fully shut down your server with brand new fully charged batteries. Then you need to put your server into the typical use configuration, and trigger an unattended shutdown. Time how long it takes for all the VM's and containers to shut down, all the disks to spin up, and the array to fully and properly stop and power down.

 

Most rigs really should be triggering a shutdown after 3-5 minutes of the power loss in order to keep from dipping below the 50% mark on battery. If the power comes back on, then back off shortly after, you need enough power reserve in an emergency to shut down a second time before the batteries have a chance to recover. Typical recharge rates are 10 to 20 times longer than the time on battery, so if you discharged to 10 minutes, it's likely to be 2 hours before the batteries have recovered.

  • Like 1
  • Thanks 1
Link to comment
9 hours ago, jonathanm said:

Unless you have an industrial grade UPS with additional battery packs, that is not a good strategy. Most consumer level battery backups are sized in such a way that running them for more than 10 minutes or so drains the batteries to the point that long term battery health is negatively impacted.

 

You need to accurately measure the draw with your server at full power with all services running on your UPS, find the runtime chart for your specific model, and plot how many minutes until 50% battery depletion.

 

That's how long you have to fully shut down your server with brand new fully charged batteries. Then you need to put your server into the typical use configuration, and trigger an unattended shutdown. Time how long it takes for all the VM's and containers to shut down, all the disks to spin up, and the array to fully and properly stop and power down.

 

Most rigs really should be triggering a shutdown after 3-5 minutes of the power loss in order to keep from dipping below the 50% mark on battery. If the power comes back on, then back off shortly after, you need enough power reserve in an emergency to shut down a second time before the batteries have a chance to recover. Typical recharge rates are 10 to 20 times longer than the time on battery, so if you discharged to 10 minutes, it's likely to be 2 hours before the batteries have recovered.

This is very helpful thank you, and thinking about it there is no real benefit to server or Home Assistant staying online during a power cut, as I wouldn’t be able to use anything anyway.

 

Looking at getting a 1400va. Currently have a 7 year old 700va.

I did think about having 2nd UPS on the TV, but after all the calculations (based on what I think is a reasonable cost) I might get 20 minutes of runtime. Which doesn’t seem worth worrying about.

 

I will get a 2nd 1400va UPS so I can still run network equipment and POE / DVR Security cameras for an hour or so. (60 watts total). That seems like a better plan.

Thanks again

Link to comment

Hi 

 

Found this on the HA forum and though id give it a try, when i sign in i get all my VMs, containers, HW etc but i dont get anything into HA. The logs i get back just repeat. Any suggestions on what to change?

 

> unraidapi@0.5.0 start /app
> cross-env NUXT_HOST=0.0.0.0 NUXT_PORT=80 NODE_ENV=production node server/index.js

Connected to mqtt broker

READY Server listening on http://0.0.0.0:80

There was a problem retrieving a field for a docker image
Cannot read property 'contents' of undefined
There was a problem retrieving a field for a docker image
Cannot read property 'contents' of undefined
There was a problem retrieving a field for a docker image
Cannot read property 'contents' of undefined

 

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.