{"id":2640,"date":"2011-10-09T23:13:09","date_gmt":"2011-10-09T14:13:09","guid":{"rendered":"http:\/\/yasu2.prosou.nu\/blog\/index.php\/2011\/10\/09\/netgear_readynas_freebsd_mac_o\/"},"modified":"2011-10-09T23:13:09","modified_gmt":"2011-10-09T14:13:09","slug":"netgear_readynas_freebsd_mac_o","status":"publish","type":"post","link":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/2011\/10\/09\/2640\/","title":{"rendered":"Netgear ReadyNAS + FreeBSD + Mac on an APC UPS"},"content":{"rendered":"<p>(\u65e5\u672c\u8a9e\u7248\u306f\u307e\u305f\u5f8c\u65e5)<br \/>\nThere were ReadyNAS, FreeBSD box, and OS X server (Mac mini) all working in my lab. Today, I&#8217;ve installed an APC&#8217;s UPS, because we have a planned power outage tomorrow.<br \/>\nSince the UPS has enough output capacity for all of NAS + FreeBSD box + Mac, my first plan was:<br \/>\n1) connect UPS to OS X server<br \/>\n2) install apcupsd on FreeBSD<br \/>\n3) NAS + FreeBSD shares the UPS via SNMP<br \/>\nbut the plan was soon collapsed because OS X server has no easy way to share its UPS status via SNMP.<br \/>\nThe second plan was:<br \/>\n1) connect UPS to OS X server, with apcupsd installed<br \/>\n2) install apcupsd<br \/>\n3) NAS + FreeBSD shares the UPS via SNMP or apcupsd&#8217;s NIS feature<br \/>\n* acpupsd NIS is not the Sun&#8217;s one, but just it&#8217;s special protocol over TCP.<br \/>\nhowever, again the plan didn&#8217;t work. The UPS could be shared between the Mac and FreeBSD box pretty well by apcupsd&#8217;s NIS feature, but the NAS couldn&#8217;t communicate with the acpupsd NIS server on Mac. One more thing I got know was that apcupsd can&#8217;t share its UPS status via SNMP. apcupsd can only &#8220;refer&#8221; UPS via SNMP, but it can&#8217;t provide its status to SNMP servers.<br \/>\nSituation got too bad at this point. There&#8217;s no substitute plan, so I can&#8217;t go home\u2026 But suddenly I&#8217;ve found that ReadyNAS has its tcp\/3493 port open, and this port is for nut (network UPS tools). So the final plan was this:<br \/>\n1) connect UPS to ReadyNAS<br \/>\n2) install nut on FreeBSD and Mac (both in ports collection and MacPorts)<br \/>\n3) share the UPS with nut protocol<br \/>\n\u2026 and I was at the gate of the hell, at this point. apcupsd doesn&#8217;t require any kind of authentication info, but nut requires UPS name to connect with a remote UPS. Netgear&#8217;s document doesn&#8217;t say anything about nut auth.<br \/>\nAfter an hour, I finally found the UPS name &#8220;UPS&#8221; on ReadyNAS. And this is everything I&#8217;ve wrote in upsmon.conf.<br \/>\nMONITOR UPS@192.168.x.x 1 upsmon pass master<br \/>\nOn Mac, I had to write \/Library\/LaunchDaemons\/org.nut.upsmon.plist:<br \/>\n&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br \/>\n&lt;!DOCTYPE plist PUBLIC &#8220;-\/\/Apple\/\/DTD PLIST 1.0\/\/EN&#8221; &#8220;http:\/\/www.apple.com\/DTDs\/PropertyList-1.0.dtd&#8221;&gt;<br \/>\n&lt;plist version=&#8221;1.0&#8243;&gt;<br \/>\n&lt;dict&gt;<br \/>\n&lt;key&gt;Label&lt;\/key&gt;<br \/>\n&lt;string&gt;org.nut.upsmon&lt;\/string&gt;<br \/>\n&lt;key&gt;RunAtLoad&lt;\/key&gt;<br \/>\n&lt;false\/&gt;<br \/>\n&lt;key&gt;KeepAlive&lt;\/key&gt;<br \/>\n&lt;dict&gt;<br \/>\n&lt;key&gt;NetworkState&lt;\/key&gt;<br \/>\n&lt;true\/&gt;<br \/>\n&lt;\/dict&gt;<br \/>\n&lt;key&gt;ProgramArguments&lt;\/key&gt;<br \/>\n&lt;array&gt;<br \/>\n&lt;string&gt;\/opt\/local\/sbin\/upsmon&lt;\/string&gt;<br \/>\n&lt;string&gt;-D&lt;\/string&gt;<br \/>\n&lt;\/array&gt;<br \/>\n&lt;\/dict&gt;<br \/>\n&lt;\/plist&gt;<br \/>\nthen:<br \/>\nsudo launchctl load -w \/Library\/LaunchDaemons\/org.nut.upsmon.plist<br \/>\nNAS, FreeBSD and Mac goes down at the battery remaining capacity that is configured in ReadyNAS&#8217;s web interface.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>(\u65e5\u672c\u8a9e\u7248\u306f\u307e\u305f\u5f8c\u65e5) There were ReadyNAS, FreeBSD box, and OS X server (Mac mini) all working in my lab. Today, I&#038;#8217 &hellip; <a href=\"https:\/\/yasu2.prosou.nu\/blog\/index.php\/2011\/10\/09\/2640\/\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Netgear ReadyNAS + FreeBSD + Mac on an APC UPS&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[9,6],"tags":[],"class_list":["post-2640","post","type-post","status-publish","format-standard","hentry","category-mac","category-unix-"],"_links":{"self":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/2640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=2640"}],"version-history":[{"count":0,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/2640\/revisions"}],"wp:attachment":[{"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=2640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=2640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yasu2.prosou.nu\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=2640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}