Changes

From SME Server
Jump to navigationJump to search
3,771 bytes added ,  00:52, 23 February 2015
no edit summary
Line 403: Line 403:  
  signal-event post-upgrade
 
  signal-event post-upgrade
 
  signal-event reboot
 
  signal-event reboot
 +
 +
=Configure Multimon etc 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
 +
chown root:www /opt/apcupsd
 +
mv /var/www/cgi-bin/multimon.cgi /opt/apcupsd
 +
mv /var/www/cgi-bin/upsstats.cgi /opt/apcupsd
 +
mv /var/www/cgi-bin/upsfstats.cgi /opt/apcupsd
 +
mv /var/www/cgi-bin/upsimage.cgi /opt/apcupsd
 +
chown root:www /opt/apcupsd/*
 +
chmod 750 /opt/apcupsd/*
 +
mkdir -p /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
 +
{
 +
    $OUT = "";
 +
    my $allow = 'all';
 +
    my $pass = '0';
 +
    my $satisfy = 'all';
 +
    my $name = $apcupsd{'Name'} || 'APC UPS Daemon Monitoring';
 +
 +
    for ('exit-if-none')
 +
    {
 +
      if ($apcupsd{'PublicAccess'})
 +
      {
 +
          if ($apcupsd{'PublicAccess'} eq 'none')
 +
          {
 +
            next;
 +
          }
 +
          elsif ($apcupsd{'PublicAccess'} eq 'local')
 +
          {
 +
            $allow  = $localAccess;
 +
            $pass    = 0;
 +
            $satisfy = 'all';
 +
          }
 +
          elsif ($apcupsd{'PublicAccess'} eq 'local-pw')
 +
          {
 +
            $allow  = $localAccess;
 +
            $pass    = 1;
 +
            $satisfy = 'all';
 +
          }
 +
          elsif ($apcupsd{'PublicAccess'} eq 'global')
 +
          {
 +
            $allow  = 'all';
 +
            $pass    = 0;
 +
            $satisfy = 'all';
 +
          }
 +
          elsif ($apcupsd{'PublicAccess'} eq 'global-pw')
 +
          {
 +
            $allow  = 'all';
 +
            $pass    = 1;
 +
            $satisfy = 'all';
 +
          }
 +
          elsif ($apcupsd{'PublicAccess'} eq 'global-pw-remote')
 +
          {
 +
            $allow  = $localAccess;
 +
            $pass    = 1;
 +
            $satisfy = 'any';
 +
          }
 +
      }
 +
 +
      $OUT .= "#------------------------------------------------------------\n";
 +
      $OUT .= "# apcupsd multimon - $name\n";
 +
      $OUT .= "#------------------------------------------------------------\n";
 +
 +
      {
 +
        if ((exists $apcupsd{'URL'}) && ($apcupsd{'URL'} ne <nowiki>''</nowiki>)) {
 +
          $OUT .= "Alias  /$apcupsd{'URL'}  /opt/apcupsd\n";
 +
        } 
 +
      }
 +
 +
      $OUT .= "Alias  /apcupsd  /opt/apcupsd\n";
 +
 +
      $OUT .= "\n";
 +
      $OUT .= "<Directory /opt/apcupsd>\n";
 +
      $OUT .= "    DirectoryIndex upsstats.cgi\n";
 +
      $OUT .= "    Options +ExecCGI\n";
 +
      $OUT .= "    order deny,allow\n";
 +
      $OUT .= "    deny from all\n";
 +
      $OUT .= "    allow from $allow\n";
 +
      if ($pass)
 +
      {
 +
          $OUT .= "    AuthName $name\n";
 +
          $OUT .= "    AuthType Basic\n";
 +
          $OUT .= "    AuthExternal pwauth\n";
 +
          $OUT .= "    require valid-user\n";
 +
          $OUT .= "    Satisfy $satisfy\n";
 +
      }
 +
      $OUT .= "</Directory>\n";
 +
    }
 +
}
 +
 +
Configure databases and expand the template
 +
db accounts set apcupsd reserved
 +
config setprop apcupsd PublicAccess local
 +
/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}}
 +
 +
Restart the web server
 +
sv t httpd-e-smith
 +
 +
===Usage of Multimon etc 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.
 +
    
=Aditional Information=
 
=Aditional Information=
66

edits

Navigation menu