Feature #1760

NUT UPS configuration

Added by Giacomo Sanchietti over 8 years ago. Updated about 8 years ago.

Status:CLOSEDStart date:
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:nethserver-nut
Target version:v6.4-beta2
Resolution: NEEDINFO:No

Description

Support UPS configuration via NUT.

http://www.networkupstools.org/

smart-ups.dev - Dummy UPS driver configuration (1.14 KB) Davide Principi, 07/17/2013 03:25 PM


Related issues

Related to NethServer 6 - Feature #2067: Lib: synchronize service status prop and chkconfig CLOSED 07/17/2013 07/17/2013
Related to NethServer 6 - Bug #2842: NutUPS - Dashboard error when configured as slave CLOSED

Associated revisions

Revision 5ca310b1
Added by Giacomo Sanchietti about 8 years ago

First import. Refs #1760

Revision 19a910f4
Added by Giacomo Sanchietti about 8 years ago

web ui: add new paramaters. Refs #1760

Revision 604a43b8
Added by Giacomo Sanchietti about 8 years ago

web ui: add dashboardm plugin. Refs #1760

Revision feff45ed
Added by Giacomo Sanchietti about 8 years ago

web ui: fix dashboard translations. Refs #1760

Revision 04b7df08
Added by Giacomo Sanchietti about 8 years ago

web ui: cleanup dashboard. Refs #1760

Revision a6e8b423
Added by Giacomo Sanchietti about 8 years ago

spec: add changelog for release 1.0.0. Refs #1760

Revision 13176a1d
Added by Giacomo Sanchietti about 8 years ago

comps-ns64.xml.in: add nethserver-nut group. Refs #1760

Revision 19b5d01c
Added by Giacomo Sanchietti about 8 years ago

web ui: fix dashboard warnings when UPS is not connected. Refs #1760

Revision 8ebb0572
Added by Giacomo Sanchietti about 8 years ago

upsd.conf template: remove invalid fragment. Refs #1760

Revision dc92cbdc
Added by Giacomo Sanchietti about 8 years ago

upsd.conf template: remove invalid fragment. Refs #1760

Revision b507042c
Added by Giacomo Sanchietti about 8 years ago

web ui: remove php warning on temperature parameter. Refs #1760

Revision 78cb16e7
Added by Giacomo Sanchietti about 8 years ago

Generate a random password when needed. Refs #1760

Revision 2583bfb8
Added by Giacomo Sanchietti about 8 years ago

web ui: remove Description field, add suggestion form for Model prop. Refs #1760

History

#1 Updated by Giacomo Sanchietti over 8 years ago

Added rpm from epel to nethserver-base repository.

#2 Updated by Giacomo Sanchietti over 8 years ago

  • Target version changed from ~FUTURE to v6.4-beta2

#3 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from NEW to ON_DEV
  • Assignee set to Giacomo Sanchietti
  • % Done changed from 0 to 30

#4 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from ON_DEV to ON_QA
  • % Done changed from 30 to 80

#5 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from ON_QA to ON_DEV
  • % Done changed from 80 to 30

Needs documentation.

#6 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from ON_DEV to MODIFIED
  • % Done changed from 30 to 70

All implementation is done.

#7 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from MODIFIED to ON_QA
  • % Done changed from 70 to 80

Package ready in testing.

To test and install:
yum --enablerepo=nethserver-testing groupinstall @nethserver-nut

Install optional packages:
yum --enablerepo=nethserver-testing install nethserver-nut collectd-nut

#8 Updated by Alessio Fattorini about 8 years ago

  • Assignee changed from Giacomo Sanchietti to Alessio Fattorini
  • NEEDINFO changed from No to Yes

First problem
Error installing group

# yum --enablerepo=nethserver-testing groupinstall @nethserver-nut
Loaded plugins: fastestmirror, nethserver
Loading mirror speeds from cached hostfile
Setting up Group Process
Loading mirror speeds from cached hostfile
Warning: Group @nethserver-nut does not exist.
No packages in any requested group available to install or update

Installing packages no problem

yum --enablerepo=nethserver-testing install nethserver-nut collectd-nut

Installed:
  collectd-nut.x86_64 0:4.10.9-1.el6                nethserver-nut.noarch 0:1.0.0-1.ns6               

Dependency Installed:
  collectd.x86_64 0:4.10.9-1.el6                    lm_sensors-libs.x86_64 0:3.1.1-17.el6            
  net-snmp-libs.x86_64 1:5.5-44.el6_4.2             nut.x86_64 0:2.6.5-1.el6                         
  nut-client.x86_64 0:2.6.5-1.el6                   yajl.x86_64 0:1.0.7-3.el6       

Second Problem
After installation of NUT, Dashboard is broken.

Notice: Uninitialized string offset: 0 in /usr/share/nethesis/NethServer/Template/Dashboard/Nut.php on line 4 Notice: Uninitialized string offset: 0 in /usr/share/nethesis/NethServer/Template/Dashboard/Nut.php on line 5 Notice: Uninitialized string offset: 0 in /usr/share/nethesis/NethServer/Template/Dashboard/Nut.php on line 6 Notice: Uninitialized string offset: 0 in /usr/share/nethesis/NethServer/Template/Dashboard/Nut.php on line 7 Notice: Uninitialized string offset: 0 in /usr/share/nethesis/NethServer/Template/Dashboard/Nut.php on line 8 Notice: Uninitialized string offset: 0 in /usr/share/nethesis/NethServer/Template/Dashboard/Nut.php on line 9 Notice: Uninitialized string offset: 0 in /usr/share/nethesis/NethServer/Template/Dashboard/Nut.php on line 10 Notice: Uninitialized string offset: 0 in /usr/share/nethesis/NethServer/Template/Dashboard/Nut.php on line 11 Notice: Uninitialized string offset: 0 in /usr/share/nethesis/NethServer/Template/Dashboard/Nut.php on line 15
Model
Notice: Uninitialized string offset: 0 in /usr/share/nethesis/NethServer/Template/Dashboard/Nut.php on line 35
Status
Notice: Undefined variable: upsstatus_label in /usr/share/nethesis/NethServer/Template/Dashboard/Nut.php on line 36

Should i fill a bug?

#9 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from ON_QA to ON_DEV
  • Assignee changed from Alessio Fattorini to Giacomo Sanchietti
  • % Done changed from 80 to 30

First problem
Error installing group

Command is wrong in my previous comment.
Right syntax:

yum --enablerepo=nethserver-testing groupinstall nethserver-nut

or
yum --enablerepo=nethserver-testing install @nethserver-nut

Second Problem
After installation of NUT, Dashboard is broken.

Patch below:

--- /usr/share/nethesis/NethServer/Template/Dashboard/Nut.php.ori    2013-07-04 16:17:46.084561919 +0000
+++ /usr/share/nethesis/NethServer/Template/Dashboard/Nut.php    2013-07-04 16:20:31.718696915 +0000
@@ -1,18 +1,19 @@
 <?php

 $status = $view['status'];
-$load = intval($status['ups.load']);
-$involtage = intval($status['input.voltage']);
-$outvoltage = intval($status['output.voltage']);
-$outvoltage = intval($status['output.voltage']);
-$involtage = intval($status['input.voltage']);
-$battcharg = intval($status['battery.charge']);
-$battvolt = intval($status['battery.voltage']);
-$runtime = intval($status['battery.runtime']/60);
+$load = @intval($status['ups.load']);
+$involtage = @intval($status['input.voltage']);
+$outvoltage = @intval($status['output.voltage']);
+$outvoltage = @intval($status['output.voltage']);
+$involtage = @intval($status['input.voltage']);
+$battcharg = @intval($status['battery.charge']);
+$battvolt = @intval($status['battery.voltage']);
+$runtime = @intval($status['battery.runtime']/60);
 $battvolt_min = 30;
 $battvolt_max = 60;

-$upsstatus = $status['ups.status'];
+$upsstatus = @$status['ups.status'];
+$upsstatus_label = "";
 $color = "green";
 if (strpos($upsstatus,"OL") !== false) {
     $upsstatus_label = "on_line_label";
@@ -29,10 +30,13 @@
     $color = 'red';
 }

+if (!isset($status['ups.model'])) {
+   return $T("no_info");
+}

 echo "<div class='nut-item'>";
 echo "<dl>";
-echo "<dt>".$T('model_label')."</dt><dd>"; echo $status['ups.model']; echo "</dd>";
+echo "<dt>".$T('model_label')."</dt><dd>"; echo @$status['ups.model']; echo "</dd>";
 echo "<dt>".$T('status_label')."</dt><dd><span style='color:$color; font-weight: bold'>"; echo $T($upsstatus_label); echo "</span></dd>";
 echo "<dt>".$T('load_label')."</dt><dd>"; echo $load; echo "/100<div id='dashboard_nut_load'></div>"; echo "</dd>";
 echo "<dt>".$T('battery_chrg_label')."</dt><dd>"; echo $battcharg; echo "/100<div id='dashboard_battery_chrg'></div>"; echo "</dd>";

#10 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from ON_DEV to MODIFIED
  • % Done changed from 30 to 70

#11 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from MODIFIED to ON_DEV
  • % Done changed from 70 to 30

New rpm in nethserver-testing: nethserver-nut-1.0.3-1

#12 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from ON_DEV to MODIFIED
  • % Done changed from 30 to 70

#13 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from MODIFIED to ON_QA
  • % Done changed from 70 to 80

#14 Updated by Davide Principi about 8 years ago

  • Assignee deleted (Giacomo Sanchietti)

In nethserver-testing:
nethserver-nut-1.0.3-1.ns6.noarch.rpm

#15 Updated by Davide Principi about 8 years ago

Alessio Fattorini wrote:

Should i fill a bug?

Create a bug only for released packages: nethserver-testing repository is for QA, thus it contains only non-released packages!

If QA verification fails, put the issue into ON_DEV state.

#16 Updated by Davide Principi about 8 years ago

  • Assignee set to Davide Principi
  • NEEDINFO changed from Yes to No

#17 Updated by Davide Principi about 8 years ago

For testing, configure the dummy-ups driver:

  1. Override etc/ups/ups.conf template fragment 30access
      # mkdir -p /etc/e-smith/templates-custom/etc/ups/ups.conf/
      # cat > /etc/e-smith/templates-custom/etc/ups/ups.conf/30access <<EOF
    [UPS]
        driver = dummy-ups
        port = /etc/ups/smart-ups.dev
        desc = "dummy-ups APC - Smart-UPS USB" 
    EOF
    
  2. Copy smart-ups.dev into /etc/ups/
  3. Enable NUT UPS from server-manager
  4. Save

#18 Updated by Davide Principi about 8 years ago

  • Status changed from ON_QA to ON_DEV
  • % Done changed from 80 to 30

#19 Updated by Davide Principi about 8 years ago

  • Status changed from ON_DEV to MODIFIED
  • % Done changed from 30 to 70

Enabling/disabling ups service does not change chkconfig settings. This must be fixed in source:nethserver-lib|root/etc/e-smith/events/actions/adjust-services@996a74a0

See #2067

Not really MODIFIED, no code patch is present.

#20 Updated by Davide Principi about 8 years ago

  • Status changed from MODIFIED to ON_DEV
  • % Done changed from 70 to 30

Verification FAILED

If the UI password field is empty upsmon startup fails:

Jul 17 16:31:15 davidep2 esmith::event[16958]: Starting upsd: [  OK  ]#015
Jul 17 16:31:15 davidep2 esmith::event[16958]: Starting UPS monitor (master): [FAILED]#015

Is it possible to require the password only in Slave mode? In the master case it can be generated automatically. Moreover, moving the "Password" form field under the "Slave" panel would simplify the UI form.

#21 Updated by Davide Principi about 8 years ago

  • Assignee deleted (Davide Principi)

#22 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from ON_DEV to MODIFIED
  • Assignee set to Giacomo Sanchietti
  • % Done changed from 30 to 70
Updates:
  • Password is auto-generated on first install. If the system is in Master mode, password can't be modified from web UI
  • Added a simple form for driver suggestion during UPS configuration. The user should take care to edit the driver field accordingly to suggestions from http://www.networkupstools.org/stable-hcl.html

#23 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from MODIFIED to ON_QA
  • Assignee deleted (Giacomo Sanchietti)
  • % Done changed from 70 to 80
New rpm in nethserver-testing:
  • nethserver-nut-1.0.4

#24 Updated by Alessio Fattorini about 8 years ago

  • Assignee set to Alessio Fattorini

#25 Updated by Alessio Fattorini about 8 years ago

  • Status changed from ON_QA to VERIFIED
  • % Done changed from 80 to 100

Updated:
nethserver-nut.noarch 0:1.0.4-1.ns6

  • First problem is fixed.
    yum --enablerepo=nethserver-testing install @nethserver-nut
    
  • Second problem is fixed, webui is not broken anymore.
  • I confirm that password is generated on first install
  • Form suggestion works

#26 Updated by Davide Principi about 8 years ago

  • Status changed from VERIFIED to CLOSED
  • Assignee deleted (Alessio Fattorini)
  • % Done changed from 90 to 100

Moved to nethserver-updates repository

#27 Updated by Davide Principi almost 7 years ago

  • Related to Bug #2842: NutUPS - Dashboard error when configured as slave added

Also available in: Atom PDF