Difference between revisions of "UPS Sandbox"

From SME Server
Jump to navigationJump to search
Line 85: Line 85:
 
Confirm server is communicating with master:
 
Confirm server is communicating with master:
 
  upsc UPS@192.168.33.11
 
  upsc UPS@192.168.33.11
 +
 +
= SME8 =
  
 
====Connecting multiple UPS's====
 
====Connecting multiple UPS's====
 
To be added http://bugs.contribs.org/show_bug.cgi?id=629
 
To be added http://bugs.contribs.org/show_bug.cgi?id=629
 
+
= SME 9 =
 
{{#switchtablink:Second section header|Click here to go to the next tab...}}
 
{{#switchtablink:Second section header|Click here to go to the next tab...}}
  

Revision as of 05:21, 14 February 2015


Is this article helpful to you?
Please consider donating or volunteering
Thank you!

Uninterruptable Power Supply

PythonIcon.png Skill level: Advanced
The instructions on this page may require deviations from standard procedures. A good understanding of linux and Koozali SME Server is recommended.


Introduction

The primary goal of the Network UPS Tools (NUT) project is to provide reliable monitoring of UPS hardware and ensure safe shutdowns of the systems which are connected.

The default configuration of NUT, will keep your connected systems operational until a critical battery state is reached (ie battery is nearing exhaustion) and then power down your server/equipment in a controlled fashion. See http://www.networkupstools.org/

If you have an APC UPS, see also Uninterruptable_Power_Supply:APC for an alternative to the standard SME Nut implementation

If you have Dell UPS, this might Help Uninterruptable_Power_Supply:LatestGeekery

Default Configuration (USB)

The default configuration in SME Server for 'NUT' is set by the configuration database properties

Model  = usbhid-ups
status = disabled
type   = service
Important.png Note:
Absence of a 'Master' property setting defaults the configuration to being a Master setup. That is a UPS connected directly to the server via USB or serial cable is assumed. See later for setting as a Slave.

The default is for NUT to be disabled, that is no UPS connected


Most USB connected UPS's will work with these default settings. If using a USB connection just enable NUT as follows:

config setprop nut status enabled
signal-event post-upgrade
signal-event reboot

If your USB UPS does not work properly OR you have a serial device then follow the Configuration Options below as required.

Configuration Options

Not all UPS's are supported by USB or the usbhid-ups driver. However NUT supports many UPS's and can be configured under SME Server easily.

Serial Connection

  1. Find the configuration details for your model of UPS. Refer to: http://www.networkupstools.org/stable-hcl.html and make note of the driver name and upstype number (if any) in the third column.
    Warning.png Warning:
    Always use the serial cable supplied with the UPS. Standard serial cables won't work with a serial UPS and have been known to cause damage to the UPS. Pay particular attention to any references to cable in in the UPS Model column.

  2. From the consol issue the following commands: config setprop nut Model <model> config setprop nut Device <device> config setprop nut Type <type> config setprop nut status enabled Where:
    <model> and <type> are the driver name and type number found above.
    <device> is the serial port that the UPS is connected to eg. /dev/ttyS0. It also possible to use a more readable symlink. See HowTo on udev - symlinks for details. Note: The case of Model, Device and Type.
  3. Check: config show nut
  4. Apply changes and restart server: signal-event post-upgrade signal-event reboot Alternatively, without NUT running or requiring a server reboot: signal-event console-save service nut start
  5. Confirm server is communicating with UPS: upsc UPS@localhost Whenever a UPS event occurs Emails are sent to the admin account.

Configuring as a slave

Set configuration values:

config setprop nut SlaveUPS UPS@192.168.33.11
config setprop nut Master no

Where 192.168.33.11 is your UPS master, that is the computer that is in direct communication with the UPS. The hostname of that computer may also work.

Apply changes and restart server:

signal-event post-upgrade
signal-event reboot 

Confirm server is communicating with master:

upsc UPS@192.168.33.11
[edit]

Connecting multiple UPS's

To be added http://bugs.contribs.org/show_bug.cgi?id=629

Aditional Information

There are template fragments in /etc/e-smith/templates/etc/ups that control the config files located in /etc/ups. The default settings should be OK for most situations.

By default, NUT is configured for a USB connected UPS in Master mode, but is disabled. When enabled, NUT will monitor the UPS and take various actions when certain notifications are received. This is controlled by the /etc/ups/upsmon.conf file which among other things lists the notifications and the actions to be taken for each. For example an On Battery event is captured by the NOTIFYFLAG ONBATT entry and the following SYSLOG+WALL+EXEC command string. This string tells upsmon to write the event to the System Log, broadcast a message to all users via Wall, and execute the command denoted by the NOTIFYCMD entry.

SME Server sets the NOTIFYCMD to /sbin/e-smith/nutUPS.notify, and this executable file simply sends an email to the SME admin user with a notification of the event.

Apart from the various events that the UPS and upsmon may notify via the NOTIFYFLAGS a Low Battery event will automatically and immediately cause upsmon to issue the SHUTDOWNCMD as defined in upsmon.conf (signal-event halt) and set a flag POWERDOWNFLAG so it knows on future restart that it is a UPS recovery.

For information on configuration parameters:

man ups.conf
man upsd.conf
man upsd.users
man upsmon.conf
man upssched.conf

For general information:

man upsd
man nutupsdrv

The NUT website is here: NUT

From the above references you can glean which configuration setting does what function, etc.

If you want to modify the operation of NUT from the standard configuration, then you should generally modify the NUT config files by creating custom templates, expanding the templates and restarting service. This will ensure modifications survive a future reboot or reconfiguration.

An example of doing this can be found in the forum [2] and in the section above for UPS Administrative Privileges

See also Known Problem - Restarting Nut


Documentation

Nut is a Software well documented, you can find the TOC here and with an overview