├── Dockerfile ├── doshutdown ├── LICENSE ├── host-trigger-check.sh ├── mail-wrapper.sh ├── README.md └── apcupsd.conf /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | 3 | RUN apk update && apk add --no-cache apcupsd 4 | 5 | ADD apcupsd.conf /etc/apcupsd/apcupsd.conf 6 | ADD doshutdown /etc/apcupsd/doshutdown 7 | 8 | VOLUME [ "/etc/apcupsd", "/var/log/apcupsd" ] 9 | 10 | CMD [ "/sbin/apcupsd", "-b" ] 11 | -------------------------------------------------------------------------------- /doshutdown: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # 3 | # Use »docker run -v :/tmp/apcupsd-docker« to mount the trigger file folder to your host 4 | TRIGGERFILE=/tmp/apcupsd-docker/trigger 5 | 6 | umask 0000 7 | [ -d $(dirname $TRIGGERFILE) ] || mkdir -vp $(dirname $TRIGGERFILE) 8 | 9 | # Write a '1' into the file when a shutdown condition occurs 10 | umask 0111 11 | echo -n "Writing '1' to trigger file '$TRIGGERFILE'... " 12 | echo "1" > $TRIGGERFILE && echo "OK." 13 | 14 | # Nothing else will happen. Check regularly (or subscribe with inotify) for the 1 in that file and shut down if it exists. 15 | # Do not forget to delete or truncate the file, before shutting down. 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Leroy Förster 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /host-trigger-check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # 3 | # This script is part of apcupsd-docker by Leroy Förster. 4 | # It is designed to be run by regularly (e.g. by cron). If it reads a first line '1' in the TRIGGERFILE, it will run the 'action()' function and replace the '1' with a '0'. 5 | # Please change the content of the TRIGGERFILE variable and the action() function according to your needs. This has to be run on the host, not within a container, to be able to shut the machine down. 6 | 7 | # Path of the file that gets created in the folder that you mapped into the apcupsd docker container 8 | # Example: docker run -d -v /tmp/apcupsd-docker:/tmp/apcupsd-docker gersilex/apcupsd:v1 9 | TRIGGERFILE="/tmp/apcupsd-docker/trigger" 10 | 11 | # Put everything you want to do on a shutdown condition inside this function. 12 | action(){ 13 | echo "Detected '1' in '$TRIGGERFILE'." 14 | 15 | # Plan shutdown in 5 minutes, if supported by shutdown script 16 | shutdown -P +5 || true 17 | 18 | echo "Stopping all Docker containers..." 19 | docker ps -q | xargs --no-run-if-empty docker stop --time 300 20 | 21 | # Shutdown now, if we finish early with previous command 22 | shutdown -P now 23 | } 24 | 25 | ### Do not change below. Except you know what you are doing ### 26 | if [ -e "$TRIGGERFILE" ]; then 27 | read first_line < $TRIGGERFILE 28 | if [ "$first_line" == "1" ]; then 29 | echo "0" > $TRIGGERFILE 30 | action; 31 | fi 32 | fi 33 | -------------------------------------------------------------------------------- /mail-wrapper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # File : mail-wrapper.sh 4 | # Author : Len Kawamoto (len.kawamoto@gmail.com) 5 | # Date : March 4, 2021 (Happy Marching Music Day!) 6 | # Version: 1.0 7 | # 8 | # apcupsd relies on the OS's mail command for event notifications, but the 9 | # dockerized system doesn't have it installed. This results in no mail 10 | # notifications being delivered to the sysadmin. 11 | # 12 | # This script is a wrapper to provide a mechanism to call sendmail (which 13 | # is provided by busybox) in order to do the mail notifications. 14 | # 15 | # Since this script uses STARTTLS when connecting to the SMTP server, 16 | # it also depends on openssl, but will auto-install the package using apk 17 | # if it doesn't locate the binary. 18 | # 19 | # 20 | # 21 | # Installation 22 | # ------------ 23 | # 1. edit the configuration values (below) to meet your needs 24 | # 25 | # 2. map this script to the container in /usr/local/sbin (or any other 26 | # location in the $PATH). 27 | # docker -v ./mail-wrapper.sh:/usr/local/sbin/mail ... 28 | # OR 29 | # volumes: 30 | # - ./mail-wrapper.sh:/usr/local/sbin/mail 31 | # 32 | ############################################################################## 33 | # 34 | # Configuration 35 | # 36 | 37 | # The full path to our logfile 38 | # Hint: comment out (and don't set) logfile to disable logging 39 | # 40 | # Hint: map the log directory to your host 41 | # docker -v ./logs:/var/log/apcupsd ... 42 | # OR 43 | # volumes: 44 | # - ./logs:/var/log/apcupsd 45 | logfile="/var/log/apcupsd/mail.log" 46 | 47 | # The TO email address (the recipient of the mail notifications) 48 | mailTo="sysadmin@my.domain" 49 | 50 | # The FROM email address (the sender of the mail notifications) 51 | mailFrom="apcupsd@my.domain" 52 | 53 | # The next 2 config items define the SMTP server to which this script 54 | # will communicate. You might use your ISP provided smtp server 55 | # or google, yahoo, hotmail, or some other email provider. 56 | # 57 | # The smtp server name/address 58 | # Hint: Be sure to use an smtp server that enforces STARTTLS 59 | mailServer="smtp.my.isp" 60 | 61 | # The smtp server port number 62 | # Hint: Be sure to select a port that supports STARTTLS 63 | mailPort=807 64 | 65 | # The next 2 authentication config items are for allowing this script 66 | # to send email through the above defined smtp server. Most (if not all) 67 | # require authentication to prevent spam-bots from relaying through their 68 | # servers. 69 | # 70 | # If you're provider allows for "Application Specific Passwords", you might 71 | # consider using that feature to help protect your account. 72 | # 73 | # The smtp authentication username 74 | mailUsername="smtp-user@my.domain" 75 | 76 | # The smtp authentication password 77 | mailPassword="superstrongpassword" 78 | 79 | # 80 | # You probably don't need to modify this value, unless you're experimenting... 81 | # 82 | # The full path to the openssl binary 83 | openssl="/usr/bin/openssl" 84 | 85 | ############################################################################## 86 | # 87 | # You shouldn't have to change anything below here. 88 | # 89 | 90 | myLog() { 91 | if [ ! -z "$logfile" ]; then 92 | # for busybox DATE command 93 | echo -e "$(date -Iseconds | tr 'T' ' ') $@" >> $logfile 94 | # 95 | # for GNU coreutils DATE command 96 | #echo "$(date --rfc-3339=seconds) $@" >> $logfile 97 | fi 98 | } 99 | 100 | myLog "--- Start of script ---" 101 | 102 | # Check that openssl exists so that we can do STARTTLS from sendmail 103 | if [ ! -f $openssl ]; then 104 | # it's not found, so let's install it 105 | myLog "openssl is missing!" 106 | apk add openssl 107 | if [ $? -eq 0 ]; then 108 | myLog "Successfully installed openssl" 109 | else 110 | # we had an error during the apk add command 111 | myLog "Failed to install openssl" 112 | exit 1 113 | fi 114 | fi 115 | 116 | myMessage=`cat` 117 | #myLog "Message:\n$myMessage\n--- --- ---" 118 | echo "$myMessage" | sendmail -H "openssl s_client -quiet -tls1 -starttls smtp -connect $mailServer:$mailPort" -f "$mailFrom" -amLOGIN -au"$mailUsername" -ap"$mailPassword" $mailTo 119 | if [ $? -eq 0 ]; then 120 | myLog "sendmail completed successfully!" 121 | else 122 | myLog "sendmail returned an error" 123 | fi 124 | 125 | myLog "--- End of script ---" 126 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | APCUPSd-Docker 2 | ============== 3 | 4 | This Docker container connects to the local APC UPS or a remote apcupsd instance. Even if running in a container it can notify the host and trigger shutdown (or other) actions, if needed. All without special privileges. 5 | 6 | It can also be used for any other arbitrary commands and every apcupsd trigger action. 7 | 8 | See `Configuration Example` below. 9 | 10 | Requirements 11 | ------------ 12 | 13 | - Bash 14 | 15 | Usage 16 | ----- 17 | 18 | With default example settings: 19 | 20 | ```sh 21 | docker run -t -v /tmp/apcupsd-docker:/tmp/apcupsd-docker gersilex/apcupsd:v1 22 | ``` 23 | 24 | With custom settings: 25 | 26 | - Clone or download the content of this repository 27 | - Copy `apcupsd.conf` and make your changes 28 | - Repeat with `doshutdown` and/or `host-trigger-check.sh` 29 | - Run the container and map the files into the container to override the default settings: 30 | 31 | ```sh 32 | docker run -t \ 33 | -v /tmp/apcupsd-docker:/tmp/apcupsd-docker \ 34 | -v /path/to/your/apcupsd.conf:/etc/apcupsd/apcupsd.conf \ 35 | -v /path/to/your/doshutdown:/etc/apcupsd/doshutdown \ 36 | gersilex/apcupsd:v1 37 | ``` 38 | 39 | You can read the status from the stdout output, as the container starts `apcupsd -b` and shows INFO loglevel information. 40 | 41 | The `/etc/apcupsd/doshutdown` script will be executed when a condition (Low Battery, Low Lifetime left, Timeout exceeded) is reached while being in battery operation (See `/etc/apcupsd/apcupsd.conf` for more information and tweaking). 42 | 43 | To be able to notify the Docker host, you should either map your local device into the container (if the UPS is connected to this host) or map a folder from your host into the container and use the included `doshutdown` script. The script will write a `1` into a file with the name `trigger` in that folder. Monitor it on the host with cron or inotify and gracefully shut down your server, when the content is `1`. 44 | Don't forget to remove the file before shutdown to omit shutdown-loops after booting again. 45 | 46 | The `host-trigger-check.sh` contains a cron-compatible script that will run an included bash function, if it reads a '1' in the `/tmp/apcupsd-docker/trigger` file on the host. Read the shell script for instructions on how to use it. It's recommended to run this every minute. 47 | 48 | Configuration Example 49 | --------------------- 50 | 51 | An example `apcupsd.conf` file is provided, along with the original comments. Minimal working example: 52 | 53 | - UPS connected to a remote apcupsd instance on the host `nas`. Will execute `doshutdown` if 5% battery is left or 10 minutes remaining, whatever happens first. Docker host has cron running and checks for shutdown flag every minute by running `host-trigger-check.sh`. 54 | 55 | ```apache 56 | # /etc/apcupsd/apcupsd.conf (in the apcupsd-docker container) 57 | 58 | UPSTYPE net 59 | DEVICE nas:3551 60 | BATTERYLEVEL 5 61 | MINUTES 10 62 | ``` 63 | 64 | ```sh 65 | # /root/apcupsd/host-trigger-check.sh (excerpt) (on the Docker host) 66 | [...] 67 | 68 | TRIGGERFILE="/tmp/apcupsd-docker/trigger" 69 | 70 | # Put everything you want to do on a shutdown condition instide this function. 71 | action(){ 72 | echo "Detected '1' in '$TRIGGERFILE'." 73 | 74 | # Plan shutdown in 5 minutes 75 | shutdown -P +5 76 | 77 | echo "Stopping all Docker containers..." 78 | docker ps -q | xargs --no-run-if-empty docker stop --time 300 79 | 80 | # Shutdown now, if we finish early with previous command 81 | shutdown -P now 82 | } 83 | 84 | [...] 85 | ``` 86 | 87 | ```sh 88 | # /var/spool/cron/gersilex (generated by 'crontab -e') (on the Docker host) 89 | 90 | * * * * * /root/apcupsd/host-trigger-check.sh 91 | ``` 92 | 93 | Docker Tags 94 | ----------- 95 | 96 | `v1` `latest` The latest variant of v1. Intended to never break due to incompatibilities. `latest` is **not** the Git master branch and will not move to a v2 commit. 97 | 98 | `v1.0.0` A specific version generated from the Git tag. Intended to never change or get updated. 99 | 100 | Add-Ons 101 | ---------- 102 | 103 | ### Mail-Wrapper 104 | 105 | Len Kawamoto's `mail-wrapper.sh` wraps around the sendmail binary of busybox and exposes an interface similar to the 106 | original `mail` binary. `apcupsd` relies on the OS's `mail` command for event notifications, but the 107 | dockerized system doesn't have it installed. This results in no mail notifications being delivered to the sysadmin. 108 | 109 | See the file [`mail-wrapper.sh`](mail-wrapper.sh) for usage instructions. 110 | 111 | FAQ 112 | --- 113 | 114 | Q: I can't see any log output. 115 | A: Allocate a tty (with `docker run -t`). Apcupsd only shows output to ttys. 116 | 117 | Q: I only see `NIS server startup succeeded` 118 | A: If there is no new log line after 60 seconds, it probably is just fine. apcupsd does not log successful connections. Use `apcaccess` to be sure: 119 | 120 | Q: How to see if it works? 121 | A: Run `docker exec -it apcaccess` and watch the output. 122 | 123 | Contributors 124 | ------------ 125 | 126 | - [Leroy Förster (@gersilex)](https://github.com/gersilex) 127 | - [Andrew Pearson (@apearson)](https://github.com/apearson) 128 | - [@cassiorossi](https://github.com/cassiorossi) 129 | - [Len Kawamoto (@lenkawamoto)](https://github.com/lenkawamoto) 130 | 131 | License 132 | ------- 133 | 134 | MIT 135 | 136 | Buy Me A Beer 137 | ------------- 138 | 139 | http://paypal.me/leroyfoerster 140 | -------------------------------------------------------------------------------- /apcupsd.conf: -------------------------------------------------------------------------------- 1 | ## apcupsd.conf v1.1 ## 2 | # 3 | # "apcupsd" POSIX config file 4 | 5 | # 6 | # Note that the apcupsd daemon must be restarted in order for changes to 7 | # this configuration file to become active. 8 | # 9 | 10 | # 11 | # ========= General configuration parameters ============ 12 | # 13 | 14 | # UPSNAME xxx 15 | # Use this to give your UPS a name in log files and such. This 16 | # is particulary useful if you have multiple UPSes. This does not 17 | # set the EEPROM. It should be 8 characters or less. 18 | #UPSNAME 19 | 20 | # UPSCABLE 21 | # Defines the type of cable connecting the UPS to your computer. 22 | # 23 | # Possible generic choices for are: 24 | # simple, smart, ether, usb 25 | # 26 | # Or a specific cable model number may be used: 27 | # 940-0119A, 940-0127A, 940-0128A, 940-0020B, 28 | # 940-0020C, 940-0023A, 940-0024B, 940-0024C, 29 | # 940-1524C, 940-0024G, 940-0095A, 940-0095B, 30 | # 940-0095C, 940-0625A, M-04-02-2000 31 | # 32 | UPSCABLE usb 33 | 34 | # To get apcupsd to work, in addition to defining the cable 35 | # above, you must also define a UPSTYPE, which corresponds to 36 | # the type of UPS you have (see the Description for more details). 37 | # You must also specify a DEVICE, sometimes referred to as a port. 38 | # For USB UPSes, please leave the DEVICE directive blank. For 39 | # other UPS types, you must specify an appropriate port or address. 40 | # 41 | # UPSTYPE DEVICE Description 42 | # apcsmart /dev/tty** Newer serial character device, appropriate for 43 | # SmartUPS models using a serial cable (not USB). 44 | # 45 | # usb Most new UPSes are USB. A blank DEVICE 46 | # setting enables autodetection, which is 47 | # the best choice for most installations. 48 | # 49 | # net hostname:port Network link to a master apcupsd through apcupsd's 50 | # Network Information Server. This is used if the 51 | # UPS powering your computer is connected to a 52 | # different computer for monitoring. 53 | # 54 | # snmp hostname:port:vendor:community 55 | # SNMP network link to an SNMP-enabled UPS device. 56 | # Hostname is the ip address or hostname of the UPS 57 | # on the network. Vendor can be can be "APC" or 58 | # "APC_NOTRAP". "APC_NOTRAP" will disable SNMP trap 59 | # catching; you usually want "APC". Port is usually 60 | # 161. Community is usually "private". 61 | # 62 | # netsnmp hostname:port:vendor:community 63 | # OBSOLETE 64 | # Same as SNMP above but requires use of the 65 | # net-snmp library. Unless you have a specific need 66 | # for this old driver, you should use 'snmp' instead. 67 | # 68 | # dumb /dev/tty** Old serial character device for use with 69 | # simple-signaling UPSes. 70 | # 71 | # pcnet ipaddr:username:passphrase:port 72 | # PowerChute Network Shutdown protocol which can be 73 | # used as an alternative to SNMP with the AP9617 74 | # family of smart slot cards. ipaddr is the IP 75 | # address of the UPS management card. username and 76 | # passphrase are the credentials for which the card 77 | # has been configured. port is the port number on 78 | # which to listen for messages from the UPS, normally 79 | # 3052. If this parameter is empty or missing, the 80 | # default of 3052 will be used. 81 | # 82 | # modbus /dev/tty** Serial device for use with newest SmartUPS models 83 | # supporting the MODBUS protocol. 84 | # modbus Leave the DEVICE setting blank for MODBUS over USB 85 | # or set to the serial number of the UPS to ensure 86 | # that apcupsd binds to that particular unit 87 | # (helpful if you have more than one USB UPS). 88 | # 89 | UPSTYPE net 90 | DEVICE nas:3551 91 | 92 | # POLLTIME 93 | # Interval (in seconds) at which apcupsd polls the UPS for status. This 94 | # setting applies both to directly-attached UPSes (UPSTYPE apcsmart, usb, 95 | # dumb) and networked UPSes (UPSTYPE net, snmp). Lowering this setting 96 | # will improve apcupsd's responsiveness to certain events at the cost of 97 | # higher CPU utilization. The default of 60 is appropriate for most 98 | # situations. 99 | #POLLTIME 60 100 | 101 | # LOCKFILE 102 | # Path for device lock file. This is the directory into which the lock file 103 | # will be written. The directory must already exist; apcupsd will not create 104 | # it. The actual name of the lock file is computed from DEVICE. 105 | # Not used on Win32. 106 | LOCKFILE /var/lock 107 | 108 | # SCRIPTDIR 109 | # Directory in which apccontrol and event scripts are located. 110 | SCRIPTDIR /etc/apcupsd 111 | 112 | # PWRFAILDIR 113 | # Directory in which to write the powerfail flag file. This file 114 | # is created when apcupsd initiates a system shutdown and is 115 | # checked in the OS halt scripts to determine if a killpower 116 | # (turning off UPS output power) is required. 117 | PWRFAILDIR /etc/apcupsd 118 | 119 | # NOLOGINDIR 120 | # Directory in which to write the nologin file. The existence 121 | # of this flag file tells the OS to disallow new logins. 122 | NOLOGINDIR /etc 123 | 124 | 125 | # 126 | # ======== Configuration parameters used during power failures ========== 127 | # 128 | 129 | # The ONBATTERYDELAY is the time in seconds from when a power failure 130 | # is detected until we react to it with an onbattery event. 131 | # 132 | # This means that, apccontrol will be called with the powerout argument 133 | # immediately when a power failure is detected. However, the 134 | # onbattery argument is passed to apccontrol only after the 135 | # ONBATTERYDELAY time. If you don't want to be annoyed by short 136 | # powerfailures, make sure that apccontrol powerout does nothing 137 | # i.e. comment out the wall. 138 | ONBATTERYDELAY 6 139 | 140 | # 141 | # Note: BATTERYLEVEL, MINUTES, and TIMEOUT work in conjunction, so 142 | # the first that occurs will cause the initation of a shutdown. 143 | # 144 | 145 | # If during a power failure, the remaining battery percentage 146 | # (as reported by the UPS) is below or equal to BATTERYLEVEL, 147 | # apcupsd will initiate a system shutdown. 148 | BATTERYLEVEL 20 149 | 150 | # If during a power failure, the remaining runtime in minutes 151 | # (as calculated internally by the UPS) is below or equal to MINUTES, 152 | # apcupsd, will initiate a system shutdown. 153 | MINUTES 10 154 | 155 | # If during a power failure, the UPS has run on batteries for TIMEOUT 156 | # many seconds or longer, apcupsd will initiate a system shutdown. 157 | # A value of 0 disables this timer. 158 | # 159 | # Note, if you have a Smart UPS, you will most likely want to disable 160 | # this timer by setting it to zero. That way, you UPS will continue 161 | # on batteries until either the % charge remaing drops to or below BATTERYLEVEL, 162 | # or the remaining battery runtime drops to or below MINUTES. Of course, 163 | # if you are testing, setting this to 60 causes a quick system shutdown 164 | # if you pull the power plug. 165 | # If you have an older dumb UPS, you will want to set this to less than 166 | # the time you know you can run on batteries. 167 | TIMEOUT 0 168 | 169 | # Time in seconds between annoying users to signoff prior to 170 | # system shutdown. 0 disables. 171 | ANNOY 300 172 | 173 | # Initial delay after power failure before warning users to get 174 | # off the system. 175 | ANNOYDELAY 60 176 | 177 | # The condition which determines when users are prevented from 178 | # logging in during a power failure. 179 | # NOLOGON [ disable | timeout | percent | minutes | always ] 180 | NOLOGON disable 181 | 182 | # If KILLDELAY is non-zero, apcupsd will continue running after a 183 | # shutdown has been requested, and after the specified time in 184 | # seconds attempt to kill the power. This is for use on systems 185 | # where apcupsd cannot regain control after a shutdown. 186 | # KILLDELAY 0 disables 187 | KILLDELAY 0 188 | 189 | # 190 | # ==== Configuration statements for Network Information Server ==== 191 | # 192 | 193 | # NETSERVER [ on | off ] on enables, off disables the network 194 | # information server. If netstatus is on, a network information 195 | # server process will be started for serving the STATUS and 196 | # EVENT data over the network (used by CGI programs). 197 | NETSERVER on 198 | 199 | # NISIP 200 | # IP address on which NIS server will listen for incoming connections. 201 | # This is useful if your server is multi-homed (has more than one 202 | # network interface and IP address). Default value is 0.0.0.0 which 203 | # means any incoming request will be serviced. Alternatively, you can 204 | # configure this setting to any specific IP address of your server and 205 | # NIS will listen for connections only on that interface. Use the 206 | # loopback address (127.0.0.1) to accept connections only from the 207 | # local machine. 208 | NISIP 0.0.0.0 209 | 210 | # NISPORT default is 3551 as registered with the IANA 211 | # port to use for sending STATUS and EVENTS data over the network. 212 | # It is not used unless NETSERVER is on. If you change this port, 213 | # you will need to change the corresponding value in the cgi directory 214 | # and rebuild the cgi programs. 215 | NISPORT 3551 216 | 217 | # If you want the last few EVENTS to be available over the network 218 | # by the network information server, you must define an EVENTSFILE. 219 | EVENTSFILE /var/log/apcupsd.events 220 | 221 | # EVENTSFILEMAX 222 | # By default, the size of the EVENTSFILE will be not be allowed to exceed 223 | # 10 kilobytes. When the file grows beyond this limit, older EVENTS will 224 | # be removed from the beginning of the file (first in first out). The 225 | # parameter EVENTSFILEMAX can be set to a different kilobyte value, or set 226 | # to zero to allow the EVENTSFILE to grow without limit. 227 | EVENTSFILEMAX 10 228 | 229 | # 230 | # ========== Configuration statements used if sharing ============= 231 | # a UPS with more than one machine 232 | 233 | # 234 | # Remaining items are for ShareUPS (APC expansion card) ONLY 235 | # 236 | 237 | # UPSCLASS [ standalone | shareslave | sharemaster ] 238 | # Normally standalone unless you share an UPS using an APC ShareUPS 239 | # card. 240 | UPSCLASS standalone 241 | 242 | # UPSMODE [ disable | share ] 243 | # Normally disable unless you share an UPS using an APC ShareUPS card. 244 | UPSMODE disable 245 | 246 | # 247 | # ===== Configuration statements to control apcupsd system logging ======== 248 | # 249 | 250 | # Time interval in seconds between writing the STATUS file; 0 disables 251 | STATTIME 0 252 | 253 | # Location of STATUS file (written to only if STATTIME is non-zero) 254 | STATFILE /var/log/apcupsd.status 255 | 256 | # LOGSTATS [ on | off ] on enables, off disables 257 | # Note! This generates a lot of output, so if 258 | # you turn this on, be sure that the 259 | # file defined in syslog.conf for LOG_NOTICE is a named pipe. 260 | # You probably do not want this on. 261 | LOGSTATS off 262 | 263 | # Time interval in seconds between writing the DATA records to 264 | # the log file. 0 disables. 265 | DATATIME 0 266 | 267 | # FACILITY defines the logging facility (class) for logging to syslog. 268 | # If not specified, it defaults to "daemon". This is useful 269 | # if you want to separate the data logged by apcupsd from other 270 | # programs. 271 | #FACILITY DAEMON 272 | 273 | # 274 | # ========== Configuration statements used in updating the UPS EPROM ========= 275 | # 276 | 277 | # 278 | # These statements are used only by apctest when choosing "Set EEPROM with conf 279 | # file values" from the EEPROM menu. THESE STATEMENTS HAVE NO EFFECT ON APCUPSD. 280 | # 281 | 282 | # UPS name, max 8 characters 283 | #UPSNAME UPS_IDEN 284 | 285 | # Battery date - 8 characters 286 | #BATTDATE mm/dd/yy 287 | 288 | # Sensitivity to line voltage quality (H cause faster transfer to batteries) 289 | # SENSITIVITY H M L (default = H) 290 | #SENSITIVITY H 291 | 292 | # UPS delay after power return (seconds) 293 | # WAKEUP 000 060 180 300 (default = 0) 294 | #WAKEUP 60 295 | 296 | # UPS Grace period after request to power off (seconds) 297 | # SLEEP 020 180 300 600 (default = 20) 298 | #SLEEP 180 299 | 300 | # Low line voltage causing transfer to batteries 301 | # The permitted values depend on your model as defined by last letter 302 | # of FIRMWARE or APCMODEL. Some representative values are: 303 | # D 106 103 100 097 304 | # M 177 172 168 182 305 | # A 092 090 088 086 306 | # I 208 204 200 196 (default = 0 => not valid) 307 | #LOTRANSFER 208 308 | 309 | # High line voltage causing transfer to batteries 310 | # The permitted values depend on your model as defined by last letterDanke für den Amazon.de Geschenkgutschein! 311 | # of FIRMWARE or APCMODEL. Some representative values are: 312 | # D 127 130 133 136 313 | # M 229 234 239 224 314 | # A 108 110 112 114 315 | # I 253 257 261 265 (default = 0 => not valid) 316 | #HITRANSFER 253 317 | 318 | # Battery charge needed to restore power 319 | # RETURNCHARGE 00 15 50 90 (default = 15) 320 | #RETURNCHARGE 15 321 | 322 | # Alarm delay 323 | # 0 = zero delay after pwr fail, T = power fail + 30 sec, L = low battery, N = never 324 | # BEEPSTATE 0 T L N (default = 0) 325 | #BEEPSTATE T 326 | 327 | # Low battery warning delay in minutes 328 | # LOWBATT 02 05 07 10 (default = 02) 329 | #LOWBATT 2 330 | 331 | # UPS Output voltage when running on batteries 332 | # The permitted values depend on your model as defined by last letter 333 | # of FIRMWARE or APCMODEL. Some representative values are: 334 | # D 115 335 | # M 208 336 | # A 100 337 | # I 230 240 220 225 (default = 0 => not valid) 338 | #OUTPUTVOLTS 230 339 | 340 | # Self test interval in hours 336=2 weeks, 168=1 week, ON=at power on 341 | # SELFTEST 336 168 ON OFF (default = 336) 342 | #SELFTEST 336 343 | --------------------------------------------------------------------------------