{"id":43,"date":"2022-12-20T03:57:40","date_gmt":"2022-12-20T03:57:40","guid":{"rendered":"https:\/\/othman.benomar.fr.to\/blog\/?p=43"},"modified":"2022-12-20T03:57:42","modified_gmt":"2022-12-20T03:57:42","slug":"how-to-setup-an-ups-with-a-synology-nas","status":"publish","type":"post","link":"https:\/\/othmanbenomar.dev\/blog\/2022\/12\/20\/how-to-setup-an-ups-with-a-synology-nas\/","title":{"rendered":"How to setup an UPS with a Synology NAS"},"content":{"rendered":"\n<p>Synology NAS are excellent units to backup large data and can even entirely replace proprietary cloud solutions such as google drive, google photos, etc&#8230; They have indeed their own series of applications that do exactly the same, except that you are in total control of your data: These never leave your home or office and do not risk to be used for any kind of data mining purpose by a third party.<\/p>\n\n\n\n<p>However, to have completely effective backup solution, one also need to consider potential failures of those NAS units. Apart from the usual 3-2-1 backup rule that anyone should have in mind (<a href=\"https:\/\/www.uschamber.com\/co\/run\/technology\/3-2-1-backup-rule#:~:text=Here's%20what%20the%203%2D2,least%20one%20backup%20file%20offsite.\">loo<\/a><a href=\"https:\/\/www.uschamber.com\/co\/run\/technology\/3-2-1-backup-rule#:~:text=Here's%20what%20the%203%2D2,least%20one%20backup%20file%20offsite\">k at this<\/a> if you don&#8217;t know what this is), it is highly preferable to combine your NAS with a backup power supply (ie an UPS) that will let your NAS shutdown safely in case of electricity cut and before any data loss occurs. In addition to that Synology NAS come with a great capability: It can broadcast an emergency shutdown to any device within it&#8217;s network using <a href=\"https:\/\/networkupstools.org\/\">NUT<\/a>. <\/p>\n\n\n\n<p>In this post, I will explain how (1) you can setup your NAS so that it gets connected to a UPS with USB broadcasting capability. And (2) how this same NAS can be used to alert your other linux-based systems (assuming the support of apt, ie in Debian based OS such as <a href=\"https:\/\/ubuntu.com\/\">Ubuntu<\/a>). This tutorial will also assume that you have a DSM 6 or 7, which I know support that functionality and that have a similar setup process regarding (1).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Setup your NAS<\/h2>\n\n\n\n<p>First, go in: Control Panel &#8211;> Hardware &amp; Power &#8211;> UPS<\/p>\n\n\n\n<p>Click: Enable UPS Support<\/p>\n\n\n\n<p>Choose your UPS type. Most low-to-medium end UPS use USB to comunicate.<\/p>\n\n\n\n<p>If you want that NAS to let other devices in your network receive an instruction to shutdown when the power supply is compromised, tick: Enable network UPS Server<\/p>\n\n\n\n<p>You may also add a list of IP for permitted diskstation if you want to limit access by clicking on: Permitted Diskstation Devices<\/p>\n\n\n\n<p>Then choose: Apply<\/p>\n\n\n\n<p>If all went well, you should be able to see the UPS device information by clicking on the button with that same name.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"507\" src=\"https:\/\/othman.benomar.fr.to\/blog\/wp-content\/uploads\/2022\/12\/image-1024x507.png\" alt=\"\" class=\"wp-image-44\" srcset=\"https:\/\/othmanbenomar.dev\/blog\/wp-content\/uploads\/2022\/12\/image-1024x507.png 1024w, https:\/\/othmanbenomar.dev\/blog\/wp-content\/uploads\/2022\/12\/image-300x148.png 300w, https:\/\/othmanbenomar.dev\/blog\/wp-content\/uploads\/2022\/12\/image-768x380.png 768w, https:\/\/othmanbenomar.dev\/blog\/wp-content\/uploads\/2022\/12\/image-1536x760.png 1536w, https:\/\/othmanbenomar.dev\/blog\/wp-content\/uploads\/2022\/12\/image-2048x1013.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Fig.1 Main screen for the setup of an UPS server on a Synology DSM 7.2<\/figcaption><\/figure>\n\n\n\n<p>Now, the Synology NAS should be able to get notification of loss of power from the UPS and should be able to broadcast it to other devices within your network.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Setting up NUT in you Debian-based Linux systems<\/h2>\n\n\n\n<p>If you want you computers to receive and interpret the instructions from the Synology UPS server, you need to follow these steps on each of your Linux machines:<\/p>\n\n\n\n<p>First update and install NUT:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install nut<\/code><\/pre>\n\n\n\n<p>Then, edit the <strong>nut<\/strong> configuration file. For example using nano:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/nut\/nut.conf<\/code><\/pre>\n\n\n\n<p>Ensure that instead of MODE=NONE, you have:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MODE=netclient<\/code><\/pre>\n\n\n\n<p>Leave the editor without forgetting to save the file. Then, edit the monitoring configuration file <strong>upsmon.conf <\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/nut\/upsmon.conf<\/code><\/pre>\n\n\n\n<p>At the end of the file, add the following line,<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MONITOR ups@&#91;Your NAS IP] 1 monuser secret slave<\/code><\/pre>\n\n\n\n<p>Here, replace [Your NAS IP] by the IP of your NAS (e.g. 10.0.1.100)<\/p>\n\n\n\n<p>Finally you need to save the file and restart the NUT client service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart nut-client.service<\/code><\/pre>\n\n\n\n<p>You may verify that the system properly connected to the UPS by looking at the status of the service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl status nut-client.service<\/code><\/pre>\n\n\n\n<p>I would also recommend to perform a live test by disconnecting you UPS and see if everything goes as planned. You should have your UPS making a sound indicating the loss of power and after some time (if you set the Synology behaviour as in Fig.1, after 30 seconds), the NAS will also beep, send the alert to your set computers and those should all turn off by themselves. Once the power is back, you should then have a restart of all of your systems: The NAS and the computers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Synology NAS are excellent units to backup large data and can even entirely replace proprietary cloud solutions such as google drive, google photos, etc&#8230; They have indeed their own series of applications that do exactly the same, except that you are in total control of your data: These never leave your home or office and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-43","post","type-post","status-publish","format-standard","hentry","category-synology"],"_links":{"self":[{"href":"https:\/\/othmanbenomar.dev\/blog\/wp-json\/wp\/v2\/posts\/43","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/othmanbenomar.dev\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/othmanbenomar.dev\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/othmanbenomar.dev\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/othmanbenomar.dev\/blog\/wp-json\/wp\/v2\/comments?post=43"}],"version-history":[{"count":1,"href":"https:\/\/othmanbenomar.dev\/blog\/wp-json\/wp\/v2\/posts\/43\/revisions"}],"predecessor-version":[{"id":45,"href":"https:\/\/othmanbenomar.dev\/blog\/wp-json\/wp\/v2\/posts\/43\/revisions\/45"}],"wp:attachment":[{"href":"https:\/\/othmanbenomar.dev\/blog\/wp-json\/wp\/v2\/media?parent=43"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/othmanbenomar.dev\/blog\/wp-json\/wp\/v2\/categories?post=43"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/othmanbenomar.dev\/blog\/wp-json\/wp\/v2\/tags?post=43"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}