Changes

Jump to navigation Jump to search
470 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 404: Line 411:  
  signal-event reboot
 
  signal-event reboot
   −
=Configure Multimon etc Scripts=
+
=Configure Nut-cgi Monitor Scripts=
The apcupsd-multimon rpm contains four cgi scripts that can be run via the webserver to monitor the UPS(s). The rpm does not install them correctly for SME however so the following modifications are needed.
+
 
  mkdir -p /opt/apcupsd
+
The nut-cgi rpm contains scripts that can be run via the webserver to monitor the UPS(s).
  chown root:www /opt/apcupsd
+
 
mv /var/www/cgi-bin/multimon.cgi /opt/apcupsd
+
===Dowload and install===
  mv /var/www/cgi-bin/upsstats.cgi /opt/apcupsd
+
 
  mv /var/www/cgi-bin/upsfstats.cgi /opt/apcupsd
+
You have to enable the '''[[epel]]''' repositories.
  mv /var/www/cgi-bin/upsimage.cgi /opt/apcupsd
+
yum install --enablerepo=epel nut-cgi
  chown root:www /opt/apcupsd/*
+
 
  chmod 750 /opt/apcupsd/*
+
Edit file /etc/ups/hosts.conf and add.
 +
 
 +
MONITOR UPS@localhost "local UPS"
 +
 
 +
The nut-cgi rpm contains three cgi scripts. The rpm does not install them correctly for SME however so the following modifications are needed.
 +
 
 +
  mkdir -p /opt/nut-cgi-bin
 +
  chown root:www /opt/nut-cgi-bin
 +
  mv /var/www/nut-cgi-bin/upsstats.cgi /opt/nut-cgi-bin
 +
  mv /var/www/nut-cgi-bin/upsset.cgi /opt/nut-cgi-bin
 +
  mv /var/www/nut-cgi-bin/upsimage.cgi /opt/nut-cgi-bin
 +
  chown root:www /opt/nut-cgi-bin/*
 +
  chmod 750 /opt/nut-cgi-bin/*
 
  mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
 
  mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
 
  cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
 
  cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
   −
Now edit and create a new file ''92apcupsdmon'' with the following content
+
Now edit and create a new file 92nutupscmon with the following content
 +
 
 
  {
 
  {
 
     $OUT = "";
 
     $OUT = "";
Line 423: Line 443:  
     my $pass = '0';
 
     my $pass = '0';
 
     my $satisfy = 'all';
 
     my $satisfy = 'all';
     my $name = $apcupsd{'Name'} || 'APC UPS Daemon Monitoring';
+
     my $name = $nut{'Name'} || 'NUT UPS Daemon Monitoring';
 
   
 
   
 
     for ('exit-if-none')
 
     for ('exit-if-none')
 
     {
 
     {
       if ($apcupsd{'PublicAccess'})
+
       if ($nut{'PublicAccess'})
 
       {
 
       {
           if ($apcupsd{'PublicAccess'} eq 'none')
+
           if ($nut{'PublicAccess'} eq 'none')
 
           {
 
           {
 
             next;
 
             next;
 
           }
 
           }
           elsif ($apcupsd{'PublicAccess'} eq 'local')
+
           elsif ($nut{'PublicAccess'} eq 'local')
 
           {
 
           {
 
             $allow  = $localAccess;
 
             $allow  = $localAccess;
Line 439: Line 459:  
             $satisfy = 'all';
 
             $satisfy = 'all';
 
           }
 
           }
           elsif ($apcupsd{'PublicAccess'} eq 'local-pw')
+
           elsif ($nut{'PublicAccess'} eq 'local-pw')
 
           {
 
           {
 
             $allow  = $localAccess;
 
             $allow  = $localAccess;
Line 445: Line 465:  
             $satisfy = 'all';
 
             $satisfy = 'all';
 
           }
 
           }
           elsif ($apcupsd{'PublicAccess'} eq 'global')
+
           elsif ($nut{'PublicAccess'} eq 'global')
 
           {
 
           {
 
             $allow  = 'all';
 
             $allow  = 'all';
Line 451: Line 471:  
             $satisfy = 'all';
 
             $satisfy = 'all';
 
           }
 
           }
           elsif ($apcupsd{'PublicAccess'} eq 'global-pw')
+
           elsif ($nut{'PublicAccess'} eq 'global-pw')
 
           {
 
           {
 
             $allow  = 'all';
 
             $allow  = 'all';
Line 457: Line 477:  
             $satisfy = 'all';
 
             $satisfy = 'all';
 
           }
 
           }
           elsif ($apcupsd{'PublicAccess'} eq 'global-pw-remote')
+
           elsif ($nut{'PublicAccess'} eq 'global-pw-remote')
 
           {
 
           {
 
             $allow  = $localAccess;
 
             $allow  = $localAccess;
Line 466: Line 486:  
   
 
   
 
       $OUT .= "#------------------------------------------------------------\n";
 
       $OUT .= "#------------------------------------------------------------\n";
       $OUT .= "# apcupsd multimon - $name\n";
+
       $OUT .= "# nut multimon - $name\n";
 
       $OUT .= "#------------------------------------------------------------\n";
 
       $OUT .= "#------------------------------------------------------------\n";
 
   
 
   
 
       {
 
       {
         if ((exists $apcupsd{'URL'}) && ($apcupsd{'URL'} ne <nowiki>''</nowiki>)) {
+
         if ((exists $nut{'URL'}) && ($nut{'URL'} ne <nowiki>''</nowiki>)) {
           $OUT .= "Alias  /$apcupsd{'URL'}  /opt/apcupsd\n";  
+
           $OUT .= "Alias  /$nut{'URL'}  /opt/nut-cgi-bin\n";  
 
         }   
 
         }   
 
       }
 
       }
 
   
 
   
       $OUT .= "Alias  /apcupsd /opt/apcupsd\n";
+
       $OUT .= "Alias  /nut /opt/nut-cgi-bin\n";
 
   
 
   
 
       $OUT .= "\n";
 
       $OUT .= "\n";
       $OUT .= "<Directory /opt/apcupsd>\n";
+
       $OUT .= "<Directory /opt/nut-cgi-bin>\n";
 
       $OUT .= "    DirectoryIndex upsstats.cgi\n";
 
       $OUT .= "    DirectoryIndex upsstats.cgi\n";
 
       $OUT .= "    Options +ExecCGI\n";
 
       $OUT .= "    Options +ExecCGI\n";
Line 497: Line 517:     
Configure databases and expand the template
 
Configure databases and expand the template
db accounts set apcupsd reserved
+
 
  config setprop apcupsd PublicAccess local
+
  config setprop nut PublicAccess local
 
  /sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
 
  /sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
 +
 
{{Note box|The above sets access to the scripts to ''local'' ip addresses only. See the [[Web_Application_RPM#New_DB_settings]] for further info and settings}}
 
{{Note box|The above sets access to the scripts to ''local'' ip addresses only. See the [[Web_Application_RPM#New_DB_settings]] for further info and settings}}
    
Restart the web server
 
Restart the web server
 +
 
  sv t httpd-e-smith
 
  sv t httpd-e-smith
   −
===Usage of Multimon etc Scripts===
+
===Usage of Nut-cgi Scripts===
Now go to http://yourdomain.tld/apcupsd to see the statistics for the UPS at localhost, or https://yourdomain.tld/apcupsd/multimon.cgi for an overview of the UPS(s).
     −
By editing /etc/apcupsd/hosts.conf and adding additional network UPS details, multimon.cgi can be used to monitor more than one UPS. By default only the localhost is monitored.
+
Now go to http://yourdomain.tld/nut to see the statistics and information for the UPS at localhost.
    +
By editing /etc/ups/hosts.conf and adding additional network UPS details, nut-cgi can be used to monitor more than one UPS. By the modification above, only the localhost is monitored.
    
=Aditional Information=
 
=Aditional Information=
66

edits

Navigation menu