Coder Social home page Coder Social logo

nutandrpi's Introduction

How to monitor your UPS with free software + a Raspberry Pi

I'm going to guess you're here because you want to set up basic UPS monitoring on a Raspberry Pi or similar Linux system.

You are in the right place, Internet Stranger. There's a strong possibility you've been searching the Internet for a solution, so let's start with telling you what you can expect to find if you keep reading:

  • What? A basic script that installs Network UPS Tools (NUT) and some other packages.
  • How? By downloading our script and running it on a Raspberry Pi or similar Linux system.
  • Why? So you can have HTTP and SNMP v2c monitoring within minutes of running the script.

Of course, there's more you may want to do with your UPS software like adding shutdown configurations, monitoring multiple UPSes, or hardening the setup with encrypted protocols and secure configurations. To help you get started with that, we'll also review how the script works and provide some tips on how you can extend it or manually configure NUT to meet specific needs.

And, this isn't just a one-off post. We plan to update the process and script over time based on user feedback. You can even directly contribute! Just make a pull request with your suggested improvements.

Here's an Asciicast of what the script method looks like: asciicast

Why are we doing this?

The Network UPS Tools (NUT) project does a lot of good work in our industry. A lot of the UPS integrations you see in various systems (e.g., NAS devices and console servers) are made possible by NUT. Simply put, there is a lot of cool stuff you can do with NUT.

But, we often see these problems:

  • People don't know all the cool stuff NUT can do
  • NUT can be complex to configure if you don't know where to start

So, we wanted to let you know about NUT and make it easy to get started. We also wanted to get some conversations going around what you want to be able to do with your Linux systems and UPSes, and make this project collaborative between us and the community. So, if you have ideas, feature requests, comments, notice bugs, or do something cool with Network UPS Tools, let us know.

Supported UPS list

This process should work with a wide variety of UPS systems with a USB port. That said, our testing has been with select Tripp Lite and Eaton branded UPSes. Here's a running list of recommended UPSes:

How to use the basic script

⚠️ Enterprise-grade security not included We're assuming you're on a home or test network and we're not doing any production-grade security stuff. The HTTP and SNMP v2c protocols both transmit data in plaintext. You can — and I encourage you to — modify the installation script to meet specific security requirements but we're leaving that up to you, brave Internet Stranger.

Prerequisites

  • A supported UPS.
  • A Linux computer running Raspberry Pi OS, Ubuntu, or a similar operating system that uses apt
  • root/sudo privleges
  • A USB connection between the UPS and the Linux computer. You can confirm the UPS is connected using the lsusb command. In the example below, we see a TRIPPLITE UPS image
  • Ports 161 (UDP), 80 (TCP), and 3493 (TCP) open
  • None of these packages installed:
    • nut
    • nut-cgi
    • snmp
    • snmpd
    • libsnmp-dev
    • snmp-mibs-downloader
    • net-snmp

Process

  1. Access your computer's terminal (e.g., via SSH)
  2. Download the script
wget https://raw.githubusercontent.com/dzomaya/NUTandRpi/main/scripts/nutinstall.sh

image 3. Make the script executable

sudo chmod +x nutinstall.sh

image

  1. Run the script
sudo ./nutinstall.sh
  1. At the If you haven't updated your package lists with a command like apt-get update or apt update within the last day or so, you should do that now. Want us to run apt update for you? Answer y for yes or anything else for no. prompt, answer y if you want to run apt update -y now or answer n to skip running apt update -y here. If you ran apt update or apt-get update before running the script, n is the right answer.
  2. At the Do you want to assume the risk and continue? Enter 'y' for yes or 'n' for no. prompt, enter y to assume the risk and continue. image
  3. At the 'Tell me what SNMP v2c community string I should use for your configuration:' prompt, input a 1-32 character alphanumeric SNMP v2c community string. This is the community string that the script will use to configure your SNMP settings. image
  4. Now the script will run and configure Network UPS Tools, the nut-cgi package (including Apache), and your SNMP settings. This can take a couple of minutes. At the end of the script, you should see a message similar to:
You should now be able to see cool UPS stats at http://localhost/cgi-bin/nut/upsstats.cgi.
'snmpwalk -v2c -c <the community from earlier> localhost .1.3.6.1.4.1.8072.1.3.2.4.1.2' should give you some SNMP data too.
This was fun. Thanks. Have a great day Internet Freind. Goodbye

image

That's it! You're off to the races with your UPS monitoring.

Now you can do cool stuff like:

snmpwalk -v2c -c yourSNMPv2cCommunity yourRasberryPiIPaddress .1.3.6.1.4.1.8072.1.3.2.4.1.2

Output should look similar to

NET-SNMP-EXTEND-MIB::nsExtendOutLine."upsmfr".1 = STRING: TRIPPLITE
NET-SNMP-EXTEND-MIB::nsExtendOutLine."inputHZ".1 = STRING: 59.9
NET-SNMP-EXTEND-MIB::nsExtendOutLine."outputHZ".1 = STRING: 59.9
NET-SNMP-EXTEND-MIB::nsExtendOutLine."upsmodel".1 = STRING: TRIPPLITE UPS
NET-SNMP-EXTEND-MIB::nsExtendOutLine."battvolts".1 = STRING: 54.0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."inputvolt".1 = STRING: 126.0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."upsserial".1 = STRING: 3104JLCPS795200451
NET-SNMP-EXTEND-MIB::nsExtendOutLine."upsstatus".1 = STRING: OL
NET-SNMP-EXTEND-MIB::nsExtendOutLine."battcharge".1 = STRING: 100
NET-SNMP-EXTEND-MIB::nsExtendOutLine."outputload".1 = STRING: 0.0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."outputvolt".1 = STRING: 120.0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."battruntimeest".1 = STRING: 65535

image Now that you've exposed the data via SNMP, you can use a wide-range of monitoring utilites like NagiOS, LibreNMS, and Observium to do all sorts of cool things.

You can read up on the OIDs we used in the OID explainer.

How to install and configure NUT and Net-SNMP manually

Our script won't work for everyone and you learn more doing it manually anyway, so let's walk through how you can manually install and configure NUT.

⚠️ Enterprise-grade security not included We're assuming you're on a home or test network and we're not doing any production-grade security stuff. The HTTP and SNMP v2c protocols both transmit data in plaintext. You can — and I encourage you to — modify the installation script to meet specific security requirements but we're leaving that up to you, brave Internet Stranger.

Prerequisites

  • A supported UPS.
  • A Linux computer running Raspberry Pi OS, Ubuntu, or a similar operating system
    • Just about any *nix system should work, our commands just assume Ubuntu-like stuff such as the apt command
  • root/sudo privleges to run commands
  • A USB connection between the UPS and the Linux computer. You can confirm the UPS is connected using the lsusb command. In the example below, we see a TRIPPLITE UPS image
  • Ports 161 (UDP), 80 (TCP), and 3493 (TCP) open
  • None of these packages installed:
    • nut
    • nut-cgi
    • snmp
    • snmpd
    • libsnmp-dev
    • snmp-mibs-downloader
    • net-snmp

(Optional) Update your system

If you haven't updated your system in a while, it's a good idea to access your computer's terminal (e.g., via SSH) and run:

sudo apt update

To make sure you get the latest available packages in the next steps.

Install NUT and nut-cgi

  1. Access your computer's terminal (e.g., via SSH)
  2. Use apt to install the nut and nut-cgi packages
sudo apt install nut nut-cgi

image

Configure NUT

  1. Run this command:
nut-scanner -UNq

The output should look similar to:

SNMP library not found. SNMP search disabled.
Neon library not found. XML search disabled.
IPMI library not found. IPMI search disabled.
[nutdev1]
        driver = "usbhid-ups"
        port = "auto"
        vendorid = "09AE"
        productid = "4004"
        bus = "003"

You'll need everything under (and including) [nutdev1] for the next step. image

  1. Use a text editor (e.g., nano or vi) to edit /etc/nut/ups.conf and append the output from step 1. Using our example output, the uncommented section of the ups.conf file should look like this:
maxretry = 3
[nutdev1]
        driver = "usbhid-ups"
        port = "auto"
        vendorid = "09AE"
        productid = "4004"
        bus = "003"
  1. Use a text editor (e.g. nano or vi) to edit /etc/nut/nut.conf to read
MODE=netserver

image 4. Make sure your UPS is now communicating by running the upsc nutdev1 command. Output should look similar to:

Init SSL without certificate database
battery.charge: 100
battery.charge.low: 20
battery.charge.warning: 20
battery.runtime: 65535
battery.temperature: 28.9
battery.type: PbAc
battery.voltage: 54.0
battery.voltage.nominal: 48.0
device.mfr: TRIPPLITE
device.model: TRIPPLITE UPS
device.serial: 3104JLCPS795200451
device.type: ups
driver.name: usbhid-ups
driver.parameter.bus: 003
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.product: TRIPPLITE UPS
driver.parameter.productid: 4004
driver.parameter.serial: 3104JLCPS795200451
driver.parameter.synchronous: no
driver.parameter.vendor: TRIPPLITE
driver.parameter.vendorid: 09AE
driver.version: 2.7.4
driver.version.data: TrippLite HID 0.82
driver.version.internal: 0.41
input.frequency: 60.0
input.transfer.high: 150.0
input.transfer.high.max: 150
input.transfer.high.min: 145
input.transfer.low: 55.0
input.transfer.low.max: 60
input.transfer.low.min: 55
input.voltage: 126.0
input.voltage.nominal: 120
output.current: 0.0
output.frequency: 60.0
output.frequency.nominal: 60
output.voltage: 120.0
output.voltage.nominal: 120
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.delay.start: 30
ups.firmware: 64
ups.load: 0
ups.mfr: TRIPPLITE
ups.model: TRIPPLITE UPS
ups.power: 0.0
ups.power.nominal: 2200
ups.productid: 4004
ups.serial: 3104JLCPS795200451
ups.status: OL
ups.test.result: Done and passed
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.timer.start: 0
ups.vendorid: 09ae
ups.watchdog.status: 0

image

  1. Add your UPS to the NUT hosts.conf file by using a text editor (e.g. nano or vi) to edit /etc/nut/hosts.conf and add this line to the end of the file:
MONITOR nutdev1@localhost \"Pepper and Egg UPS\"

image

Configure Apache

  1. Apache was installed when we intsalled the nut-cgi package. Enable the cgi module with this command:
a2enmod cgi

You should see output similar to:

Your MPM seems to be threaded. Selecting cgid instead of cgi.
Enabling module cgid.
To activate the new configuration, you need to run:
  systemctl restart apache2
  1. Restart Apache with this command:
systemctl restart apache2

image

Install Net-SNMP

  1. Use apt to install the snmp, snmpd, libsnmp-dev, and snmp-mibs-downloader packages
sudo apt install snmp snmpd libsnmp-dev snmp-mibs-downloader

image

Configure Net-SNMP

  1. Use a text editor (e.g., nano or vi) to create an /etc/snmp/snmpd.conf file and add your SNMP v2c community string to the begining. To create a read-only tripplite, add this entry (edit your community string to be something only you know):
rocommunity tripplite

Don't save your changes just yet, we have some more edits to make.

  1. Next, we're going to add upsc commands to the /etc/snmp/snmpd.conf. For our example, we'll add these 12 lines:
extend-sh upsmodel "/bin/upsc nutdev1 ups.model"
extend-sh upsmodel "/bin/upsc nutdev1 ups.model"
extend-sh upsserial "/bin/upsc nutdev1 ups.serial"
extend-sh upsstatus "/bin/upsc nutdev1 ups.status"
extend-sh battcharge "/bin/upsc nutdev1 battery.charge"
extend-sh battruntimeest "/bin/upsc nutdev1 battery.runtime"
extend-sh battvolts "/bin/upsc nutdev1 battery.voltage"
extend-sh inputvolt "/bin/upsc nutdev1 input.voltage"
extend-sh inputHZ "/bin/upsc nutdev1 input.frequency"
extend-sh outputvolt "/bin/upsc nutdev1 output.voltage"
extend-sh outputHZ "/bin/upsc nutdev1 output.frequency"
extend-sh outputHZ "/bin/upsc nutdev1 output.frequency"

Now, save your changes. The file should look like this when you're done:

image

  1. Enable the snmpd service
sudo systemctl enable snmpd
  1. Restart the snmpd service
sudo  systemctl restart snmpd

HAVE A LOT OF FUN!

That's it! You're off to the races with your UPS monitoring.

Now you can do cool stuff like:

snmpwalk -v2c -c yourSNMPv2cCommunity yourRasberryPiIPaddress .1.3.6.1.4.1.8072.1.3.2.4.1.2

Output should look similar to

NET-SNMP-EXTEND-MIB::nsExtendOutLine."upsmfr".1 = STRING: TRIPPLITE
NET-SNMP-EXTEND-MIB::nsExtendOutLine."inputHZ".1 = STRING: 59.9
NET-SNMP-EXTEND-MIB::nsExtendOutLine."outputHZ".1 = STRING: 59.9
NET-SNMP-EXTEND-MIB::nsExtendOutLine."upsmodel".1 = STRING: TRIPPLITE UPS
NET-SNMP-EXTEND-MIB::nsExtendOutLine."battvolts".1 = STRING: 54.0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."inputvolt".1 = STRING: 126.0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."upsserial".1 = STRING: 3104JLCPS795200451
NET-SNMP-EXTEND-MIB::nsExtendOutLine."upsstatus".1 = STRING: OL
NET-SNMP-EXTEND-MIB::nsExtendOutLine."battcharge".1 = STRING: 100
NET-SNMP-EXTEND-MIB::nsExtendOutLine."outputload".1 = STRING: 0.0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."outputvolt".1 = STRING: 120.0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."battruntimeest".1 = STRING: 65535

image Now that you've exposed the data via SNMP, you can use a wide-range of monitoring utilites like NagiOS, LibreNMS, and Observium to do all sorts of cool things.

You can read up on the OIDs we used in the OID explainer.

Other cool stuff you can do

What we've done here will give you a good starting point for UPS monitoring. That said, we know there are plenty of other things you might want to do. We might even up date this project to do some of them in the future, but for now here are some tips to point you in the right direction.

If you just want to explore what you can do in general, Roger Price has done a great job with NUT documentation: https://rogerprice.org/NUT/

Operating System and UPS shutdown

Often, you'll want to gracefully shutdown operating systems and shut down UPS output based on certain UPS events. upsmon and section 6.3 of the NUT User's Manual is a good place to start. There is a full PDF version of the manual here.

Additionally, YouTuber Techno Tim has a video that walks through setting up multiple UPSes, a NUT Server and clients (including the Windows WinClient), and system shutdown.

Monitoring multiple UPSes

Again, the NUT User's Guide and Techno Tim video are good references. For a straightforward use case, consider starting with adding additional USB-connected UPSes in your /etc/nut/ups.conf file.

Create cool-looking dashboards with Grafana

Grafana is a great open source project for data visualization and graphing. Once you have NUT and Net-SNMP configured it's possible to take those values and graph them in Grafana. For example, I used Grafana, InfluxDB, and Telegraf to put this together using data from one of our NUT/Net-SNMP installs. Grafana with NUT and Net-SNMP

Additionally, Grafana is extensible enough that you could even take SNMP out of the mix altogether and use upsc or similar to capture the data.

Configuring SNMP v3

SNMP v3 is a bit more complex than SNMP v2c, but it also uses encryption and is significantly more secure. For a deep understanding of Net-SNMP configuration, you should check out their docs.

If you're just testing, a quick way to get started creating SNMP v3 users is to use the net-snmp-config --create-snmpv3-user command.

For example, to create a PiNutAdmin SNMP v3 user with read-only permissions that uses AES and SHA with an auth and privacy passwords both set to pepperandegg, we can do this:

  1. Stop the snmpd service sudo systemctl stop snmpd
  2. Run the command to create the user sudo net-snmp-config --create-snmpv3-user -ro -x AES -a SHA -A "pepperandegg" -X "pepperandegg" PiNutAdmin
  3. Start the snmpd service sudo systemctl start snmpd
  4. Run an snmpwalk to see if your user can read UPS data snmpwalk -v 3 -u PiNutAdmin -l AuthPriv -x AES -a SHA -X pepperandegg -A pepperandegg localhost .1.3.6.1.4.1.8072.1.3.2.4.1.2 You should see output similar to:
NET-SNMP-EXTEND-MIB::nsExtendOutLine."upsmfr".1 = STRING: TRIPPLITE
NET-SNMP-EXTEND-MIB::nsExtendOutLine."inputHZ".1 = STRING: 59.9
NET-SNMP-EXTEND-MIB::nsExtendOutLine."outputHZ".1 = STRING: 59.9
NET-SNMP-EXTEND-MIB::nsExtendOutLine."upsmodel".1 = STRING: TRIPPLITE UPS
NET-SNMP-EXTEND-MIB::nsExtendOutLine."battvolts".1 = STRING: 54.0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."inputvolt".1 = STRING: 126.0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."upsserial".1 = STRING: 3104JLCPS795200451
NET-SNMP-EXTEND-MIB::nsExtendOutLine."upsstatus".1 = STRING: OL
NET-SNMP-EXTEND-MIB::nsExtendOutLine."battcharge".1 = STRING: 100
NET-SNMP-EXTEND-MIB::nsExtendOutLine."outputload".1 = STRING: 0.0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."outputvolt".1 = STRING: 120.0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."battruntimeest".1 = STRING: 65535

SNMP v3 user for NUT UPS test configuration

How to uninstall

If you want to undo what the script did and uninstall the packages it installs, follow these steps.

⚠️ Warning rm -rf is mentioned and used in some of the steps below. rm -rf recursively deletes files. Be careful!

  1. Remove the packages the script installs with this command:
sudo apt-get remove  nut nut-cgi snmp snmpd libsnmp-dev snmp-mibs-downloader
  1. Remove the unneeded packages left behind after you removed the packages:
sudo apt-get autoremove
  1. Remove the snmpd.conf file the script modifies
sudo rm /etc/snmp/snmpd.conf

Note: If you want to remove the MIB files in /etc/snmp/ and the /etc/snmp directory completely, use sudo rm -rf /etc/snmp/.

  1. Remove the /etc/nut directory and it's contents:
sudo rm -rf /etc/nut

Send us your feedback and contribute

We want to hear from you.

  • If you have a suggested improvement for the scripts or process, make a pull request.
  • If you notice a bug or have a feature request, report an issue.
  • If you're from an organization that needs a solution for a specific Linux/UPS application, shoot me a message.

Good bye and good luck, Internet Stranger.

nutandrpi's People

Contributors

dzomaya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nutandrpi's Issues

Play date with Klipper

Good day! I have stumbled across this wonderful Git, have everything installed just so. However when trying to navigate through my browser, it's pulling up my Klipper interface rather than NUT. Please help! I'm very novice at this, I'm sure there is a work around but I should would appreciate some help. Thank you!

Add option to enable remote upsd connections

Some users want upsd to talk to other systems over a LAN (for examples, see Home Assistant and WinClient use cases on #4 and #1). This is relatively easy to do for IPv4 with a LISTEN directive in the upsd.conf file.

Fix references to tripplite.com and [email protected] to call out something else

Currently, lines 12-14 of the script are echo statements that say:

echo "You should really read the associated article on Github or Tripplite.com to understand what you're getting into."
echo " "
echo " If you need a production-grade solution, I recommend contacting [email protected]"

The article related to this project is at: https://www.eaton.com/us/en-us/products/backup-power-ups-surge-it-power-distribution/backup-power-ups/raspberry-pi.html (not any tripplite.com domain) and "[email protected]" is not the correct address people interested in a production-grade solution should contact (feel free to just DM me for now if you are).

I need to figure out better text, which should be quick. This might be a good first issue for anyone looking to get involved while tackling something simple, so I'll slap that label on it for now.

Accessing UPS info page results in "Error: can't open template file (upsstats.html)"

Hi,

As I talked before in a earlier #8 issue
Here is what I could find.

Linux OS:
Debian 11

The issue:
While trying to access the UPS info page The user receives a Error: can't open template file (upsstats.html)

Possible causes:

  • Something is up with the permissions.
  • The file doesn't exist on the host.

What I could find is that the upsstats.html seems to be missing on the machine.
Trying to find the files with a upsstats in there name with: find / -name "upsstats.*" results in:
/usr/share/man/man8/upsstats.cgi.8.gz
/usr/share/man/man5/upsstats.html.5.gz
/usr/lib/cgi-bin/nut/upsstats.cgi

Solution!
here it is

Turns out two files were missing from NUT it self here is how to get the website working again:

1. On the host system go to the NUT directory with `cd /etc/nut`

2. Create a file called `nano upsstats.html` and paste the contents of [upsstats.html.sample](https://raw.githubusercontent.com/networkupstools/nut/master/conf/upsstats.html.sample) to the file.

3. Now do the same for `nano upsstats-single.html` with the contents of [upsstats-single.html.sample](https://raw.githubusercontent.com/networkupstools/nut/master/conf/upsstats-single.html.sample)

Now reload the page and it should be up and running.

If more information is needed feel free to ask.

Build from source/support 2.8.0

Right now, most repos are still serving NUT 2.7.4 instead of the latest version 2.8.0. Since the script uses apt, that means most users will get 2.7.4. Building from source or otherwise getting 2.8.0 would allow users to get the latest stable build of NUT instead of 2.7.4. At least one user has already asked:
#1

We could also make the script more portable (right now, it depends on apt which limits us to the Debain-y stuff that uses apt).

The 2.8.0 problem solves itself when/if the default repos start serving 2.8.0 (I expect that "soon", but not sure how long).

Uninstall

It would be nice to either document or automate the steps to revert / uninstall the actions taken by this script. I think docs in README.md would be a good start. Thank you for this!

Apache2 not installing (fix)

Hello,
Thanks for creating this script. It saved me a ton of time setting up NUT server.

I did run into one issue where apache was not installed with the script, this was verified because the command a2enmod cgi was not found.

To fix, here is what I did:

upsd -c stop

sudo apt-get update
sudo apt-get install apache2

sudo ./nutinstall.sh

I hope this helps anyone who comes across it, or the fix can be added directly into the script.

Open ports?

Hi im trying out this script after hearing about it from Techno Tim youtube channel.
After running the script everything seems to work fine, i can access the 3 webpages with information.

But when trying to connect with Windows NUT Client or when trying to add the server into Home-Assistant i dont seem to be able to connect.

All devices is on the same network, and if i run the windows tool "Advanced Port Scanner" it says only port 22 & 80 is open.

I installed the script on a Raspberry Pi 3b+ with a PoE hat, running Pi OS Lite (64-bit)

The UPS is an "APC Back-UPS 850 BE850G2-GR UPS" in my livingroom.

I have another "APC Back UPS Pro - BR900MI - UPS 900VA" in my serverrack that is connected to my Synology NAS (that have an internal NUT server) and this one is working in Home-Assistant, and i can see that the port 3493 is open on my NAs when i port scan.

Output from the pi:

sudo netstat -lptu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:ssh             0.0.0.0:*               LISTEN      517/sshd: /usr/sbin
tcp        0      0 localhost:nut           0.0.0.0:*               LISTEN      6201/upsd
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      517/sshd: /usr/sbin
tcp6       0      0 localhost:nut           [::]:*                  LISTEN      6201/upsd
tcp6       0      0 [::]:http               [::]:*                  LISTEN      6229/apache2
udp        0      0 0.0.0.0:bootpc          0.0.0.0:*                           604/dhcpcd
udp        0      0 0.0.0.0:56464           0.0.0.0:*                           332/avahi-daemon: r
udp        0      0 0.0.0.0:snmp            0.0.0.0:*                           9571/snmpd
udp        0      0 0.0.0.0:mdns            0.0.0.0:*                           332/avahi-daemon: r
udp6       0      0 [::]:50963              [::]:*                              332/avahi-daemon: r
udp6       0      0 [::]:mdns               [::]:*                              332/avahi-daemon: r

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

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

Adding multiple UPSs with the script

I just tried the script and it did add ONE of my 3 UPS units. I have 1x APC and 2x CyberPower 1500VA units that I want to get working with NUT. I have installed and ran NUT before but always had issues so I was hopeful that this would solve my issues but it only setup 1 on the CGI page but did see all 3 when running the script.

image

Script is failing to install "snmp-mibs-downloader" on debian 11.

Hi,

I was trying to install NUT using this amazing script. the only thing that seems to be failing is that apt can't find "snmp-mibs-downloader".

This is the error it spits out:
`Package snmp-mibs-downloader is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'snmp-mibs-downloader' has no installation candidate
cp: cannot stat '/etc/snmp/snmpd.conf': No such file or directory`

I do have to say I needed to reinstall due to me not having the right UPS plugged in. I'm using Linux Debian 11 on a Intel processor..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.