dzomaya / NUTandRpi

A repo for Network UPS Tools and Eaton Tripp Lite UPS demo scripts
MIT License
130 stars 9 forks source link

Update the docs on how to export the data to grafana. #10

Open sebasdt opened 1 year ago

sebasdt commented 1 year ago

Hi, good day!

In the last week, I was searching for a way to export NUT data from the host to the Grafana dashboard and I found a solution. The exporter uses Prometheus for data collection and docker. Also, it was easy to set up for me.

Yes, there are plenty of ways how to achieve the same goal, but this is the best way I could find. It might be useful to document it for now until a better solution is found. This is just to get people started.

Your setup may differ from what I got, this is how I did it. Like for me all docker containers are on the same host as the NUT-server.

Installation process: Here is the Prometheus nut exporter.

You will need docker compose and docker. Install docker with this command: curl -sSL https://get.docker.com/ | CHANNEL=stable bash && systemctl enable --now docker And for docker-compose you can follow this guide

Read the README and Grab the docker-compose file on the GitHub page. Follow the usual steps to create a stack, you may also use Portainer.

Now if you don't already have Prometheus and Grafana installed do it now.

The exporter exports the data to Prometheus so grab the Prometheus config on GitHub. Prometheus config provides the NUT-server and Prometheus-server ip, The exporter must have access to the nut server without any credentials. For me, it worked out of the box and started to collect data.

Log into Grafana and if you haven't already added the data source and then the dashboard. Here below is the dashboard I've used, make it to your liking: https://grafana.com/grafana/dashboards/15406-yet-another-prometheus-nut-exporter/

If you would like to add another graph but don't know the keyword look here

This is just a template you or someone else can expand on. Thank you for your time and awesome repo!

edit: It has been a while now and perfected my dashboard for my needs. here below is how its looks. https://imgur.com/a/BTbXn0V

dzomaya commented 1 year ago

Nice! Thanks @sebasdt ! I appreciate all the feedback and contributions!

Added the Documentation and Good first issue tags to this one. I think it'll be a good add to the docs.

sebasdt commented 1 year ago

Hey,

How is your mission going for getting the data off from your old laptop? I thought was a while and am curious if you already had the time.

Greetings,

Sebastiaan

dzomaya commented 1 year ago

Hi, Thanks for checking in! I still need a power supply. I plan to grab one the week of the 22nd, then probably look at this over that weekend.

dzomaya commented 1 year ago

@sebasdt I'm a bit behind on this one, but did not forget.

sebasdt commented 1 year ago

Hey, I would like to give a small update on how it's going in my lab. The exporter has been running flawlessly for over a month without any issues, logging away like it's nothing. Here below is my current dashboard for One UPS. I can share it, one note! Be aware it may not work for your setup.

image Added some monitoring whenever the ups go down or something else weird happens I get notified via discord.

How is it going on your end?

dzomaya commented 1 year ago

Nice, thanks! I'm still just a bottleneck here. Later this month or early May is probably when I'll have my next round of updates.