Line 405: |
Line 405: |
| | | |
| =Configure Multimon etc Scripts= | | =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 | + | ===Dowload and install=== |
− | chown root:www /opt/apcupsd | + | Get the rpms from [http://sourceforge.net/projects/apcupsd/files/rpms%20-%20Stable/3.14.10/ APCUPSD sourceforge] |
− | mv /var/www/cgi-bin/multimon.cgi /opt/apcupsd | + | |
− | mv /var/www/cgi-bin/upsstats.cgi /opt/apcupsd
| + | wget http://sourceforge.net/projects/apcupsd/files/rpms%20-%20Stable/3.14.10/apcupsd-3.14.10-1.el5.x86_64.rpm/download |
− | mv /var/www/cgi-bin/upsfstats.cgi /opt/apcupsd | + | |
− | mv /var/www/cgi-bin/upsimage.cgi /opt/apcupsd | + | Install with yum |
− | chown root:www /opt/apcupsd/* | + | yum localinstall apcupsd-3.14.10-1.el5.x86_64.rpm apcupsd-multimon-3.14.10-1.el5.x86_64.rpm |
− | 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 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/nutups |
| + | chown root:www /opt/nutups |
| + | mv /var/www/nut-cgi-bin/upsstats.cgi /opt/nutups |
| + | mv /var/www/nut-cgi-bin/upsset.cgi /opt/nutups |
| + | mv /var/www/nut-cgi-bin/upsimage.cgi /opt/nutups |
| + | chown root:www /opt/nutups/* |
| + | chmod 750 /opt/nutups/* |
| 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 92nutupsdmon with the following content |
| + | |
| { | | { |
− | $OUT = "";
| + | $OUT = ""; |
− | my $allow = 'all';
| + | my $allow = 'all'; |
− | 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 ($nut{'PublicAccess'}) |
− | if ($apcupsd{'PublicAccess'})
| + | { |
− | {
| + | if ($nut{'PublicAccess'} eq 'none') |
− | if ($apcupsd{'PublicAccess'} eq 'none')
| + | { |
− | {
| + | next; |
− | next;
| + | } |
− | }
| + | elsif ($nut{'PublicAccess'} eq 'local') |
− | elsif ($apcupsd{'PublicAccess'} eq 'local')
| + | { |
− | {
| + | $allow = $localAccess; |
− | $allow = $localAccess;
| + | $pass = 0; |
− | $pass = 0;
| + | $satisfy = 'all'; |
− | $satisfy = 'all';
| + | } |
− | }
| + | elsif ($nut{'PublicAccess'} eq 'local-pw') |
− | elsif ($apcupsd{'PublicAccess'} eq 'local-pw')
| + | { |
− | {
| + | $allow = $localAccess; |
− | $allow = $localAccess;
| + | $pass = 1; |
− | $pass = 1;
| + | $satisfy = 'all'; |
− | $satisfy = 'all';
| + | } |
− | }
| + | elsif ($nut{'PublicAccess'} eq 'global') |
− | elsif ($apcupsd{'PublicAccess'} eq 'global')
| + | { |
− | {
| + | $allow = 'all'; |
− | $allow = 'all';
| + | $pass = 0; |
− | $pass = 0;
| + | $satisfy = 'all'; |
− | $satisfy = 'all';
| + | } |
− | }
| + | elsif ($nut{'PublicAccess'} eq 'global-pw') |
− | elsif ($apcupsd{'PublicAccess'} eq 'global-pw')
| + | { |
− | {
| + | $allow = 'all'; |
− | $allow = 'all';
| + | $pass = 1; |
− | $pass = 1;
| + | $satisfy = 'all'; |
− | $satisfy = 'all';
| + | } |
− | }
| + | elsif ($nut{'PublicAccess'} eq 'global-pw-remote') |
− | elsif ($apcupsd{'PublicAccess'} eq 'global-pw-remote')
| + | { |
− | {
| + | $allow = $localAccess; |
− | $allow = $localAccess;
| + | $pass = 1; |
− | $pass = 1;
| + | $satisfy = 'any'; |
− | $satisfy = 'any';
| + | } |
− | }
| + | } |
− | }
| + | $OUT .= "#------------------------------------------------------------\n"; |
− |
| + | $OUT .= "# nut multimon - $name\n"; |
− | $OUT .= "#------------------------------------------------------------\n";
| + | $OUT .= "#------------------------------------------------------------\n"; |
− | $OUT .= "# apcupsd multimon - $name\n";
| + | { |
− | $OUT .= "#------------------------------------------------------------\n";
| + | if ((exists $nut{'URL'}) && ($nut{'URL'} ne '')) { |
− |
| + | $OUT .= "Alias /$nutups{'URL'} /opt/nutups\n"; |
− | {
| + | } |
− | if ((exists $apcupsd{'URL'}) && ($apcupsd{'URL'} ne <nowiki>''</nowiki>)) {
| + | } |
− | $OUT .= "Alias /$apcupsd{'URL'} /opt/apcupsd\n";
| + | $OUT .= "Alias /nut /opt/nutups\n"; |
− | }
| + | $OUT .= "\n"; |
− | }
| + | $OUT .= "<Directory /opt/nutups>\n"; |
− |
| + | $OUT .= " DirectoryIndex upsstats.cgi\n"; |
− | $OUT .= "Alias /apcupsd /opt/apcupsd\n";
| + | $OUT .= " Options +ExecCGI\n"; |
− |
| + | $OUT .= " order deny,allow\n"; |
− | $OUT .= "\n";
| + | $OUT .= " deny from all\n"; |
− | $OUT .= "<Directory /opt/apcupsd>\n";
| + | $OUT .= " allow from $allow\n"; |
− | $OUT .= " DirectoryIndex upsstats.cgi\n";
| + | if ($pass) |
− | $OUT .= " Options +ExecCGI\n";
| + | { |
− | $OUT .= " order deny,allow\n";
| + | $OUT .= " AuthName $name\n"; |
− | $OUT .= " deny from all\n";
| + | $OUT .= " AuthType Basic\n"; |
− | $OUT .= " allow from $allow\n";
| + | $OUT .= " AuthExternal pwauth\n"; |
− | if ($pass)
| + | $OUT .= " require valid-user\n"; |
− | {
| + | $OUT .= " Satisfy $satisfy\n"; |
− | $OUT .= " AuthName $name\n";
| + | } |
− | $OUT .= " AuthType Basic\n";
| + | $OUT .= "</Directory>\n"; |
− | $OUT .= " AuthExternal pwauth\n";
| + | } |
− | $OUT .= " require valid-user\n";
| |
− | $OUT .= " Satisfy $satisfy\n";
| |
− | }
| |
− | $OUT .= "</Directory>\n";
| |
− | }
| |
| } | | } |
| | | |
| 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 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.
| + | 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 default only the localhost is monitored. |
| | | |
| =Aditional Information= | | =Aditional Information= |