Changes

Jump to navigation Jump to search
483 bytes added ,  23:52, 27 February 2015
no edit summary
Line 186: Line 186:     
Issuing commands could shutdown your server unexpectedly!}}
 
Issuing commands could shutdown your server unexpectedly!}}
 +
 
= SME 9 =
 
= SME 9 =
   Line 201: Line 202:  
   
 
   
 
  /sbin/e-smith/expand-template /etc/ups/upsd.users
 
  /sbin/e-smith/expand-template /etc/ups/upsd.users
  /usr/sbin/upsd -c reload
+
  /usr/sbin/upsd -c reload  
    
===UPS Variables and Commands===
 
===UPS Variables and Commands===
Line 226: Line 227:     
  /sbin/e-smith/expand-template /etc/ups/upsd.users
 
  /sbin/e-smith/expand-template /etc/ups/upsd.users
  /usr/sbin/upsd -c reload
+
  /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
+
{{Note box|To disabled the administrative privileges once you have changed the UPS parameters or issued commands as required, issue the commands
 
  config setprop nut AdminUser disabled
 
  config setprop nut AdminUser disabled
 
  /sbin/e-smith/expand-template /etc/ups/upsd.users
 
  /sbin/e-smith/expand-template /etc/ups/upsd.users
  /usr/sbin/upsd -c reload
+
  /usr/sbin/upsd -c reload  
 
}}
 
}}
   Line 250: Line 251:  
  config setprop nut access localhost   
 
  config setprop nut access localhost   
 
  /sbin/e-smith/expand-template /etc/ups/upsd.conf
 
  /sbin/e-smith/expand-template /etc/ups/upsd.conf
signal-event console-save
+
  /usr/sbin/upsd -c reload
    
In localhost or public mode ( no remote access ), access to your ups is ( UPS name is '''UPS''' )
 
In localhost or public mode ( no remote access ), access to your ups is ( UPS name is '''UPS''' )
Line 259: Line 260:  
  slave ups get access with UPS@192.168.1.1 ( ups master IP )
 
  slave ups get access with UPS@192.168.1.1 ( ups master IP )
 
==Setting UPS Variables==
 
==Setting UPS Variables==
In order to set UPS variables it is necessary to have enabled a user with administrative privileges as above first and you get the possibility to run command from slave ups if access is set to private as above.
+
In order to set UPS variables it is necessary to have enabled the administrative privileges as above first and you get the possibility to run command from slave ups if access is set to private as above.
    
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:
 
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:
Line 272: Line 273:  
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"):
 
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
 
  upsrw -s battery.charge.low=20 -u admin -p admin UPS
 +
 +
For remote host (slave UPS ), we need to add the IP from master UPS to run command.
 +
upsrw -s battery.charge.low=20 -u admin -p admin UPS@192.168.2.1
    
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     
 
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     
Line 278: Line 282:  
  upsc UPS
 
  upsc UPS
   −
After you are done, clean up by disabling the '''upsd''' administrative user '''admin''':
+
After you are done, clean up by disabling the '''upsc''' administrative privileges:
 
{{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!}}
 
{{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!}}
   Line 286: Line 290:     
====Issuing UPS Commands====
 
====Issuing UPS Commands====
In order to issue UPS commands it is necessary to have enabled a user with administrative privileges as above first.
+
In order to issue UPS commands it is necessary to have enabled the administrative privileges as above first and you get the possibility to run command from slave ups if access is set to private as above.
    
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:
 
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:
Line 294: Line 298:  
  upscmd -l UPS
 
  upscmd -l UPS
   −
You can now issue a command to the UPS with similar to the following:
+
You can now issue a command to the localhost UPS with similar to the following:
 
  upscmd -u admin -p admin UPS test.battery.start
 
  upscmd -u admin -p admin UPS test.battery.start
 +
 +
For remote host (slave UPS ), we need to add the IP from master UPS to run command.
 +
upscmd -u admin -p admin UPS@192.168.2.1 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.
 
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''':
+
After you are done, clean up by disabling the '''upsc''' administrative privileges:
 
{{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!
 
{{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!
   Line 432: Line 439:     
  {
 
  {
    $OUT = "";
+
    $OUT = "";
    my $allow = 'all';
+
    my $allow = 'all';
    my $pass = '0';
+
    my $pass = '0';
    my $satisfy = 'all';
+
    my $satisfy = 'all';
    my $name = $nut{'Name'} || 'NUT UPS Daemon Monitoring';
+
    my $name = $nut{'Name'} || 'NUT UPS Daemon Monitoring';
    for ('exit-if-none')
+
    {
+
    for ('exit-if-none')
      if ($nut{'PublicAccess'})
+
    {
      {
+
      if ($nut{'PublicAccess'})
          if ($nut{'PublicAccess'} eq 'none')
+
      {
          {
+
          if ($nut{'PublicAccess'} eq 'none')
          next;
+
          {
          }
+
            next;
          elsif ($nut{'PublicAccess'} eq 'local')
+
          }
          {
+
          elsif ($nut{'PublicAccess'} eq 'local')
            $allow  = $localAccess;
+
          {
            $pass    = 0;
+
            $allow  = $localAccess;
            $satisfy = 'all';
+
            $pass    = 0;
          }
+
            $satisfy = 'all';
          elsif ($nut{'PublicAccess'} eq 'local-pw')
+
          }
          {
+
          elsif ($nut{'PublicAccess'} eq 'local-pw')
            $allow  = $localAccess;
+
          {
            $pass    = 1;
+
            $allow  = $localAccess;
            $satisfy = 'all';
+
            $pass    = 1;
          }
+
            $satisfy = 'all';
          elsif ($nut{'PublicAccess'} eq 'global')
+
          }
          {
+
          elsif ($nut{'PublicAccess'} eq 'global')
            $allow  = 'all';
+
          {
            $pass    = 0;
+
            $allow  = 'all';
            $satisfy = 'all';
+
            $pass    = 0;
          }
+
            $satisfy = 'all';
          elsif ($nut{'PublicAccess'} eq 'global-pw')
+
          }
          {
+
          elsif ($nut{'PublicAccess'} eq 'global-pw')
            $allow  = 'all';
+
          {
            $pass    = 1;
+
            $allow  = 'all';
            $satisfy = 'all';
+
            $pass    = 1;
          }
+
            $satisfy = 'all';
          elsif ($nut{'PublicAccess'} eq 'global-pw-remote')
+
          }
          {
+
          elsif ($nut{'PublicAccess'} eq 'global-pw-remote')
            $allow  = $localAccess;
+
          {
            $pass    = 1;
+
            $allow  = $localAccess;
            $satisfy = 'any';
+
            $pass    = 1;
          }
+
            $satisfy = 'any';
      }  
+
          }
      $OUT .= "#------------------------------------------------------------\n";
+
      }  
      $OUT .= "# nut multimon - $name\n";
+
      $OUT .= "#------------------------------------------------------------\n";
+
      $OUT .= "#------------------------------------------------------------\n";
      {
+
      $OUT .= "# nut multimon - $name\n";
        if ((exists $nut{'URL'}) && ($nut{'URL'} ne '')) {
+
      $OUT .= "#------------------------------------------------------------\n";
          $OUT .= "Alias  /$nut-cgi-bin{'URL'}  /opt/nut-cgi-bin\n";  
+
        }   
+
      {
      }
+
        if ((exists $nut{'URL'}) && ($nut{'URL'} ne <nowiki>''</nowiki>)) {
      $OUT .= "Alias  /nut  /opt/nut-cgi-bin\n";
+
          $OUT .= "Alias  /$nut{'URL'}  /opt/nut-cgi-bin\n";  
      $OUT .= "\n";
+
        }   
      $OUT .= "<Directory /opt/nut-cgi-bin>\n";
+
      }
      $OUT .= "    DirectoryIndex upsstats.cgi\n";
+
      $OUT .= "    Options +ExecCGI\n";
+
      $OUT .= "Alias  /nut  /opt/nut-cgi-bin\n";
      $OUT .= "    order deny,allow\n";
+
      $OUT .= "    deny from all\n";
+
      $OUT .= "\n";
      $OUT .= "    allow from $allow\n";
+
      $OUT .= "<Directory /opt/nut-cgi-bin>\n";
      if ($pass)
+
      $OUT .= "    DirectoryIndex upsstats.cgi\n";
      {
+
      $OUT .= "    Options +ExecCGI\n";
          $OUT .= "    AuthName $name\n";
+
      $OUT .= "    order deny,allow\n";
          $OUT .= "    AuthType Basic\n";
+
      $OUT .= "    deny from all\n";
          $OUT .= "    AuthExternal pwauth\n";
+
      $OUT .= "    allow from $allow\n";
          $OUT .= "    require valid-user\n";
+
      if ($pass)
          $OUT .= "    Satisfy $satisfy\n";
+
      {
      }
+
          $OUT .= "    AuthName $name\n";
      $OUT .= "</Directory>\n";
+
          $OUT .= "    AuthType Basic\n";
    }
+
          $OUT .= "    AuthExternal pwauth\n";
 +
          $OUT .= "    require valid-user\n";
 +
          $OUT .= "    Satisfy $satisfy\n";
 +
      }
 +
      $OUT .= "</Directory>\n";
 +
    }
 
  }
 
  }
  
66

edits

Navigation menu