Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Copy the downloaded file there. Verify the md5um (optional) and unpack it.

# mkdir /usr/nut

# cp nut-2.6.5.tar.gz /usr/nut/

# cd /usr/nut

# tar xzvpf nut-2.6.5.tar.gz

4.) In a terminal, "cd" into the directory you just unpacked. You should be in the directory that contains the configure file.

...

The files below are for use with an APC SmartUPS, with the thought that I might want it to be a master controller. In initially writing this page, I just noticed that I never created a nut.conf file, to set this as either a netserver or standalone netclient mode. Like I said, I followed the expert's blog, and he didn't even mention this file. I would think that it shouldn't work at all without this, but it does did for me.  I have since edited this page, and included this file, after I set this up on a machine that would be acting as a netclient.

Also, system admin work is not my strong suit, so make adjustments to your files as necessary. You will at least need to change your IP Addresses, user names, passwords, etc. anyway.

nut.conf

ups.conf

upsd.conf

upsd.users

...

8.) Now change permissions on the created config files so that only ups user is able to read them, as your password is stored there. If you don't do this, it won't work. I lost many hours trying to set NUT up the first time on Linux a few years ago because I neglected this one, very important step.

# cd # cd /opt/nut/etc
# chgrp # chgrp ups nut.conf ups.conf upsd.conf upsmon.conf upssched.conf
# chmod # chmod 640 nut.conf ups.conf upsd.conf upsmon.conf upssched.conf

...

You will need to put a proper email address in this, or comment out that line, as it suits you.  If you decide to have it email you, I also recommend putting your hostname in the email address subject part so you know which server is emailing you.

This is the modified notify script:

...

chmod +x /opt/nut/lib/svc/method/nut

Note:  This method file has been changed from earlier versions of this wiki page.

I've modified this a little from what was on the Oracle blog.  The Oracle expert had the stop method returning 1.  This caused the service to go into maintenance mode for me when I stopped or restarted the service.  Sorry, but I didn't notice that right away  So I changed it to return 0, and it seems to work properly now.  Also, when I compiled this on a machine that did not have a UPS attached to it, it did not even put upsdrvctl in the /opt/nut/bin directory, so I changed the method file to check to see if the upsdrvctl file even existed before trying to shut it down.


The /var/svc/manifest/network directory already exists, so all you need to do is copy the below file into there.

...

1.) They put the backend module that NUT Monitor uses in a different directory than the application. So, the easiest way to deal with this is to copy it into the same directory as the application. I used Gnome's Nautilus to do this, but this should work from the command line:

# cp # cp /usr/nut/nut-2.6.5/scripts/python/module/PyNUT.py /usr/nut/nut-2.6.5/scripts/python/app/PyNUT.py

2.) Make it executable:

chmod # chmod +x /usr/nut/nut-2.6.5/scripts/python/app/PyNUT.py

3.) I edited the nut-monitor.desktop file to point the application and the png file to the correct location. The modified file is below. Copy it to /usr/share/applications

nut-monitor.desktop

4.) Change the permissions to match the others in the directory

# chown root:bin /usr/share/applications/nut-monitor.desktop
# chmod 100644 /usr/share/applications/nut-monitor.desktop

5.) To launch it, go into Gnome's "Applications->Internet->NUT Monitor"

Hopefully it will launch!

56.) Type in the IP Address (or possibly name) of the machine that is monitoring the UPS. Press the "Refresh" button.  Hopefully you will see your UPS. Then press the "Connect" button to see its state.

...


Disclaimer: I didn't take this detailed of notes when I set this up . When I build our next server, I'll go the first time, and then used those notes to write this page. I've built another server since then, and found a few errors in the earlier version of this page.  I've gone through this step by step to verify everything, and make any made changes to this page as necessary. It should be pretty close, though. Hopefully I got everything.  

I hope it helps!