Using QNAP NAS as UPS Server - change nut username

NethServer release 7.6.1810 (final)
Kernel release 3.10.0-862.14.4.el7.x86_64

I tried to configure nethserver as a slave nut to connect to a QNAP NAS UPS Server. The UPS itself (an APC UPS) is connected via USB to the QNAP NAS - this is working and correctly configured and recognized by the QNAP NAS. The IP Adress of the netherserver is also configured as slave on the QNAP NAS UPS configuration.

Problem:
However it seems to be hardcoded in Nethserver UPS/nut configuration to use the username “UPS” when trying to connect to the QNAP nut server. For QNAP NAS a different nut user would be required.

Broadcast message from nut@homeserver1.home.lan (Wed Jun 12 07:17:59 2019):
UPS UPS@10.0.1.5 is unavailable

According to


the nut username should be “qnapups”.

How can I change in best way the NUT username used in the netherserver nut configuration - also to be future prove for next upgrades?

Many thanks for a hint.

Hi
It’s true that a lot of Linux Devices out there, including Nethserver, use NUT, but have hardcoded users / passwords for it.
NethServer, QNAP, Synology are among the many…
My solution is to use a Raspberry PI for NUT. Cheap, easy to replace / use the config at other places.

I have the Raspberry handle all my NUT requirements, and connect Nethserver, Synology, QNAP, Proxmox to the Raspberry as NUT-Server. The Raspberry reports to Zabbix Monitoring (On the Nethserevr).

Another benefit: Using the Raspberry instead of any NAS on site usually gives me more info about the battery. The built in NUT in many NAS are very simple (Do not use all possible options).

My 2 cents
Andy

1 Like

You shall be able to change the user name from command line. See https://docs.nethserver.org/projects/nethserver-devel/en/v7/nethserver-nut.html#slave-node

I cannot test it, but with the outcome of these commands I might be able to help:

config show nut-server
config show nut-monitor

Another option would be the new cockpit UI in development:

Edit: It should suffice with these commands (to set the user):

config setprop nut-server User qnapups
signal-event nethserver-nut-save
3 Likes

Thanks a lot for the hints:
However actually it does not change really the situation:

Failure message remains like that:

> Broadcast message from nut@homeserver1.home.lan (Wed Jun 12 20:43:11 2019):
> 
> UPS UPS@10.0.1.5 is unavailable
> 

Config now looks the following:

[root@homeserver1 ~]# config show nut-server
nut-server=service
    Device=auto
    Model=
    Password=123456
    TCPPort=3493
    Ups=UPS
    User=qnapups
    access=green
    status=disabled
[root@homeserver1 ~]# config show nut-monitor
nut-monitor=service
    Master=10.0.1.5
    Notify=disabled
    status=enabled

looking at file
/etc/e-smith/templates/etc/ups/upsmon.conf/20access

[root@homeserver1 upsmon.conf]# more 20access
{
    my $ip = '';
    my $mode = '';
    my $pass = ${'nut-server'}{'Password'} || ' ';
    my $status = ${'nut-server'}{'status'} || 'disabled';
    if ($status eq 'enabled') {
        $ip = '127.0.0.1';
        $mode = 'master';
    } else {
        $ip = ${'nut-monitor'}{'Master'} || '';
        $mode = 'slave';
    }

    $OUT.="MONITOR UPS\@$ip 1 upsmon $pass $mode";
}
[root@homeserver1 upsmon.conf]#

It looks the UPS and the upsmon are hard coded in the template resulting in the line
MONITOR UPS@10.0.1.15 1 upsmon 123456 slave
in file /etc/ups/upsmon.conf

This leads to the failure case (as logged in "/var/log/messages" of
Jun 12 21:43:04 homeserver1 upsmon: Poll UPS [UPS@10.0.1.15] failed - [UPS] does not exist on server 10.0.1.15

Comparing it with the upsmon.conf file at my QNAP NAS:
MONITOR qnapups@localhost 1 admin 123456 master

it looks to me somehow the hard-coded template would need to be updated? What do you think?

Make sure you have the latest version of nethserver-nut. It is fixed in the source code:

3 Likes

Thanks a lot. The package update was the missing part:
Finally I did the following configuration for QNAP NAS Master:

config setprop nut-server User admin
config setprop nut-server Ups qnapups
signal-event nethserver-nut-save

Together with setting the right password in the nethservergui resulting in following configuration:

[root@homeserver1 ups]# config show nut-server
nut-server=service
    Device=auto
    Model=
    Password=123456
    TCPPort=3493
    Ups=qnapups
    User=admin
    access=green
    status=disabled
[root@homeserver1 ups]# config show nut-monitor
nut-monitor=service
    Master=10.0.x.xx
    Notify=disabled
    status=enabled

and testing seems working as well:

[root@homeserver1 ups]# upsc qnapups@10.0.x.xx
battery.charge: 100
battery.charge.low: 10
.....

.......
    [root@homeserver1 ups]#

So issue seems to be solved.
Thank you!