{"id":335,"date":"2021-04-28T22:42:26","date_gmt":"2021-04-28T14:42:26","guid":{"rendered":"http:\/\/0004.xyz\/?p=335"},"modified":"2021-07-24T13:03:25","modified_gmt":"2021-07-24T05:03:25","slug":"%e6%a0%91%e8%8e%93%e6%b4%be%e5%ae%89%e8%a3%85ups%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"http:\/\/0004.xyz\/?p=335","title":{"rendered":"\u6811\u8393\u6d3e\u5b89\u88c5UPS\u670d\u52a1\u5668"},"content":{"rendered":"<p>UPS\u4e3b\u8981\u529f\u80fd\u5c31\u662f\u4fdd\u62a4\u786c\u76d8\u6570\u636e\uff0c\u8981\u77e5\u9053\u786c\u76d8\u6709\u4ef7\u6570\u636e\u65e0\u4ef7\uff0c\u79d1\u5b66\u5bb6\u66fe\u505a\u8fc7\u5b9e\u9a8c\uff0c\u786c\u76d8\u518d\u4f7f\u7528\u534a\u5e74\u540e\uff0c\u5176\u6570\u636e\u4ef7\u503c\u65e2\u5df2\u8d85\u8fc7\u786c\u76d8\u4ef7\u503c\u3002\u56e0\u6b64\u914d\u5907\u4e00\u53f0UPS\u5f88\u6709\u5fc5\u8981\u3002UPS\u4e3b\u8981\u5206\u4e3a2\u79cd\uff0c\u4e00\u79cd\u4e3a\u540e\u80cc\u5f0f\uff08\u6c11\u7528\u5ec9\u4ef7\u7248\uff09\uff0c\u4e00\u79cd\u4e3a\u5728\u7ebf\u5f0f\uff08\u571f\u8c6a\u91d1\u7248\uff09\u3002\u539f\u7406\u5c31\u4e0d\u518d\u79d1\u666e\u4e86\uff0c\u5f53\u7136\u4e0d\u7ba1\u90a3\u79cd\uff0c\u8d8a\u8d35\u8d8a\u597d\u3002\u9009\u62e9\u8d77\u6765\u4e5f\u4e3b\u8981\u770b\u529f\u7387\uff0c\u5c0f\u4e86\u8fc7\u8f7d\u4e0d\u5de5\u4f5c\uff0c\u5927\u4e86\u6362\u7535\u6c60\u7ef4\u62a4\u6210\u672c\u9ad8\u3002<br \/>\n\u50cf\u6211\u8fd9\u79cd\u5927\u56fdP\u6c11\u4e5f\u53ea\u80fd\u62e5\u6709\u5ec9\u4ef7\u7248\uff0c\u81f3\u5c11\u90fd\u80fd\u6ee1\u8db3\u9700\u8981\uff0c\u6211\u8fd9\u8fb9\u7528\u7684\u662fAPC BK650\uff0c\u4e00\u53f0\u5ec9\u4ef7\u7248\u540e\u80ccUPS\uff0c\u53ea\u6709\u4e00\u4e2aRJ45\u8f6cUSB\u7684\u6570\u636e\u7ebf\uff0c\u5b9e\u9645\u5c31\u662f\u53ea\u6709USB\u529f\u80fd\u3002\u6211\u662f\u5b89\u88c5\u5728esxi6.5\u7cfb\u7edf\u4e0a\uff0c\u5177\u4f53\u53ef\u4ee5\u770b\u6211\u4e0a\u4e00\u7bc7\u6587\u7ae0<a href=\"http:\/\/www.aionshop.com\/2021\/04\/23\/esxi-6-5-%e4%bd%bf%e7%94%a8nut-client%e8%bf%9e%e6%8e%a5%e7%be%a4%e6%99%96ups%e6%9c%8d%e5%8a%a1%e5%99%a8\/\" title=\"ESXi 6.5 \u4f7f\u7528NUT Client\u8fde\u63a5\u7fa4\u6656UPS\u670d\u52a1\u5668\">ESXi 6.5 \u4f7f\u7528NUT Client\u8fde\u63a5\u7fa4\u6656UPS\u670d\u52a1\u5668<\/a><br \/>\n\u4f46\u662f\u5462\u53ea\u80fd\u5b89\u88c5\u4e00\u4e2a\u9ed1\u7fa4\u6656\u6765\u505aUPS\u670d\u52a1\u5668\uff08\u8fd8\u9700\u8981\u4e00\u53f0ikuai\u505a\u865a\u62df\u8def\u7531\u5668\u6765\u5b9e\u73b0\u9ed1\u88d9\u5230EXSI6.5\u7684\u76d1\u6d4b-\u5176\u5b9e\u4e0d\u7528ikuai\u4e5f\u884c\uff0c\u7528ikuai\u53ef\u4ee5\u4fdd\u62a4esxi\u4e2d\u7684\u5176\u4ed6\u865a\u62df\u673a\uff09\uff0c\u5982\u679c\u4f60\u6709\u53e6\u5916\u4e00\u53f0\u767d\u7fa4\u6656\uff0c\u5b8c\u5168\u53ef\u4ee5\u6309\u7167\u6587\u7ae0\u6765\u8bbe\u7f6e\u3002\u4e0b\u9762\u8bb2\u8bb2\u6811\u8393\u6d3e\u5b89\u88c5UPS\u670d\u52a1\u5668\uff0c\u8fd9\u6837<a href=\"http:\/\/0004.xyz\/tag\/esxi\/\">ESXI<\/a>\u5c31\u53ef\u4ee5\u76f4\u63a5\u8bbf\u95ee\u6811\u8393\u6d3e\u4e2d\u7684UPS\u670d\u52a1\u5668\u4e86\uff0c\u8fd8\u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e2a\u663e\u793a\u5c4f\u7528\u4e8e\u663e\u793aUPS\u72b6\u6001\u3002<\/p>\n<p>\u5b9e\u9645\u6211\u4eec\u8fd8\u662f\u7528\u7684<a href=\"http:\/\/www.networkupstools.org\/\" title=\"Network UPS Tools\">Network UPS Tools<\/a>\uff0c\u53ea\u662f\u628a\u5b89\u88c5\u5230\u9ed1\u7fa4\u6656\u7684\u529f\u80fd\u5b89\u88c5\u5230\u6811\u8393\u6d3e\u4e0a\u3002\u4e0b\u9762\u662f\u5b89\u88c5\u65b9\u6cd5\uff1a<\/p>\n<h1>\u51c6\u5907\u5de5\u4f5c<\/h1>\n<ul>\n<li>Raspberry Pi Model B \/ B+ \/ 2B\uff0c\u5176\u4e2d\uff08Model A \/ A+ \u987b\u52a0\u4e0aUSB\u6709\u7ebf\/\u65e0\u7ebf\u7f51\u5361\uff09<\/li>\n<li>Raspbian \u7cfb\u7edf\u3002<\/li>\n<li>UPS\u76d1\u63a7\u7aef\u53e3\u6700\u597d\u662fUSB\u6216RJ-45\uff0c\u8fd9\u6b21\u662f\u7528APC Bk650\u3002<\/li>\n<li>\u5982\u679c\u662fSerial Port\uff08RS-232\uff09\u4e5f\u4e0d\u662f\u4e0d\u53ef\u4ee5\uff0c\u53ea\u8981\u5229\u7528\u652f\u6301Linux\u7684USB \u8f6c RS-232\u8f6c\u63a5\u7ebf\u5373\u53ef\u3002<\/li>\n<\/ul>\n<h1>UPS\u670d\u52a1\u7aef\u5b89\u88c5\u4e0e\u8bbe\u5b9a<\/h1>\n<h2>1\u3001\u5b89\u88c5Network UPS Tools\u5957\u4ef6<\/h2>\n<p>\u53ef\u4ee5\u4ece\u8fd9\u91cc<a href=\"https:\/\/networkupstools.org\/stable-hcl.html\" title=\"\u67e5\u8be2\u652f\u6301\u7684UPS\">\u67e5\u8be2\u652f\u6301\u7684UPS<\/a>\u6211\u4eec\u4e3b\u8981\u4f7f\u7528\u4e0b\u9762\u7684\u53c2\u6570\u5c31\u884c\u3002<\/p>\n<ul>\n<li>Manufacturer &#8211; \u54c1\u724c\uff08\u8fd9\u91cc\u6839\u636e\u6211\u7684\u9009\u62e9APC\uff09<\/li>\n<li>Model -\u578b\u53f7\uff08\u8fd9\u91cc\u6839\u636e\u6211\u7684\u9009\u62e9Back-UPS USB\uff09<\/li>\n<li>Connection &#8211; \u8fde\u7ebf\u65b9\u5f0f\uff0cSerial\u3001USB\u3001Network\u3002<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"http:\/\/0004.xyz\/wp-content\/uploads\/2021\/04\/3-300x181.png\" alt=\"\" \/><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/0004.xyz\/wp-content\/uploads\/2021\/04\/4-300x181.png\" alt=\"\" \/><\/p>\n<p>\u8fd9\u6837\u6211\u4eec\u5c31\u80fd\u627e\u5230\u6211\u4eec\u7684\u7aef\u53e3<a href=\"https:\/\/networkupstools.org\/docs\/man\/usbhid-ups.html\" title=\"\u8bbe\u7f6e\u53c2\u6570\">\u8bbe\u7f6e\u53c2\u6570<\/a>\u4e86\u3002<br \/>\n<img decoding=\"async\" src=\"http:\/\/0004.xyz\/wp-content\/uploads\/2021\/04\/5-300x181.png\" alt=\"\" \/><\/p>\n<p>\u5b89\u88c5UPS\u670d\u52a1\u8f6f\u4ef6<\/p>\n<pre><code class=\"language-shell\">sudo apt-get -y install nut<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/0004.xyz\/wp-content\/uploads\/2021\/04\/2.png\" alt=\"\" \/><\/p>\n<h2>2\u3001\u7f16\u8f91UPS\u914d\u7f6e\u6587\u4ef6<\/h2>\n<pre><code class=\"language-shell\">sudo vi \/etc\/nut\/ups.conf<\/code><\/pre>\n<p>\u5c06\u521a\u521a\u67e5\u8be2\u5230\u7684\u9a71\u52a8\u53c2\u6570\u8bbe\u5b9a\u503c\uff0c\u5199\u5165\u914d\u7f6e\u6587\u4ef6\u91cc\uff0c\u4e2d\u62ec\u5f27[apc]\u662f\u81ea\u8ba2\u7684UPS\u540d\u79f0\uff0c\u63a5\u4e0b\u6765\u7684\u6b65\u9aa4\u4f1a\u7528\u5230\uff0cdesc=&quot;xxx&quot;\u53ea\u662f\u6ce8\u89e3\u53ef\u7701\u7565\u3002\u4e0b\u9762\u662f\u6211\u7684\u914d\u7f6e\u6587\u4ef6<\/p>\n<pre><code class=\"language-shell\"># Network UPS Tools: example ups.conf\n#\n# --- SECURITY NOTE ---\n#\n# If you use snmp-ups and set a community string in here, you \n# will have to secure this file to keep other users from obtaining\n# that string.  It needs to be readable by upsdrvctl and any drivers,\n# and by upsd.\n#\n# ---\n#\n# This is where you configure all the UPSes that this system will be\n# monitoring directly.  These are usually attached to serial ports, but\n# USB devices and SNMP devices are also supported.\n#\n# This file is used by upsdrvctl to start and stop your driver(s), and\n# is also used by upsd to determine which drivers to monitor.  The \n# drivers themselves also read this file for configuration directives.\n#\n# The general form is:\n# \n# [upsname]\n#       driver = &lt;drivername&gt;\n#         port = &lt;portname&gt;\n#   &lt; any other directives here &gt;\n#\n# The section header ([upsname]) can be just about anything as long as\n# it is a single word inside brackets.  upsd uses this to uniquely \n# identify a UPS on this system.\n#\n# If you have a UPS called snoopy, your section header would be &quot;[snoopy]&quot;.\n# On a system called &quot;doghouse&quot;, the line in your upsmon.conf to monitor\n# it would look something like this:\n#\n#   MONITOR snoopy@doghouse 1 upsmonuser mypassword master\n#\n# It might look like this if monitoring in slave mode:\n#\n#   MONITOR snoopy@doghouse 1 upsmonuser mypassword slave\n#\n# Configuration directives\n# ------------------------\n#\n# These directives are used by upsdrvctl only and should be specified outside\n# of a driver definition:\n#\n#    maxretry: Optional.  Specify the number of attempts to start the driver(s),\n#              in case of failure, before giving up. A delay of &#039;retrydelay&#039; is\n#              inserted between each attempt. Caution should be taken when using\n#              this option, since it can impact the time taken by your system to\n#              start.\n#\n#              The default is 1 attempt.\n#\n#  retrydelay: Optional.  Specify the delay between each restart attempt of the\n#              driver(s), as specified by &#039;maxretry&#039;. Caution should be taken\n#              when using this option, since it can impact the time taken by your\n#              system to start.\n#\n#              The default is 5 seconds.\n# \n# These directives are common to all drivers that support ups.conf:\n#\n#  driver: REQUIRED.  Specify the program to run to talk to this UPS.  \n#          apcsmart, bestups, and sec are some examples.\n#\n#    port: REQUIRED.  The serial port where your UPS is connected.  \n#          \/dev\/ttyS0 is usually the first port on Linux boxes, for example.\n#\n# sdorder: optional.  When you have multiple UPSes on your system, you\n#          usually need to turn them off in a certain order.  upsdrvctl\n#          shuts down all the 0s, then the 1s, 2s, and so on.  To exclude\n#          a UPS from the shutdown sequence, set this to -1.\n#\n#          The default value for this parameter is 0.\n#\n#  nolock: optional, and not recommended for use in this file.\n#\n#          If you put nolock in here, the driver will not lock the\n#          serial port every time it starts.  This may allow other \n#          processes to seize the port if you start more than one by \n#          mistake.\n#\n#          This is only intended to be used on systems where locking\n#          absolutely must be disabled for the software to work.\n#\n# maxstartdelay: optional.  This can be set as a global variable\n#                above your first UPS definition and it can also be\n#                set in a UPS section.  This value controls how long\n#                upsdrvctl will wait for the driver to finish starting.\n#                This keeps your system from getting stuck due to a\n#                broken driver or UPS.\n#\n#                The default is 45 seconds.\n#\n# synchronous: optional.  The driver work by default in asynchronous\n#              mode (i.e *synchronous=no*).  This means that all data\n#              are pushed by the driver on the communication socket to\n#              upsd (Unix socket on Unix, Named pipe on Windows) without\n#              waiting for these data to be actually consumed.  With\n#              some HW, such as ePDUs, that can produce a lot of data,\n#              asynchronous mode may cause some congestion, resulting in\n#              the socket to be full, and the driver to appear as not\n#              connected.  By enabling the &#039;synchronous&#039; flag\n#              (value = &#039;yes&#039;), the driver will wait for data to be\n#              consumed by upsd, prior to publishing more.  This can be\n#              enabled either globally or per driver.\n#\n#              The default is &#039;no&#039; (i.e. asynchronous mode) for backward\n#              compatibility of the driver behavior.\n#\n# Anything else is passed through to the hardware-specific part of\n# the driver.\n# \n# Examples\n# --------\n#\n# A simple example for a UPS called &quot;powerpal&quot; that uses the blazer_ser\n# driver on \/dev\/ttyS0 is:\n#\n# [powerpal]\n#   driver = blazer_ser\n#   port = \/dev\/ttyS0\n#   desc = &quot;Web server&quot;\n#\n# If your UPS driver requires additional settings, you can specify them\n# here.  For example, if it supports a setting of &quot;1234&quot; for the\n# variable &quot;cable&quot;, it would look like this:\n# \n# [myups]\n#   driver = mydriver\n#   port = \/dev\/ttyS1\n#   cable = 1234\n#   desc = &quot;Something descriptive&quot;\n#\n# To find out if your driver supports any extra settings, start it with\n# the -h option and\/or read the driver&#039;s documentation.\n[apc]\n       driver = usbhid-ups\n       port = auto\n       desc = &quot;APC BK650 UPS&quot;\n# Set maxretry to 3 by default, this should mitigate race with slow devices:\n#maxretry = 3\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/0004.xyz\/wp-content\/uploads\/2021\/04\/6-300x238.png\" alt=\"\" \/><br \/>\n\u770b\u5230\u4e86\u5427\uff0c\u6709\u7528\u7684\u53ea\u6709\u540e\u9762\u90a3\u51e0\u884c<\/p>\n<pre><code class=\"language-shell\">[apc]\n       driver = usbhid-ups\n       port = auto\n       desc = &quot;APC BK650 UPS&quot;<\/code><\/pre>\n<h2>3\u3001\u542f\u52a8UPS\u670d\u52a1<\/h2>\n<pre><code class=\"language-shell\">sudo upsdrvctl start<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/0004.xyz\/wp-content\/uploads\/2021\/04\/7-300x38.png\" alt=\"\" \/><\/p>\n<p>4\u3001\u7f16\u8f91\u8fd0\u884c\u6a21\u5f0f\u914d\u7f6e<\/p>\n<pre><code class=\"language-shell\">sudo vi \/etc\/nut\/nut.conf<\/code><\/pre>\n<p>\u5c06\u300cMODE=none\u300d\u6539\u6210\u300cMODE=netserver\u300d<br \/>\n\u4e0b\u9762\u662f\u6211\u7684\u914d\u7f6e\uff08\u6700\u540e\u4e00\u884c\uff09<\/p>\n<pre><code class=\"language-shell\"># Network UPS Tools: example nut.conf\n#\n##############################################################################\n# General section\n##############################################################################\n# The MODE determines which part of the NUT is to be started, and which\n# configuration files must be modified.\n#\n# This file try to standardize the various files being found in the field, like\n# \/etc\/default\/nut on Debian based systems, \/etc\/sysconfig\/ups on RedHat based\n# systems, ... Distribution&#039;s init script should source this file to see which\n# component(s) has to be started.\n#\n# The values of MODE can be:\n# - none: NUT is not configured, or use the Integrated Power Management, or use\n#   some external system to startup NUT components. So nothing is to be started.\n# - standalone: This mode address a local only configuration, with 1 UPS \n#   protecting the local system. This implies to start the 3 NUT layers (driver,\n#   upsd and upsmon) and the matching configuration files. This mode can also\n#   address UPS redundancy.\n# - netserver: same as for the standalone configuration, but also need\n#   some more network access controls (firewall, tcp-wrappers) and possibly a\n#   specific LISTEN directive in upsd.conf.\n#   Since this MODE is opened to the network, a special care should be applied\n#   to security concerns.\n# - netclient: this mode only requires upsmon.\n#\n# IMPORTANT NOTE:\n#  This file is intended to be sourced by shell scripts.\n#  You MUST NOT use spaces around the equal sign!\n\n#MODE=none\nMODE=netserver<\/code><\/pre>\n<h2>5\u3001\u6dfb\u52a0\u5141\u8bb8\u63a5\u5165\u7684\u7f51\u7edc<\/h2>\n<p>\u67e5\u8be2\u672c\u673a\u6240\u6709\u7684IP\u4f4d\u5740\uff0c\u8fd9\u91cc\u53ea\u52a0\u5165IPv4\u7684\u4f4d\u5740\u3002<\/p>\n<pre><code class=\"language-shell\">ifconfig | grep inet[^6]<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/0004.xyz\/wp-content\/uploads\/2021\/04\/8-300x31.png\" alt=\"\" \/><\/p>\n<h3>5.1\u7f16\u8f91UPS Daemon\u76d1\u542c\u914d\u7f6e\u6587\u4ef6<\/h3>\n<pre><code class=\"language-shell\">sudo vi \/etc\/nut\/upsd.conf<\/code><\/pre>\n<pre><code class=\"language-shell\">\u627e\u5230\u300c# LISTEN &lt;address&gt; [&lt;port&gt;]\u300d\uff0c\u5728\u4e0b\u4e00\u884c\u52a0\u5165\u4f60\u7684\u6240\u6709IP\u4f4d\u5740\uff0c\u8fde\u63a5\u7aef\u53e33493\u4e0d\u7528\u6539\u3002\n\u4e0b\u9762\u8fd9\u4e9b\u90fd\u8981\u6539\u6210\u4f60\u7684\u6811\u8393\u6d3e\u5c40\u57df\u7f51\u7aef\u53e3\uff0c127.0.0.1\u4e0d\u8981\u52a8\u3002\nLISTEN 127.0.0.1 3493\nLISTEN 192.16.31.2 3493\nLISTEN 192.168.1.15 3493<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/0004.xyz\/wp-content\/uploads\/2021\/04\/9-1024x813.png\" alt=\"\" \/><\/p>\n<p>\u6211\u7684\u914d\u7f6e\u6587\u4ef6<\/p>\n<pre><code class=\"language-shell\"># Network UPS Tools: example upsd configuration file\n#\n# This file contains access control data, you should keep it secure.\n#\n# It should only be readable by the user that upsd becomes.  See the FAQ.\n#\n# Each entry below provides usage and default value.\n\n# =======================================================================\n# MAXAGE &lt;seconds&gt;\n# MAXAGE 15\n#\n# This defaults to 15 seconds.  After a UPS driver has stopped updating\n# the data for this many seconds, upsd marks it stale and stops making\n# that information available to clients.  After all, the only thing worse\n# than no data is bad data.\n#\n# You should only use this if your driver has difficulties keeping\n# the data fresh within the normal 15 second interval.  Watch the syslog\n# for notifications from upsd about staleness.\n\n# =======================================================================\n# STATEPATH &lt;path&gt;\n# STATEPATH \/var\/run\/nut\n#\n# Tell upsd to look for the driver state sockets in &#039;path&#039; rather\n# than the default that was compiled into the program.\n\n# =======================================================================\n# LISTEN &lt;address&gt; [&lt;port&gt;]\n# LISTEN 127.0.0.1 3493\n# LISTEN ::1 3493\nLISTEN 127.0.0.1 3493\nLISTEN 192.168.31.2 3493\n#\n# This defaults to the localhost listening addresses and port 3493.\n# In case of IP v4 or v6 disabled kernel, only the available one will be used.\n#\n# You may specify each interface you want upsd to listen on for connections,\n# optionally with a port number.\n#\n# You may need this if you have multiple interfaces on your machine and\n# you don&#039;t want upsd to listen to all interfaces (for instance on a\n# firewall, you may not want to listen to the external interface).\n#\n# This will only be read at startup of upsd.  If you make changes here,\n# you&#039;ll need to restart upsd, reload will have no effect.\n\n# =======================================================================\n# MAXCONN &lt;connections&gt;\n# MAXCONN 1024\n#\n# This defaults to maximum number allowed on your system.  Each UPS, each\n# LISTEN address and each client count as one connection.  If the server\n# runs out of connections, it will no longer accept new incoming client\n# connections.  Only set this if you know exactly what you&#039;re doing.\n\n# =======================================================================\n# CERTFILE &lt;certificate file&gt;\n# CERTFILE \/usr\/local\/ups\/etc\/upsd.pem\n#\n# When compiled with SSL support with OpenSSL backend,\n# you can enter the certificate file here.\n# The certificates must be in PEM format and must be sorted starting with\n# the subject&#039;s certificate (server certificate), followed by intermediate\n# CA certificates (if applicable_ and the highest level (root) CA. It should\n# end with the server key. See &#039;docs\/security.txt&#039; or the Security chapter of\n# NUT user manual for more information on the SSL support in NUT.\n#\n# See &#039;docs\/security.txt&#039; or the Security chapter of NUT user manual\n# for more information on the SSL support in NUT.\n\n# =======================================================================\n# CERTPATH &lt;certificate file or directory&gt;\n# CERTPATH \/usr\/local\/ups\/etc\/cert\/upsd\n#\n# When compiled with SSL support with NSS backend,\n# you can enter the certificate path here.\n# Certificates are stored in a dedicated database (splitted in 3 files).\n# Specify the path of the database directory.\n# \n# See &#039;docs\/security.txt&#039; or the Security chapter of NUT user manual\n# for more information on the SSL support in NUT.\n\n# =======================================================================\n# CERTIDENT &lt;certificate name&gt; &lt;database password&gt;\n# CERTIDENT &quot;my nut server&quot; &quot;MyPasSw0rD&quot;\n#\n# When compiled with SSL support with NSS backend,\n# you can specify the certificate name to retrieve from database to\n# authenticate itself and the password\n# required to access certificate related private key.\n# \n# See &#039;docs\/security.txt&#039; or the Security chapter of NUT user manual\n# for more information on the SSL support in NUT.\n\n# =======================================================================\n# CERTREQUEST &lt;certificate request level&gt;\n# CERTREQUEST REQUIRE\n#\n# When compiled with SSL support with NSS backend and client certificate\n# validation (disabled by default, see &#039;docs\/security.txt&#039;),\n# you can specify if upsd requests or requires client&#039;s&#039; certificates.\n# Possible values are :\n#  - 0 to not request to clients to provide any certificate\n#  - 1 to require to all clients a certificate\n#  - 2 to require to all clients a valid certificate\n# \n# See &#039;docs\/security.txt&#039; or the Security chapter of NUT user manual\n# for more information on the SSL support in NUT.<\/code><\/pre>\n<h2>6\u3001\u7f16\u8f91UPS\u7528\u6237\u914d\u7f6e<\/h2>\n<pre><code class=\"language-shell\">sudo vi \/etc\/nut\/upsd.users<\/code><\/pre>\n<p>\u65b0\u589e\u4e00\u4e2a\u7ba1\u7406\u8005\u5e10\u53f7\uff0c\u300c[admin]\u300d\u662f\u81ea\u8ba2\u7684\u5e10\u53f7\u540d\u79f0\uff0c\u4f60\u53ef\u4ee5\u81ea\u5df1\u8bbe\u7f6e\uff0c\u300cpassword=\u300d\u662f\u5bc6\u7801\u3002<br \/>\n\u518d\u65b0\u589e\u4e00\u4e2aUPS\u4e3b\u63a7\u7aef\u300c[upsmon]\u300d\uff0c\u300cpassword=\u300d\u662f\u81ea\u8ba2\u5bc6\u7801\u3002<\/p>\n<pre><code class=\"language-shell\"># Network UPS Tools: Example upsd.users\n#\n# This file sets the permissions for upsd - the UPS network daemon.\n# Users are defined here, are given passwords, and their privileges are\n# controlled here too.  Since this file will contain passwords, keep it\n# secure, with only enough permissions for upsd to read it.\n\n# --------------------------------------------------------------------------\n\n# Each user gets a section.  To start a section, put the username in\n# brackets on a line by itself.  To set something for that user, specify\n# it under that section heading.  The username is case-sensitive, so\n# admin and AdMiN are two different users.\n#\n# Possible settings:\n#\n# password: The user&#039;s password.  This is case-sensitive.\n#\n# --------------------------------------------------------------------------\n#\n# actions: Let the user do certain things with upsd.  \n# \n# Valid actions are:\n#\n# SET   - change the value of certain variables in the UPS\n# FSD   - set the &quot;forced shutdown&quot; flag in the UPS\n# \n# --------------------------------------------------------------------------\n#\n# instcmds: Let the user initiate specific instant commands.  Use &quot;ALL&quot;\n# to grant all commands automatically.  There are many possible  \n# commands, so use &#039;upscmd -l&#039; to see what your hardware supports.  Here\n# are a few examples:\n#\n# test.panel.start  - Start a front panel test\n# test.battery.start    - Start battery test\n# test.battery.stop - Stop battery test\n# calibrate.start   - Start calibration\n# calibrate.stop    - Stop calibration\n#\n# --------------------------------------------------------------------------\n#\n# Example:\n#\n#   [admin]\n#       password = mypass\n#       actions = SET\n#       instcmds = ALL\n#\n[admin]\n        password = admin\n        actions = SET\n        instcmds = ALL\n[upsmon]\n        password = upsmon-pw\n        upsmon master\n#\n# --- Configuring for a user who can execute tests only\n#\n#   [testuser]\n#       password  = pass\n#       instcmds  = test.battery.start\n#       instcmds  = test.battery.stop\n\n#\n# --- Configuring for upsmon\n#\n# To add a user for your upsmon, use this example:\n#\n#   [upsmon]\n#       password  = pass\n#       upsmon master\n# or\n#       upsmon slave\n#\n# The matching MONITOR line in your upsmon.conf would look like this:\n#\n# MONITOR myups@localhost 1 upsmon pass master  (or slave)<\/code><\/pre>\n<h2>7\u3001\u7f16\u8f91UPS\u76d1\u63a7\u7a0b\u5e8f\u914d\u7f6e<\/h2>\n<p>\u52a0\u5165\u4e0b\u5217\u8bbe\u5b9a\u503c\uff0c\u300capc\u300d\u662fups.conf \u7684UPS \u540d\u79f0\uff0c\u300clocalhost\u300d\u662f\u672c\u673a\u7684IP \u4f4d\u5740\uff0c\u300cupsmon\u300d\u662fupsd.users \u7684\u4e3b\u63a7\u7aef\u540d\u79f0\uff0c\u300cupsmon-pw\u300d\u662f\u4e3b\u63a7\u7aef\u7684\u5bc6\u7801\uff0c\u300cmaster\u300d\u4ee3\u8868\u8fd9\u53f0\u662f\u4e3b\u63a7\u7aef\u3002<br \/>\nMONITOR apc@localhost 1 upsmon upsmon-pw master<\/p>\n<pre><code class=\"language-shell\">sudo vi \/etc\/nut\/upsmon.conf<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/0004.xyz\/wp-content\/uploads\/2021\/04\/10-1024x813.png\" alt=\"\" \/><\/p>\n<pre><code class=\"language-shell\"># Network UPS Tools: example upsmon configuration\n#\n# This file contains passwords, so keep it secure.\n\n# --------------------------------------------------------------------------\n# RUN_AS_USER &lt;userid&gt;\n#\n# By default, upsmon splits into two processes.  One stays as root and\n# waits to run the SHUTDOWNCMD.  The other one switches to another userid\n# and does everything else.\n#\n# The default nonprivileged user is set at compile-time with\n#   &#039;configure --with-user=...&#039;.  \n# \n# You can override it with &#039;-u &lt;user&gt;&#039; when starting upsmon, or just\n# define it here for convenience.\n#\n# Note: if you plan to use the reload feature, this file (upsmon.conf)\n# must be readable by this user!  Since it contains passwords, DO NOT\n# make it world-readable.  Also, do not make it writable by the upsmon\n# user, since it creates an opportunity for an attack by changing the\n# SHUTDOWNCMD to something malicious.\n#\n# For best results, you should create a new normal user like &quot;nutmon&quot;,\n# and make it a member of a &quot;nut&quot; group or similar.  Then specify it\n# here and grant read access to the upsmon.conf for that group.\n#\n# This user should not have write access to upsmon.conf.\n#\n# RUN_AS_USER nut\n\n# --------------------------------------------------------------------------\n# MONITOR &lt;system&gt; &lt;powervalue&gt; &lt;username&gt; &lt;password&gt; (&quot;master&quot;|&quot;slave&quot;)\n#\n# List systems you want to monitor.  Not all of these may supply power\n# to the system running upsmon, but if you want to watch it, it has to\n# be in this section.\n# \n# You must have at least one of these declared.\n#\n# &lt;system&gt; is a UPS identifier in the form &lt;upsname&gt;@&lt;hostname&gt;[:&lt;port&gt;]\n# like ups@localhost, su700@mybox, etc.\n# \n# Examples:\n# \n#  - &quot;su700@mybox&quot; means a UPS called &quot;su700&quot; on a system called &quot;mybox&quot;\n#\n#  - &quot;fenton@bigbox:5678&quot; is a UPS called &quot;fenton&quot; on a system called\n#    &quot;bigbox&quot; which runs upsd on port &quot;5678&quot;.\n#\n# The UPS names like &quot;su700&quot; and &quot;fenton&quot; are set in your ups.conf\n# in [brackets] which identify a section for a particular driver.\n#\n# If the ups.conf on host &quot;doghouse&quot; has a section called &quot;snoopy&quot;, the\n# identifier for it would be &quot;snoopy@doghouse&quot;.\n#\n# &lt;powervalue&gt; is an integer - the number of power supplies that this UPS \n# feeds on this system.  Most computers only have one power supply, so this \n# is normally set to 1.  You need a pretty big or special box to have any \n# other value here.\n#\n# You can also set this to 0 for a system that doesn&#039;t supply any power,\n# but you still want to monitor.  Use this when you want to hear about\n# changes for a given UPS without shutting down when it goes critical,\n# unless &lt;powervalue&gt; is 0.\n#\n# &lt;username&gt; and &lt;password&gt; must match an entry in that system&#039;s\n# upsd.users.  If your username is &quot;monmaster&quot; and your password is \n# &quot;blah&quot;, the upsd.users would look like this:\n#\n#   [monmaster]\n#       password  = blah\n#       upsmon master   (or slave)\n# \n# &quot;master&quot; means this system will shutdown last, allowing the slaves\n# time to shutdown first.\n#\n# &quot;slave&quot; means this system shuts down immediately when power goes critical.\n#\n# Examples: \n#\n# MONITOR myups@bigserver 1 monmaster blah master\n# MONITOR su700@server.example.com 1 upsmon secretpass slave\n# MONITOR myups@localhost 1 upsmon pass master  (or slave)\nMONITOR apc@localhost 1 upsmon upsmon-pw master\n# --------------------------------------------------------------------------\n# MINSUPPLIES &lt;num&gt;\n#\n# Give the number of power supplies that must be receiving power to keep\n# this system running.  Most systems have one power supply, so you would\n# put &quot;1&quot; in this field.\n#\n# Large\/expensive server type systems usually have more, and can run with\n# a few missing.  The HP NetServer LH4 can run with 2 out of 4, for example,\n# so you&#039;d set that to 2.  The idea is to keep the box running as long\n# as possible, right?\n#\n# Obviously you have to put the redundant supplies on different UPS circuits\n# for this to make sense!  See big-servers.txt in the docs subdirectory\n# for more information and ideas on how to use this feature.\n\nMINSUPPLIES 1\n\n# --------------------------------------------------------------------------\n# SHUTDOWNCMD &quot;&lt;command&gt;&quot;\n#\n# upsmon runs this command when the system needs to be brought down.\n#\n# This should work just about everywhere ... if it doesn&#039;t, well, change it.\n\nSHUTDOWNCMD &quot;\/sbin\/shutdown -h +0&quot;\n\n# --------------------------------------------------------------------------\n# NOTIFYCMD &lt;command&gt;\n#\n# upsmon calls this to send messages when things happen\n#\n# This command is called with the full text of the message as one argument.\n# The environment string NOTIFYTYPE will contain the type string of\n# whatever caused this event to happen.\n#\n# Note that this is only called for NOTIFY events that have EXEC set with\n# NOTIFYFLAG.  See NOTIFYFLAG below for more details.\n#\n# Making this some sort of shell script might not be a bad idea.  For more\n# information and ideas, see docs\/scheduling.txt\n#\n# Example:\n# NOTIFYCMD \/bin\/notifyme\n\n# --------------------------------------------------------------------------\n# POLLFREQ &lt;n&gt; \n#\n# Polling frequency for normal activities, measured in seconds.\n#\n# Adjust this to keep upsmon from flooding your network, but don&#039;t make \n# it too high or it may miss certain short-lived power events.\n\nPOLLFREQ 5\n\n# --------------------------------------------------------------------------\n# POLLFREQALERT &lt;n&gt;\n#\n# Polling frequency in seconds while UPS on battery.\n#\n# You can make this number lower than POLLFREQ, which will make updates\n# faster when any UPS is running on battery.  This is a good way to tune \n# network load if you have a lot of these things running.  \n#\n# The default is 5 seconds for both this and POLLFREQ.\n\nPOLLFREQALERT 5\n\n# --------------------------------------------------------------------------\n# HOSTSYNC - How long upsmon will wait before giving up on another upsmon\n#\n# The master upsmon process uses this number when waiting for slaves to\n# disconnect once it has set the forced shutdown (FSD) flag.  If they\n# don&#039;t disconnect after this many seconds, it goes on without them.\n#\n# Similarly, upsmon slave processes wait up to this interval for the \n# master upsmon to set FSD when a UPS they are monitoring goes critical -\n# that is, on battery and low battery.  If the master doesn&#039;t do its job,\n# the slaves will shut down anyway to avoid damage to the file systems.\n#\n# This &quot;wait for FSD&quot; is done to avoid races where the status changes\n# to critical and back between polls by the master.\n\nHOSTSYNC 15\n\n# --------------------------------------------------------------------------\n# DEADTIME - Interval to wait before declaring a stale ups &quot;dead&quot;\n#\n# upsmon requires a UPS to provide status information every few seconds\n# (see POLLFREQ and POLLFREQALERT) to keep things updated.  If the status\n# fetch fails, the UPS is marked stale.  If it stays stale for more than\n# DEADTIME seconds, the UPS is marked dead.\n#\n# A dead UPS that was last known to be on battery is assumed to have gone\n# to a low battery condition.  This may force a shutdown if it is providing\n# a critical amount of power to your system.\n#\n# Note: DEADTIME should be a multiple of POLLFREQ and POLLFREQALERT.\n# Otherwise you&#039;ll have &quot;dead&quot; UPSes simply because upsmon isn&#039;t polling\n# them quickly enough.  Rule of thumb: take the larger of the two\n# POLLFREQ values, and multiply by 3.\n\nDEADTIME 15\n\n# --------------------------------------------------------------------------\n# POWERDOWNFLAG - Flag file for forcing UPS shutdown on the master system\n#\n# upsmon will create a file with this name in master mode when it&#039;s time\n# to shut down the load.  You should check for this file&#039;s existence in\n# your shutdown scripts and run &#039;upsdrvctl shutdown&#039; if it exists.\n#\n# See the config-notes.txt file in the docs subdirectory for more information.\n# Refer to the section:\n# [[UPS_shutdown]] &quot;Configuring automatic shutdowns for low battery events&quot;\n# or refer to the online version.\n\nPOWERDOWNFLAG \/etc\/killpower\n\n# --------------------------------------------------------------------------\n# NOTIFYMSG - change messages sent by upsmon when certain events occur\n#\n# You can change the default messages to something else if you like.\n#\n# NOTIFYMSG &lt;notify type&gt; &quot;message&quot;\n#\n# NOTIFYMSG ONLINE  &quot;UPS %s on line power&quot;\n# NOTIFYMSG ONBATT  &quot;UPS %s on battery&quot;\n# NOTIFYMSG LOWBATT &quot;UPS %s battery is low&quot;\n# NOTIFYMSG FSD     &quot;UPS %s: forced shutdown in progress&quot;\n# NOTIFYMSG COMMOK  &quot;Communications with UPS %s established&quot;\n# NOTIFYMSG COMMBAD &quot;Communications with UPS %s lost&quot;\n# NOTIFYMSG SHUTDOWN    &quot;Auto logout and shutdown proceeding&quot;\n# NOTIFYMSG REPLBATT    &quot;UPS %s battery needs to be replaced&quot;\n# NOTIFYMSG NOCOMM  &quot;UPS %s is unavailable&quot;\n# NOTIFYMSG NOPARENT    &quot;upsmon parent process died - shutdown impossible&quot;\n#\n# Note that %s is replaced with the identifier of the UPS in question.\n#\n# Possible values for &lt;notify type&gt;:\n#\n# ONLINE   : UPS is back online\n# ONBATT   : UPS is on battery\n# LOWBATT  : UPS has a low battery (if also on battery, it&#039;s &quot;critical&quot;)\n# FSD      : UPS is being shutdown by the master (FSD = &quot;Forced Shutdown&quot;)\n# COMMOK   : Communications established with the UPS\n# COMMBAD  : Communications lost to the UPS\n# SHUTDOWN : The system is being shutdown\n# REPLBATT : The UPS battery is bad and needs to be replaced\n# NOCOMM   : A UPS is unavailable (can&#039;t be contacted for monitoring)\n# NOPARENT : The process that shuts down the system has died (shutdown impossible)\n\n# --------------------------------------------------------------------------\n# NOTIFYFLAG - change behavior of upsmon when NOTIFY events occur\n#\n# By default, upsmon sends walls (global messages to all logged in users)\n# and writes to the syslog when things happen.  You can change this.\n#\n# NOTIFYFLAG &lt;notify type&gt; &lt;flag&gt;[+&lt;flag&gt;][+&lt;flag&gt;] ...\n#\n# NOTIFYFLAG ONLINE SYSLOG+WALL\n# NOTIFYFLAG ONBATT SYSLOG+WALL\n# NOTIFYFLAG LOWBATT    SYSLOG+WALL\n# NOTIFYFLAG FSD    SYSLOG+WALL\n# NOTIFYFLAG COMMOK SYSLOG+WALL\n# NOTIFYFLAG COMMBAD    SYSLOG+WALL\n# NOTIFYFLAG SHUTDOWN   SYSLOG+WALL\n# NOTIFYFLAG REPLBATT   SYSLOG+WALL\n# NOTIFYFLAG NOCOMM SYSLOG+WALL\n# NOTIFYFLAG NOPARENT   SYSLOG+WALL\n#\n# Possible values for the flags:\n#\n# SYSLOG - Write the message in the syslog \n# WALL   - Write the message to all users on the system\n# EXEC   - Execute NOTIFYCMD (see above) with the message\n# IGNORE - Don&#039;t do anything\n#\n# If you use IGNORE, don&#039;t use any other flags on the same line.\n\n# --------------------------------------------------------------------------\n# RBWARNTIME - replace battery warning time in seconds\n#\n# upsmon will normally warn you about a battery that needs to be replaced\n# every 43200 seconds, which is 12 hours.  It does this by triggering a\n# NOTIFY_REPLBATT which is then handled by the usual notify structure\n# you&#039;ve defined above.\n# \n# If this number is not to your liking, override it here.\n\nRBWARNTIME 43200\n\n# --------------------------------------------------------------------------\n# NOCOMMWARNTIME - no communications warning time in seconds\n#\n# upsmon will let you know through the usual notify system if it can&#039;t\n# talk to any of the UPS entries that are defined in this file.  It will\n# trigger a NOTIFY_NOCOMM by default every 300 seconds unless you \n# change the interval with this directive.\n\nNOCOMMWARNTIME 300\n\n# --------------------------------------------------------------------------\n# FINALDELAY - last sleep interval before shutting down the system\n#\n# On a master, upsmon will wait this long after sending the NOTIFY_SHUTDOWN\n# before executing your SHUTDOWNCMD.  If you need to do something in between\n# those events, increase this number.  Remember, at this point your UPS is \n# almost depleted, so don&#039;t make this too high.\n#\n# Alternatively, you can set this very low so you don&#039;t wait around when\n# it&#039;s time to shut down.  Some UPSes don&#039;t give much warning for low\n# battery and will require a value of 0 here for a safe shutdown.\n#\n# Note: If FINALDELAY on the slave is greater than HOSTSYNC on the master,\n# the master will give up waiting for the slave to disconnect.\n\nFINALDELAY 5\n\n# --------------------------------------------------------------------------\n# CERTPATH - path to certificates (database directory or directory with CA&#039;s)\n#\n# When compiled with SSL support, you can enter the certificate path here.\n#\n# With NSS:\n# Certificates are stored in a dedicated database (splitted in 3 files).\n# Specify the path of the database directory.\n# \n# CERTPATH \/etc\/nut\/cert\/upsmon\n#\n# With OpenSSL:\n# Directory containing CA certificates in PEM format, used to verify\n# the server certificate presented by the upsd server. The files each\n# contain one CA certificate. The files are looked up by the CA subject\n# name hash value, which must hence be available.\n#\n# CERTPATH \/usr\/ssl\/certs\n# \n# See &#039;docs\/security.txt&#039; or the Security chapter of NUT user manual\n# for more information on the SSL support in NUT.\n\n# --------------------------------------------------------------------------\n# CERTIDENT - self certificate name and database password\n# CERTIDENT &lt;certificate name&gt; &lt;database password&gt;\n#\n# When compiled with SSL support with NSS, you can specify the certificate\n# name to retrieve from database to authenticate itself and the password\n# required to access certificate related private key.\n#\n# CERTIDENT &quot;my nut monitor&quot; &quot;MyPasSw0rD&quot;\n# \n# See &#039;docs\/security.txt&#039; or the Security chapter of NUT user manual\n# for more information on the SSL support in NUT.\n\n# --------------------------------------------------------------------------\n# CERTHOST - security properties for an host\n# CERTHOST &lt;hostname&gt; &lt;certificate name&gt; &lt;certverify&gt; &lt;forcessl&gt;\n#\n# When compiled with SSL support with NSS, you can specify security directive\n# for each server you can contact.\n# Each entry maps server name with the expected certificate name and flags\n# indicating if the server certificate is verified and if the connection\n# must be secure.\n#\n# CERTHOST localhost &quot;My nut server&quot; 1 1\n#\n# See &#039;docs\/security.txt&#039; or the Security chapter of NUT user manual\n# for more information on the SSL support in NUT.\n\n# --------------------------------------------------------------------------\n# CERTVERIFY - make upsmon verify all connections with certificates\n# CERTVERIFY 1\n#\n# When compiled with SSL support, make upsmon verify all connections with \n# certificates.\n# Without this, there is no guarantee that the upsd is the right host.\n# Enabling this greatly reduces the risk of man in the middle attacks.\n# This effectively forces the use of SSL, so don&#039;t use this unless\n# all of your upsd hosts are ready for SSL and have their certificates\n# in order.\n# When compiled with NSS support of SSL, can be overriden for host \n# specified with a CERTHOST directive.\n\n# --------------------------------------------------------------------------\n# FORCESSL - force upsmon to use SSL\n# FORCESSL 1\n#\n# When compiled with SSL, specify that a secured connection must be used\n# to communicate with upsd.\n# If you don&#039;t use &#039;CERTVERIFY 1&#039;, then this will at least make sure\n# that nobody can sniff your sessions without a large effort.  Setting\n# this will make upsmon drop connections if the remote upsd doesn&#039;t\n# support SSL, so don&#039;t use it unless all of them have it running.\n# When compiled with NSS support of SSL, can be overriden for host \n# specified with a CERTHOST directive.<\/code><\/pre>\n<h2>8\u3001\u542f\u52a8NUT\u7684Server\u670d\u52a1\u548cNUT\u5ba2\u6237\u7aef<\/h2>\n<pre><code class=\"language-shell\">sudo service nut-server start\nsudo service nut-client start\n#\u786e\u8ba4\u670d\u52a1\u5747\u5df2\u6b63\u786e\u542f\u52a8\u3002\nps -ef | grep ups<\/code><\/pre>\n<h2>9\u3001\u786e\u5b9a\u8fd0\u884c\u72b6\u6001<\/h2>\n<pre><code class=\"language-shell\">#\u6211\u4eec\u8fd8\u53ef\u4ee5\u7528\u6307\u4ee4\u6765\u786e\u8ba4\u8fd9\u9897UPS\u53ef\u6267\u884c\u7684\u7ba1\u7406\u547d\u4ee4\u3002\nupscmd -l apc\n#\u6216\u662f\u53d6\u5f97UPS\u76ee\u524d\u7684\u7cfb\u7edf\u72b6\u6001\u3002\nupsc apc<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/0004.xyz\/wp-content\/uploads\/2021\/04\/12-1024x315.png\" alt=\"\" \/><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/0004.xyz\/wp-content\/uploads\/2021\/04\/13-1024x550.png\" alt=\"\" \/><\/p>\n<h1>2\u3001\u65ad\u7535\u5b9e\u6d4b<\/h1>\n<p>\u6211\u4eec\u8bd5\u7740\u5c06UPS \u7684\u5e02\u7535\u63d2\u5934\u62d4\u6389\uff0c\u8fd9\u65f6\u5019\u5728Shell \u5c31\u4f1a\u8df3\u51fa\u300cUPS on battery\u300d\u7684\u63d0\u793a\u3002<br \/>\n<img decoding=\"async\" src=\"http:\/\/0004.xyz\/wp-content\/uploads\/2021\/04\/14-1024x163.png\" alt=\"\" \/><br \/>\n\u63a5\u7740\u518d\u628a\u5e02\u7535\u63d2\u5934\u63a5\u56de\u53bb\u4e4b\u540e\uff0c\u5c31\u4f1a\u51fa\u73b0\u300cUPS on line power\u300d\u7684\u63d0\u793a\u3002<br \/>\n<img decoding=\"async\" src=\"http:\/\/0004.xyz\/wp-content\/uploads\/2021\/04\/15-1024x287.png\" alt=\"\" \/><br \/>\n\u5982\u679c\u6211\u4eec\u62d4\u6389USB \u8fde\u63a5\u7ebf\uff0c\u5219\u662f\u51fa\u73b0\u300cUPS is unavailable\u300d\u7684\u63d0\u793a\u3002<br \/>\n<img decoding=\"async\" src=\"http:\/\/0004.xyz\/wp-content\/uploads\/2021\/04\/16-1024x143.png\" alt=\"\" \/><\/p>\n<p>\u8fd9\u4e9b\u670d\u52a1\u5728\u8fd0\u4f5c\u8fc7\u7a0b\u4e2d\u7684\u9519\u8bef\u65e5\u5fd7\uff0c\u53ef\u4ee5\u5728\/var\/log\/syslog\u91cc\u9762\u627e\u5230\u3002<br \/>\ncat \/var\/log\/syslog | grep ups | less<\/p>\n<h1>3\u3001\u5f02\u5e38\u6392\u9664<\/h1>\n<p>\u5728\u542f\u52a8UPS \u7684\u8fc7\u7a0b\u4e2d\uff0c\u51fa\u73b0<\/p>\n<pre><code class=\"language-shell\">Can&#039;t chdir to \/var\/run\/nut\nwritepid: fopen \/var\/run\/nut\/usbhid-ups-apc.pid: Permission denied<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/0004.xyz\/wp-content\/uploads\/2021\/04\/17.png\" alt=\"\" \/><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/0004.xyz\/wp-content\/uploads\/2021\/04\/18.png\" alt=\"\" \/><br \/>\n\u8fd9\u662f\u56e0\u4e3a\u5b89\u88c5\u5957\u4ef6\u65f6\uff0c\u7cfb\u7edf\u6ca1\u6709\u81ea\u52a8\u5efa\u7acbrun-time\u7684\u76ee\u5f55\uff0c\u624b\u52a8\u5efa\u7acb\u5373\u53ef\u3002<\/p>\n<pre><code class=\"language-shell\">sudo mkdir \/var\/run\/nut\nsudo chown root:nut \/var\/run\/nut\nsudo chmod 770 \/var\/run\/nut<\/code><\/pre>\n<p>\u5728\u542f\u52a8nu-server \u65f6\u51fa\u73b0\u300cupsd failed\u300d\u7684\u9519\u8bef\u3002<br \/>\n\u53ef\u80fd\u662fupsd.conf \u8bbe\u5b9a\u9519\u8bef\u3001UPS \u7684USB \u7ebf\u6ca1\u63a5\u3001UPS \u7684\u7535\u6e90\u6ca1\u5f00&#8230; \u7b49\u539f\u56e0\u6240\u81f4\u3002<\/p>\n<p><a href=\"http:\/\/blog.itist.tw\/2015\/06\/building-ups-server-with-raspberry-pi.html\" title=\"windows nut\">[1]windows nut<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>UPS\u4e3b\u8981\u529f\u80fd\u5c31\u662f\u4fdd\u62a4\u786c\u76d8\u6570\u636e\uff0c\u8981\u77e5\u9053\u786c\u76d8\u6709\u4ef7\u6570\u636e\u65e0\u4ef7\uff0c\u79d1\u5b66\u5bb6\u66fe\u505a\u8fc7\u5b9e\u9a8c\uff0c\u786c\u76d8\u518d\u4f7f\u7528\u534a\u5e74\u540e\uff0c\u5176\u6570\u636e\u4ef7\u503c\u65e2\u5df2\u8d85\u8fc7 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"kt_blocks_editor_width":"","footnotes":""},"categories":[7],"tags":[549,12,548,547,546],"class_list":["post-335","post","type-post","status-publish","format-standard","hentry","category-record","tag-network-ups-tools","tag-nut","tag-raspberry","tag-ups","tag-546"],"_links":{"self":[{"href":"http:\/\/0004.xyz\/index.php?rest_route=\/wp\/v2\/posts\/335","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/0004.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/0004.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/0004.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/0004.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=335"}],"version-history":[{"count":0,"href":"http:\/\/0004.xyz\/index.php?rest_route=\/wp\/v2\/posts\/335\/revisions"}],"wp:attachment":[{"href":"http:\/\/0004.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/0004.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=335"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/0004.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}