Synology UPS Slave on QNAP Master

Printers, HDDs, USB/eSATA drives, 3rd-party programs
Post Reply
RcTomcat
Starting out
Posts: 34
Joined: Tue Feb 22, 2011 3:19 am

Synology UPS Slave on QNAP Master

Post by RcTomcat » Wed Nov 23, 2022 2:30 am

Hi,

I am running a USB UPS on one of my QNAP NAS.
That NAS is the UPS Master, all other NAS in the Building should query it.
Problem: There is a synology NAS in the house....

I tried solving it via the edits found in this threat viewtopic.php?t=69328 and I am able to query the QNAP NAS via the SSH session from my synology.
The upsmon.conf on the synology looks like this:
MONITOR qnapups@myqnapuip monuser secret slave

But how do I check if it is truly communicating with the master?
Is there any way to verify everything without unplugging the grid?
The GUI always states: Can't connect to the network UPS Server

User avatar
dolbyman
Guru
Posts: 29470
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: Synology UPS Slave on QNAP Master

Post by dolbyman » Wed Nov 23, 2022 2:39 am

I am pretty sure the default UPS master password is 123456

viewtopic.php?t=159585#p780272

RcTomcat
Starting out
Posts: 34
Joined: Tue Feb 22, 2011 3:19 am

Re: Synology UPS Slave on QNAP Master

Post by RcTomcat » Thu Nov 24, 2022 1:34 am

You are absolutely right.
I changed it accordingly with reference to the other QNAP NAS that are working and connected.
Still, can't seem to verify a connection. GUI still shows disconnected.
The host is in the upsd.conf as an exception (all my NAS got ACLs listed there)
Any other hints?

User avatar
dolbyman
Guru
Posts: 29470
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: Synology UPS Slave on QNAP Master

Post by dolbyman » Thu Nov 24, 2022 1:37 am

Sorry I have never used a Synology NAS, I have connected WinNUT as slave to a QNAP NAS before and it worked just fine.

RcTomcat
Starting out
Posts: 34
Joined: Tue Feb 22, 2011 3:19 am

Re: Synology UPS Slave on QNAP Master

Post by RcTomcat » Thu Nov 24, 2022 7:55 pm

According to Synology their systems only work with other synology NAS.
Well....
So i went ahead and implemented SSH Key Login so I can at least send a shutdown command from my QNAP to the synology.
Now all I need is a config file/ the right place to put that command ^^.
I understand that upssched.conf is usually used for such tasks but that file does not exist on the QNAP implementation.
Can you guys help me out in that matter? All I need is to send a ssh -p 22 -i ~/.ssh/synology root@synip " sudo poweroff" in case the power gets too low and the Master decides that it is time to shut down.

User avatar
OneCD
Guru
Posts: 10594
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Synology UPS Slave on QNAP Master

Post by OneCD » Fri Nov 25, 2022 4:37 am

RcTomcat wrote:
Thu Nov 24, 2022 7:55 pm
I understand that upssched.conf is usually used for such tasks but that file does not exist on the QNAP implementation.
Can you guys help me out in that matter? All I need is to send a ssh -p 22 -i ~/.ssh/synology root@synip " sudo poweroff" in case the power gets too low and the Master decides that it is time to shut down.
Maybe use /etc/init.d/shutdown_check.sh for this? It's run during QTS shutdown.

Insert your command after the existing line of code that reads:

Code: Select all

#backup logs
Note: when you update the NAS firmware, this change will be lost, so you'll need to reapply it. Here are a few lines from sortmyqpkgs.sh to do this very thing:

Code: Select all

readonly SHUTDOWN_PATHFILE=/etc/init.d/shutdown_check.sh

if ! /bin/grep -q 'sortmyqpkgs.sh' $SHUTDOWN_PATHFILE; then
    findtext='#backup logs'
    inserttext='/etc/init.d/sortmyqpkgs.sh autofix'
    /bin/sed -i "s|$findtext|$inserttext\n$findtext|" $SHUTDOWN_PATHFILE
fi
Change the match and insert strings to suit your command. Something like this should do:

Code: Select all

readonly SHUTDOWN_PATHFILE=/etc/init.d/shutdown_check.sh

if ! /bin/grep -q 'synology' $SHUTDOWN_PATHFILE; then
    findtext='#backup logs'
    inserttext='ssh -p 22 -i ~/.ssh/synology root@synip "sudo poweroff"'
    /bin/sed -i "s|$findtext|$inserttext\n$findtext|" $SHUTDOWN_PATHFILE
fi
Also, the default port for SSH is 22, so there should be no-need to specify it. And, if you're SSH'ing in to the Syno as 'root', there's no reason to use 'sudo'. ;)

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage

FSC830
Experience counts
Posts: 1358
Joined: Thu Mar 03, 2016 1:11 am

Re: Synology UPS Slave on QNAP Master

Post by FSC830 » Fri Nov 25, 2022 5:47 am

In this Thread I posted a script you can insert commands for startup and shutdown.
This script survives an update (did several updates since installing :wink: ).

Regards

Post Reply

Return to “Hardware & Software Compatibility”