Changes

From SME Server
Jump to navigationJump to search
no edit summary
Line 25: Line 25:     
Most USB connected UPS's will work with these default settings. If using a USB connection just enable NUT as follows:
 
Most USB connected UPS's will work with these default settings. If using a USB connection just enable NUT as follows:
 +
 +
<tabs container>
 +
<tab name="SME 10">
 +
For '''SME 10''', systemd is now in use. We have created a generic service for your convenience:
    +
config setprop nut status enabled
 +
signal-event e-smith-nutUPS-update
 +
systemctl start nut.service
 +
</tab>
 +
<tab name="SME 9 and earlier">
 
  config setprop nut status enabled
 
  config setprop nut status enabled
 
  signal-event post-upgrade
 
  signal-event post-upgrade
 
  signal-event reboot
 
  signal-event reboot
    +
</tab>
 +
</tabs>
 
If your USB UPS does not work properly OR you have a '''serial device''' then follow the Configuration Options below as required.
 
If your USB UPS does not work properly OR you have a '''serial device''' then follow the Configuration Options below as required.
   −
For '''SME 10''', systemd is now in use. We have created a generic service for your convenience:
  −
  −
config setprop nut status enabled
  −
signal-event e-smith-nutUPS-update
  −
systemctl start nut.service
      
===Configuration Options===
 
===Configuration Options===
Line 98: Line 104:  
To be added http://bugs.contribs.org/show_bug.cgi?id=629
 
To be added http://bugs.contribs.org/show_bug.cgi?id=629
   −
= SME8 =
+
<tabs container>
 
+
<tab name="SME 9">
===UPS Variables and Commands===
  −
In some cases you may wish to modify variables on the actual UPS such as the Low Charge/LOWBATTERY setting. This requires the use of the '''upsrw''' command and UPS administrative privileges.
  −
 
  −
You may also want to control the UPS directly from the command line by issuing UPS commands. This requires use of the '''upscmd''' command and UPS administrative privileges.
  −
{{Warning box|In general, the UPS data should be left protected and changes to it or issuing of commands well thought out. If you wish to make data changes or issue commands then the administrative privileges can be enabled as below and should then be disabled.}}
  −
 
  −
====UPS Administrative Privileges====
  −
In order to be able to use '''upsrw''' and '''upscmd''' it is necessary to have a suitable additional user defined in the '''upsd.users''' configuration file.
  −
 
  −
In order to create a suitable user we will use SME Servers templating system and configuration database. This is based on an original forum thread[http://forums.contribs.org/index.php?topic=40668.0].
  −
 
  −
First we need to create a suitable custom template directory
  −
mkdir -p /etc/e-smith/templates-custom/etc/ups/upsd.users
  −
cd /etc/e-smith/templates-custom/etc/ups/upsd.users
  −
 
  −
Create and edit a new file called 'admin' with the following content:
  −
{
  −
    # create admin user for upsd to allow setting of
  −
    # UPS parameters via upsrw
  −
  −
    $OUT .= "";
  −
    return unless (($nut{AdminUser} || 'disabled') eq 'enabled');
  −
    return unless (($nut{AdminPass} || <nowiki>''</nowiki>) ne <nowiki>''</nowiki>);
  −
  −
    $OUT .= "\n";
  −
    $OUT .= "       [admin]\n";
  −
    $OUT .= "              password  = $nut{AdminPass}\n";
  −
    if ( ($nut{Master} || 'yes') ne 'no') {
  −
        $OUT .= "              allowfrom = localhost\n";
  −
    } else {
  −
        $OUT .= "              allowfrom = localhost localnet\n";
  −
    }
  −
    $OUT .= "              actions  = set\n";
  −
    $OUT .= "              instcmds  = all\n";
  −
}
  −
 
  −
Create two new database properties for nut
  −
config setprop nut AdminUser enabled                (This enables the creation of the user in the template above)
  −
config setprop nut AdminPass admin                  (This sets a password for the admin user. Set to whatever you want)
  −
 
  −
Now, to get '''upsd''' to recognise the new user with the required administrative privileges we expand the template and reload the '''upsd''' configuration
  −
/sbin/e-smith/expand-template /etc/ups/upsd.users
  −
/usr/sbin/upsd -c reload
  −
 
  −
{{Note box|To disabled the admin user once you have changed the UPS parameters or issued commands as required, issue the commands
  −
config setprop nut AdminUser disabled
  −
/sbin/e-smith/expand-template /etc/ups/upsd.users
  −
/usr/sbin/upsd -c reload
  −
}}
  −
 
  −
==Setting UPS Variables==
  −
In order to set UPS variables it is necessary to have enabled a user with administrative privileges as above first.
  −
 
  −
In the examples below, it is assumed your UPS name is '''UPS''', that it is local, that the administrative user is '''admin''' and password '''admin'''. You can verify your UPS name via:
  −
upsc -l
  −
 
  −
To view a complete list of the UPS variables, both informational and modifiable
  −
upsc UPS
  −
 
  −
To determine the modifiable variables for your UPS, their current settings and their available setting values execute the command:
  −
upsrw UPS
  −
 
  −
You can now modify the variables you wish using a command similar to the following (Note the order of the arguments is important, and you may need quotes around the value being set, "20"):
  −
upsrw -s battery.charge.low=20 -u admin -p admin UPS
  −
 
  −
Where the value after '''-s''' should be one of the parameters identified by the '''upsrw ups''' command. You can of course verify your changes using   
  −
upsrw UPS
  −
or
  −
upsc UPS
  −
 
  −
After you are done, clean up by disabling the '''upsd''' administrative user '''admin''':
  −
{{Warning box|Make sure you understand the meaning or the UPS variables and their available setting options. Verify that your changes meet your intended behaviour!}}
  −
 
  −
More information on upsrw can be found at:
  −
 
  −
- Manual page: man upsrw
  −
 
  −
====Issuing UPS Commands====
  −
In order to issue UPS commands it is necessary to have enabled a user with administrative privileges as above first.
  −
 
  −
In the examples below, it is assumed your UPS name is '''UPS''', that it is local, that the administrative user is '''admin''' and password '''admin'''. You can verify your UPS name via:
  −
upsc -l
  −
 
  −
To view a complete list of available commands for your UPS:
  −
upscmd -l UPS
  −
 
  −
You can now issue a command to the UPS with similar to the following:
  −
upscmd -u admin -p admin UPS test.battery.start
  −
 
  −
Where the command '''test.battery.start''' is a valid command for your UPS as previously determined by '''upscmd -l UPS'''. Depending upon the command issued you may get broadcast messages and emails relating to and confirming what the UPS is doing.
  −
 
  −
After you are done, clean up by disabling the '''upsd''' administrative user '''admin''':
  −
{{Warning box|Before issuing any commands verify what they do for your particular UPS via the relevant documentation and ensure that the command meets your intended behavioural requirement!
  −
 
  −
Issuing commands could shutdown your server unexpectedly!}}
  −
 
  −
= SME 9 =
      
{{Warning box|Be sure to have e-smith-nutUPS-2.4.0-9.el6.sme.noarch or higher to carry on with these instructions. If you get a lower version, just follow SME8 instruction.}}  
 
{{Warning box|Be sure to have e-smith-nutUPS-2.4.0-9.el6.sme.noarch or higher to carry on with these instructions. If you get a lower version, just follow SME8 instruction.}}  
Line 320: Line 229:  
Issuing commands could shutdown your server unexpectedly!}}
 
Issuing commands could shutdown your server unexpectedly!}}
   −
<headertabs />
+
</tab>
 +
<tab name="SME 8">
 +
 
 +
===UPS Variables and Commands===
 +
In some cases you may wish to modify variables on the actual UPS such as the Low Charge/LOWBATTERY setting. This requires the use of the '''upsrw''' command and UPS administrative privileges.
 +
 
 +
You may also want to control the UPS directly from the command line by issuing UPS commands. This requires use of the '''upscmd''' command and UPS administrative privileges.
 +
{{Warning box|In general, the UPS data should be left protected and changes to it or issuing of commands well thought out. If you wish to make data changes or issue commands then the administrative privileges can be enabled as below and should then be disabled.}}
 +
 
 +
====UPS Administrative Privileges====
 +
In order to be able to use '''upsrw''' and '''upscmd''' it is necessary to have a suitable additional user defined in the '''upsd.users''' configuration file.
 +
 
 +
In order to create a suitable user we will use SME Servers templating system and configuration database. This is based on an original forum thread[http://forums.contribs.org/index.php?topic=40668.0].
 +
 
 +
First we need to create a suitable custom template directory
 +
mkdir -p /etc/e-smith/templates-custom/etc/ups/upsd.users
 +
cd /etc/e-smith/templates-custom/etc/ups/upsd.users
 +
 
 +
Create and edit a new file called 'admin' with the following content:
 +
{
 +
    # create admin user for upsd to allow setting of
 +
    # UPS parameters via upsrw
 +
 +
    $OUT .= "";
 +
    return unless (($nut{AdminUser} || 'disabled') eq 'enabled');
 +
    return unless (($nut{AdminPass} || <nowiki>''</nowiki>) ne <nowiki>''</nowiki>);
 +
 +
    $OUT .= "\n";
 +
    $OUT .= "      [admin]\n";
 +
    $OUT .= "              password  = $nut{AdminPass}\n";
 +
    if ( ($nut{Master} || 'yes') ne 'no') {
 +
        $OUT .= "              allowfrom = localhost\n";
 +
    } else {
 +
        $OUT .= "              allowfrom = localhost localnet\n";
 +
    }
 +
    $OUT .= "              actions  = set\n";
 +
    $OUT .= "              instcmds  = all\n";
 +
}
 +
 
 +
Create two new database properties for nut
 +
config setprop nut AdminUser enabled                (This enables the creation of the user in the template above)
 +
config setprop nut AdminPass admin                  (This sets a password for the admin user. Set to whatever you want)
 +
 
 +
Now, to get '''upsd''' to recognise the new user with the required administrative privileges we expand the template and reload the '''upsd''' configuration
 +
/sbin/e-smith/expand-template /etc/ups/upsd.users
 +
/usr/sbin/upsd -c reload
 +
 
 +
{{Note box|To disabled the admin user once you have changed the UPS parameters or issued commands as required, issue the commands
 +
config setprop nut AdminUser disabled
 +
/sbin/e-smith/expand-template /etc/ups/upsd.users
 +
/usr/sbin/upsd -c reload
 +
}}
 +
 
 +
==Setting UPS Variables==
 +
In order to set UPS variables it is necessary to have enabled a user with administrative privileges as above first.
 +
 
 +
In the examples below, it is assumed your UPS name is '''UPS''', that it is local, that the administrative user is '''admin''' and password '''admin'''. You can verify your UPS name via:
 +
upsc -l
 +
 
 +
To view a complete list of the UPS variables, both informational and modifiable
 +
upsc UPS
 +
 
 +
To determine the modifiable variables for your UPS, their current settings and their available setting values execute the command:
 +
upsrw UPS
 +
 
 +
You can now modify the variables you wish using a command similar to the following (Note the order of the arguments is important, and you may need quotes around the value being set, "20"):
 +
upsrw -s battery.charge.low=20 -u admin -p admin UPS
 +
 
 +
Where the value after '''-s''' should be one of the parameters identified by the '''upsrw ups''' command. You can of course verify your changes using   
 +
upsrw UPS
 +
or
 +
upsc UPS
 +
 
 +
After you are done, clean up by disabling the '''upsd''' administrative user '''admin''':
 +
{{Warning box|Make sure you understand the meaning or the UPS variables and their available setting options. Verify that your changes meet your intended behaviour!}}
 +
 
 +
More information on upsrw can be found at:
 +
 
 +
- Manual page: man upsrw
 +
 
 +
====Issuing UPS Commands====
 +
In order to issue UPS commands it is necessary to have enabled a user with administrative privileges as above first.
 +
 
 +
In the examples below, it is assumed your UPS name is '''UPS''', that it is local, that the administrative user is '''admin''' and password '''admin'''. You can verify your UPS name via:
 +
upsc -l
 +
 
 +
To view a complete list of available commands for your UPS:
 +
upscmd -l UPS
 +
 
 +
You can now issue a command to the UPS with similar to the following:
 +
upscmd -u admin -p admin UPS test.battery.start
 +
 
 +
Where the command '''test.battery.start''' is a valid command for your UPS as previously determined by '''upscmd -l UPS'''. Depending upon the command issued you may get broadcast messages and emails relating to and confirming what the UPS is doing.
 +
 
 +
After you are done, clean up by disabling the '''upsd''' administrative user '''admin''':
 +
{{Warning box|Before issuing any commands verify what they do for your particular UPS via the relevant documentation and ensure that the command meets your intended behavioural requirement!
 +
 
 +
Issuing commands could shutdown your server unexpectedly!}}
 +
 
 +
</tab>
 +
 
 +
</tabs>
    
=Scheduling Events=
 
=Scheduling Events=
Super Admin, Wiki & Docs Team, Bureaucrats, Interface administrators, Administrators
3,240

edits

Navigation menu