Line 201: |
Line 201: |
| | | |
| /sbin/e-smith/expand-template /etc/ups/upsd.users | | /sbin/e-smith/expand-template /etc/ups/upsd.users |
− | /usr/sbin/upsd -c reload | + | service nut restart |
| | | |
| ===UPS Variables and Commands=== | | ===UPS Variables and Commands=== |
Line 226: |
Line 226: |
| | | |
| /sbin/e-smith/expand-template /etc/ups/upsd.users | | /sbin/e-smith/expand-template /etc/ups/upsd.users |
− | /usr/sbin/upsd -c reload | + | service nut restart |
| | | |
| {{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 admin user 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 | + | service nut restart |
| }} | | }} |
| | | |
Line 250: |
Line 250: |
| 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 | + | service nut restart |
| | | |
| 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 259: |
| 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 286: |
Line 286: |
| | | |
| ====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 432: |
Line 432: |
| | | |
| { | | { |
− | $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"; |
| + | } |
| } | | } |
| | | |