Unraid UPS Monitoring with Prometheus and Grafana

Unraid UPS Monitoring with Prometheus and Grafana

Quick guide to help a couple of people from reddit on this post how to setup Grafana and Prometheus in Unraid, most of this is guide is based on the guide published on the unraid blog that you can check here.

Guide

1. Go to Community Apps (CA) and download the Grafana Docker container. Be sure to input your server's IP or hostname in the Key1 section when first setting up the container:

2. Download the Prometheus Docker container from CA. Note: The docker will be stopped after the installation and will be fixed in the next steps:

2 png 946cb68e998fa387165974e6909fda24

One thing i can recommend is changing the data path from the appdata to the array so that you don't have issues with the docker image filling up.

Another important thing is to add some extra stuff to the "Extra Arguments" and "Post Arguments" fields by pressing the "ADVANCED VIEW" button.

Now add --restart unless-stopped to the "Extra Parameters" field so that it auto restarts in case it crashes for some reason.

In the "Post Arguments" add --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus/data --storage.tsdb.retention.time=1yยด, you can change the retention time for the metrics by changing the last option from "1y" to for example "30d" for 30 days retention time.

3. Download and install the apcupsd-exporter docker container from CA by searching for jangrewe/apcupsd-exporter and clicking on Click Here To Get More Results From DockerHub so that it shows results from dockerhub

Then press install and on the next dialog press Yes to allow CA to attempt to setup the template automatically.

4. Download the 'prometheus.yml' and place it in your '.../appdata/prometheus/etc' directory on your Unraid server:

prometheus.yml

Note: You must be logged in to the Unraid forums to download.

4 png 96cc50fa9c18f39aa67e9d2a66f00bc9

5. Open the prometheus.yml and edit the 'YOURUNRAIDSERVERIP' part so that it matches your server's IP and and change the 9100 port to the one you used in the apcupsd-exporter docker then save and close the file:

Grafik png ee3b0e0cdd69c0a7ef1721c2371cada3

6. Go to your Docker page and start the Prometheus Docker container.

7. After it is started, click the Prometheus container again and select WebUI:

7 png 96d2375e264b0313b8c1f410eb29b73a

8. On the top click on "Status -> Targets":

8 png 53aaa38b26d15f1a8735b001352c5402

9. You should see now a list with two entries, the entry "YOURSERVERIP:PORT" should display "UP" like in the following screenshot:

9 png 6cb1c5ad75be767ef685b93643650703

10. Go to the Docker page, start the Grafana WebUI and log in with your Username and Password (default: admin | admin):

11 png 1923b8680f4a963a9803bea601b30b22

11. If you left it at default you should change the password in the next screen to something secure:

Screen Shot 2021 07 09 at 2 43 51 PM

12. Next we are going to configure the Prometheus data source in Grafana by clicking on the "Gear Icon -> Data sources":

13 png faa6e420d69e14ce1a8d3948196cbb7e

13. Click on "Add data source" and at Prometheus click on "Select":

15 png 6ac103a0ad48ff850563cb05c24db04c

In the "URL" field change the link to match the IP and PORT you used in the prometheus.yml.

17 png 947086221b2746ede69849179817b8d8

15. At the bottom click on "Save & Test" and you should see this message:

19 png 09cbf0e153c2d60239fac03e81d16b16

16. In Grafana click on "+ -> Import":

20 png c0d39ddfa4a702aeb79d1e655626e47e

17. Now we are going to import a pre-configured Dashboard for the Node Exporter from Grafana.com (Source). To do this, simply enter the ID 19243 from the Dashboard and click "Load":

21 png 772dec12d4c9af8e71e9ccf81aa0702e

If the dashboard link is not working you can download this file and instead of using the dashboard ID upload the JSON file using the button above.

Based on a guide made by ich777 for the unraid blog so if you found this helpful...please consider donating to ich777 for this and all of his other hard work!

18. In the next screen be sure to select "Prometheus" as the data source and rename the Dashboard to your liking and click Import.

22 png 7ad439aa8b1279aed32eb2cc42890d08

Now, you should be greeted with something like this:

24 thumb png 5ab37e17649af4054d3c766fd0793c15

Keep in mind that the Dashboard can display N/A values since there is not enough data available. Wait a few minutes and you will see that the values begin to fill in.

If you had any issues with this guide or found any error (likely to have some since this was made at work during the night shift and while i was really tired) you can contact me either by leaving a comment below or DM me in Discord, my username is toino.

Alternatively you can also reply to this reddit comment or DM me there.