From d710d2fbb6638615dda12dc17a72153b60a1f37a Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Thu, 8 Jun 2023 10:58:26 -0400 Subject: [PATCH 01/28] Adds apcupsd_image template --- .../addons/apcupsd/addon_apcupsd.tmpl | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 install/templates/addons/apcupsd/addon_apcupsd.tmpl diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl new file mode 100644 index 00000000..922054a3 --- /dev/null +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -0,0 +1,22 @@ +# Autogenerated - DO NOT MODIFY THIS FILE DIRECTLY +# If you want to overwrite some of these values with your own customizations, +# please add them to `override/api.yml`. +# +# See https://docs.docker.com/compose/extends/#adding-and-overriding-configuration +# for more information on overriding specific parameters of docker-compose files. + +version: "3.7" +services: + apcupsd: + image: ${ADDON_APCUPSD_IMAGE} + container_name: ${COMPOSE_PROJECT_NAME}_apcupsd + cap_drop: + - ALL + restart: unless-stopped + stop_signal: SIGKILL + stop_grace_period: 1s + devices: ["${ADDON_APCUPSD_MOUNT_POINT}"] + volumes: ["/var/lib/node_exporter/textfile_collector:/root/textfile_collector:ro"${EXPORTER_ROOTFS_VOLUME} ] + network_mode: host + networks: + net: \ No newline at end of file From 1a1d2fc62bf21055978080b6dd4efa8f85c47ff4 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Thu, 8 Jun 2023 12:21:32 -0400 Subject: [PATCH 02/28] Adds override tmpl --- install/override/addons/apcupsd/addon_apcupsd.yml | 9 +++++++++ install/templates/addons/apcupsd/addon_apcupsd.tmpl | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 install/override/addons/apcupsd/addon_apcupsd.yml diff --git a/install/override/addons/apcupsd/addon_apcupsd.yml b/install/override/addons/apcupsd/addon_apcupsd.yml new file mode 100644 index 00000000..04112c63 --- /dev/null +++ b/install/override/addons/apcupsd/addon_apcupsd.yml @@ -0,0 +1,9 @@ +# Enter your own customizations for the Graffiti Wall Addon container here. These changes will persist after upgrades, so you only need to do them once. +# +# See https://docs.docker.com/compose/extends/#adding-and-overriding-configuration +# for more information on overriding specific parameters of docker-compose files. + +version: "3.7" +services: + addon_apcupsd: + x-rp-comment: Add your customizations below this line \ No newline at end of file diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index 922054a3..7f9acb24 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -7,7 +7,7 @@ version: "3.7" services: - apcupsd: + addon_apcupsd: image: ${ADDON_APCUPSD_IMAGE} container_name: ${COMPOSE_PROJECT_NAME}_apcupsd cap_drop: From 2564908d8ab6e0f0438556e75d9331dd9732266d Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Thu, 8 Jun 2023 12:30:00 -0400 Subject: [PATCH 03/28] fix reference to container tag --- install/templates/addons/apcupsd/addon_apcupsd.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index 7f9acb24..0b37a8fc 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -8,8 +8,8 @@ version: "3.7" services: addon_apcupsd: - image: ${ADDON_APCUPSD_IMAGE} - container_name: ${COMPOSE_PROJECT_NAME}_apcupsd + image: ${ADDON_APCUPSD_CONTAINER_TAG} + container_name: ${COMPOSE_PROJECT_NAME}_addon_apcupsd cap_drop: - ALL restart: unless-stopped From 86d4857d8c8aeb9654a16cb72cea5d4d3840ca75 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Thu, 8 Jun 2023 12:36:42 -0400 Subject: [PATCH 04/28] fix tabbing on networks key --- install/templates/addons/apcupsd/addon_apcupsd.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index 0b37a8fc..f8184d8f 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -18,5 +18,5 @@ services: devices: ["${ADDON_APCUPSD_MOUNT_POINT}"] volumes: ["/var/lib/node_exporter/textfile_collector:/root/textfile_collector:ro"${EXPORTER_ROOTFS_VOLUME} ] network_mode: host - networks: - net: \ No newline at end of file +networks: + net: \ No newline at end of file From 7980c9230135716fe701ec61c16316f609395b87 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Thu, 8 Jun 2023 15:21:11 -0400 Subject: [PATCH 05/28] make volume rw --- install/templates/addons/apcupsd/addon_apcupsd.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index f8184d8f..0d91e11e 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -16,7 +16,7 @@ services: stop_signal: SIGKILL stop_grace_period: 1s devices: ["${ADDON_APCUPSD_MOUNT_POINT}"] - volumes: ["/var/lib/node_exporter/textfile_collector:/root/textfile_collector:ro"${EXPORTER_ROOTFS_VOLUME} ] + volumes: ["/var/lib/node_exporter/textfile_collector:/root/textfile_collector:rw"] network_mode: host networks: net: \ No newline at end of file From fe30c82d86de80febb12f5199af761d0f3a90380 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Thu, 8 Jun 2023 15:36:02 -0400 Subject: [PATCH 06/28] Adds environment variables --- install/templates/addons/apcupsd/addon_apcupsd.tmpl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index 0d91e11e..b0c43d77 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -18,5 +18,10 @@ services: devices: ["${ADDON_APCUPSD_MOUNT_POINT}"] volumes: ["/var/lib/node_exporter/textfile_collector:/root/textfile_collector:rw"] network_mode: host + environment: + APCUPSD_OUTPUT_FILEPATH: "${ADDON_APCUPSD_OUTPUT_FILEPATH}" + APCUPSD_DEBUG: "${APCUPSD_DEBUG}" + APCUPSD_POLL_CRON: "${ADDON_APCUPSD_POLL_CRON}" + APCUPSD_TIMEOUT: "${ADDON_APCUPSD_TIMEOUT}" networks: net: \ No newline at end of file From cb9e6436d1bf431a5de511e0ffd4756d9aebf8f0 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Thu, 8 Jun 2023 15:46:18 -0400 Subject: [PATCH 07/28] remove quotes from env variable definition --- install/templates/addons/apcupsd/addon_apcupsd.tmpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index b0c43d77..90fda041 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -19,9 +19,9 @@ services: volumes: ["/var/lib/node_exporter/textfile_collector:/root/textfile_collector:rw"] network_mode: host environment: - APCUPSD_OUTPUT_FILEPATH: "${ADDON_APCUPSD_OUTPUT_FILEPATH}" - APCUPSD_DEBUG: "${APCUPSD_DEBUG}" - APCUPSD_POLL_CRON: "${ADDON_APCUPSD_POLL_CRON}" - APCUPSD_TIMEOUT: "${ADDON_APCUPSD_TIMEOUT}" + APCUPSD_OUTPUT_FILEPATH: ${ADDON_APCUPSD_OUTPUT_FILEPATH} + APCUPSD_DEBUG: ${APCUPSD_DEBUG} + APCUPSD_POLL_CRON: ${ADDON_APCUPSD_POLL_CRON} + APCUPSD_TIMEOUT: ${ADDON_APCUPSD_TIMEOUT} networks: net: \ No newline at end of file From 13e7df2ef64a11d57b5e1587b1ba66f3432ba649 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Thu, 8 Jun 2023 16:00:00 -0400 Subject: [PATCH 08/28] fix bad env variable name --- install/templates/addons/apcupsd/addon_apcupsd.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index 90fda041..c8fff0a4 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -20,7 +20,7 @@ services: network_mode: host environment: APCUPSD_OUTPUT_FILEPATH: ${ADDON_APCUPSD_OUTPUT_FILEPATH} - APCUPSD_DEBUG: ${APCUPSD_DEBUG} + APCUPSD_DEBUG: ${ADDON_APCUPSD_DEBUG} APCUPSD_POLL_CRON: ${ADDON_APCUPSD_POLL_CRON} APCUPSD_TIMEOUT: ${ADDON_APCUPSD_TIMEOUT} networks: From 994d9b066838cc9d965a53409f58b2897f668b1b Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Thu, 8 Jun 2023 16:04:13 -0400 Subject: [PATCH 09/28] add quotes to string variables --- install/templates/addons/apcupsd/addon_apcupsd.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index c8fff0a4..27262830 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -19,9 +19,9 @@ services: volumes: ["/var/lib/node_exporter/textfile_collector:/root/textfile_collector:rw"] network_mode: host environment: - APCUPSD_OUTPUT_FILEPATH: ${ADDON_APCUPSD_OUTPUT_FILEPATH} + APCUPSD_OUTPUT_FILEPATH: "${ADDON_APCUPSD_OUTPUT_FILEPATH}" APCUPSD_DEBUG: ${ADDON_APCUPSD_DEBUG} - APCUPSD_POLL_CRON: ${ADDON_APCUPSD_POLL_CRON} + APCUPSD_POLL_CRON: "${ADDON_APCUPSD_POLL_CRON}" APCUPSD_TIMEOUT: ${ADDON_APCUPSD_TIMEOUT} networks: net: \ No newline at end of file From 0948655976b5e7d0dda6c279765ae8ef473495be Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Thu, 8 Jun 2023 21:21:45 -0400 Subject: [PATCH 10/28] try multi container setup --- install/templates/addons/apcupsd/addon_apcupsd.tmpl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index 27262830..e9f194dc 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -16,9 +16,22 @@ services: stop_signal: SIGKILL stop_grace_period: 1s devices: ["${ADDON_APCUPSD_MOUNT_POINT}"] + network_mode: host + ports: + - 3551:3551 + addon_apcupsd_exporter: + image: ${ADDON_APCUPSD_EXPORTER_CONTAINER_TAG} + container_name: ${COMPOSE_PROJECT_NAME}_addon_apcupsd_exporter + cap_drop: + - ALL + restart: unless-stopped + stop_signal: SIGKILL + stop_grace_period: 1s volumes: ["/var/lib/node_exporter/textfile_collector:/root/textfile_collector:rw"] network_mode: host environment: + APCUPSD_HOST: "addon_apcupsd" + APCUPSD_PORT: "3551" APCUPSD_OUTPUT_FILEPATH: "${ADDON_APCUPSD_OUTPUT_FILEPATH}" APCUPSD_DEBUG: ${ADDON_APCUPSD_DEBUG} APCUPSD_POLL_CRON: "${ADDON_APCUPSD_POLL_CRON}" From dcda5c7f8793faef7f8ba4ca867fa51a7f74598e Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Thu, 8 Jun 2023 21:41:31 -0400 Subject: [PATCH 11/28] Updates networking config --- install/templates/addons/apcupsd/addon_apcupsd.tmpl | 2 -- 1 file changed, 2 deletions(-) diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index e9f194dc..2d955dce 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -16,7 +16,6 @@ services: stop_signal: SIGKILL stop_grace_period: 1s devices: ["${ADDON_APCUPSD_MOUNT_POINT}"] - network_mode: host ports: - 3551:3551 addon_apcupsd_exporter: @@ -28,7 +27,6 @@ services: stop_signal: SIGKILL stop_grace_period: 1s volumes: ["/var/lib/node_exporter/textfile_collector:/root/textfile_collector:rw"] - network_mode: host environment: APCUPSD_HOST: "addon_apcupsd" APCUPSD_PORT: "3551" From 86148097460070883cc4dc10f6310f74c99a3062 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Fri, 9 Jun 2023 12:42:51 -0400 Subject: [PATCH 12/28] Mount custom apcupsd.conf --- .../addons/apcupsd/addon_apcupsd_config.tmpl | 344 ++++++++++++++++++ 1 file changed, 344 insertions(+) create mode 100644 install/templates/addons/apcupsd/addon_apcupsd_config.tmpl diff --git a/install/templates/addons/apcupsd/addon_apcupsd_config.tmpl b/install/templates/addons/apcupsd/addon_apcupsd_config.tmpl new file mode 100644 index 00000000..9824a23a --- /dev/null +++ b/install/templates/addons/apcupsd/addon_apcupsd_config.tmpl @@ -0,0 +1,344 @@ +## apcupsd.conf v1.1 ## +# +# "apcupsd" POSIX config file + +# +# Note that the apcupsd daemon must be restarted in order for changes to +# this configuration file to become active. +# + +# +# ========= General configuration parameters ============ +# + +# UPSNAME xxx +# Use this to give your UPS a name in log files and such. This +# is particulary useful if you have multiple UPSes. This does not +# set the EEPROM. It should be 8 characters or less. +#UPSNAME + +# UPSCABLE +# Defines the type of cable connecting the UPS to your computer. +# +# Possible generic choices for are: +# simple, smart, ether, usb +# +# Or a specific cable model number may be used: +# 940-0119A, 940-0127A, 940-0128A, 940-0020B, +# 940-0020C, 940-0023A, 940-0024B, 940-0024C, +# 940-1524C, 940-0024G, 940-0095A, 940-0095B, +# 940-0095C, 940-0625A, M-04-02-2000 +# +UPSCABLE usb + +# To get apcupsd to work, in addition to defining the cable +# above, you must also define a UPSTYPE, which corresponds to +# the type of UPS you have (see the Description for more details). +# You must also specify a DEVICE, sometimes referred to as a port. +# For USB UPSes, please leave the DEVICE directive blank. For +# other UPS types, you must specify an appropriate port or address. +# +# UPSTYPE DEVICE Description +# apcsmart /dev/tty** Newer serial character device, appropriate for +# SmartUPS models using a serial cable (not USB). +# +# usb Most new UPSes are USB. A blank DEVICE +# setting enables autodetection, which is +# the best choice for most installations. +# +# net hostname:port Network link to a master apcupsd through apcupsd's +# Network Information Server. This is used if the +# UPS powering your computer is connected to a +# different computer for monitoring. +# +# snmp hostname:port:vendor:community +# SNMP network link to an SNMP-enabled UPS device. +# Hostname is the ip address or hostname of the UPS +# on the network. Vendor can be can be "APC" or +# "APC_NOTRAP". "APC_NOTRAP" will disable SNMP trap +# catching; you usually want "APC". Port is usually +# 161. Community is usually "private". +# +# netsnmp hostname:port:vendor:community +# OBSOLETE +# Same as SNMP above but requires use of the +# net-snmp library. Unless you have a specific need +# for this old driver, you should use 'snmp' instead. +# +# dumb /dev/tty** Old serial character device for use with +# simple-signaling UPSes. +# +# pcnet ipaddr:username:passphrase:port +# PowerChute Network Shutdown protocol which can be +# used as an alternative to SNMP with the AP9617 +# family of smart slot cards. ipaddr is the IP +# address of the UPS management card. username and +# passphrase are the credentials for which the card +# has been configured. port is the port number on +# which to listen for messages from the UPS, normally +# 3052. If this parameter is empty or missing, the +# default of 3052 will be used. +# +# modbus /dev/tty** Serial device for use with newest SmartUPS models +# supporting the MODBUS protocol. +# modbus Leave the DEVICE setting blank for MODBUS over USB +# or set to the serial number of the UPS to ensure +# that apcupsd binds to that particular unit +# (helpful if you have more than one USB UPS). +# +UPSTYPE usb +#DEVICE /dev/ttyS0 +DEVICE + +# POLLTIME +# Interval (in seconds) at which apcupsd polls the UPS for status. This +# setting applies both to directly-attached UPSes (UPSTYPE apcsmart, usb, +# dumb) and networked UPSes (UPSTYPE net, snmp). Lowering this setting +# will improve apcupsd's responsiveness to certain events at the cost of +# higher CPU utilization. The default of 60 is appropriate for most +# situations. +#POLLTIME 60 + +# LOCKFILE +# Path for device lock file for UPSes connected via USB or +# serial port. This is the directory into which the lock file +# will be written. The directory must already exist; apcupsd will not create +# it. The actual name of the lock file is computed from DEVICE. +# Not used on Win32. +LOCKFILE /var/lock + +# SCRIPTDIR +# Directory in which apccontrol and event scripts are located. +SCRIPTDIR /etc/apcupsd + +# PWRFAILDIR +# Directory in which to write the powerfail flag file. This file +# is created when apcupsd initiates a system shutdown and is +# checked in the OS halt scripts to determine if a killpower +# (turning off UPS output power) is required. +PWRFAILDIR /etc/apcupsd + +# NOLOGINDIR +# Directory in which to write the nologin file. The existence +# of this flag file tells the OS to disallow new logins. +NOLOGINDIR /etc + + +# +# ======== Configuration parameters used during power failures ========== +# + +# The ONBATTERYDELAY is the time in seconds from when a power failure +# is detected until we react to it with an onbattery event. +# +# This means that, apccontrol will be called with the powerout argument +# immediately when a power failure is detected. However, the +# onbattery argument is passed to apccontrol only after the +# ONBATTERYDELAY time. If you don't want to be annoyed by short +# powerfailures, make sure that apccontrol powerout does nothing +# i.e. comment out the wall. +ONBATTERYDELAY 6 + +# +# Note: BATTERYLEVEL, MINUTES, and TIMEOUT work in conjunction, so +# the first that occurs will cause the initation of a shutdown. +# + +# If during a power failure, the remaining battery percentage +# (as reported by the UPS) is below or equal to BATTERYLEVEL, +# apcupsd will initiate a system shutdown. +BATTERYLEVEL 5 + +# If during a power failure, the remaining runtime in minutes +# (as calculated internally by the UPS) is below or equal to MINUTES, +# apcupsd, will initiate a system shutdown. +MINUTES 3 + +# If during a power failure, the UPS has run on batteries for TIMEOUT +# many seconds or longer, apcupsd will initiate a system shutdown. +# A value of 0 disables this timer. +# +# Note, if you have a Smart UPS, you will most likely want to disable +# this timer by setting it to zero. That way, you UPS will continue +# on batteries until either the % charge remaing drops to or below BATTERYLEVEL, +# or the remaining battery runtime drops to or below MINUTES. Of course, +# if you are testing, setting this to 60 causes a quick system shutdown +# if you pull the power plug. +# If you have an older dumb UPS, you will want to set this to less than +# the time you know you can run on batteries. +TIMEOUT 0 + +# Time in seconds between annoying users to signoff prior to +# system shutdown. 0 disables. +ANNOY 300 + +# Initial delay after power failure before warning users to get +# off the system. +ANNOYDELAY 60 + +# The condition which determines when users are prevented from +# logging in during a power failure. +# NOLOGON [ disable | timeout | percent | minutes | always ] +NOLOGON disable + +# If KILLDELAY is non-zero, apcupsd will continue running after a +# shutdown has been requested, and after the specified time in +# seconds attempt to kill the power. This is for use on systems +# where apcupsd cannot regain control after a shutdown. +# KILLDELAY 0 disables +KILLDELAY 0 + +# +# ==== Configuration statements for Network Information Server ==== +# + +# NETSERVER [ on | off ] on enables, off disables the network +# information server. If netstatus is on, a network information +# server process will be started for serving the STATUS and +# EVENT data over the network (used by CGI programs). +NETSERVER on + +# NISIP +# IP address on which NIS server will listen for incoming connections. +# This is useful if your server is multi-homed (has more than one +# network interface and IP address). Default value is 0.0.0.0 which +# means any incoming request will be serviced. Alternatively, you can +# configure this setting to any specific IP address of your server and +# NIS will listen for connections only on that interface. Use the +# loopback address (127.0.0.1) to accept connections only from the +# local machine. +NISIP 127.0.0.1 + +# NISPORT default is 3551 as registered with the IANA +# port to use for sending STATUS and EVENTS data over the network. +# It is not used unless NETSERVER is on. If you change this port, +# you will need to change the corresponding value in the cgi directory +# and rebuild the cgi programs. +NISPORT 3551 + +# If you want the last few EVENTS to be available over the network +# by the network information server, you must define an EVENTSFILE. +EVENTSFILE /var/log/apcupsd.events + +# EVENTSFILEMAX +# By default, the size of the EVENTSFILE will be not be allowed to exceed +# 10 kilobytes. When the file grows beyond this limit, older EVENTS will +# be removed from the beginning of the file (first in first out). The +# parameter EVENTSFILEMAX can be set to a different kilobyte value, or set +# to zero to allow the EVENTSFILE to grow without limit. +EVENTSFILEMAX 10 + +# +# ========== Configuration statements used if sharing ============= +# a UPS with more than one machine + +# +# Remaining items are for ShareUPS (APC expansion card) ONLY +# + +# UPSCLASS [ standalone | shareslave | sharemaster ] +# Normally standalone unless you share an UPS using an APC ShareUPS +# card. +UPSCLASS standalone + +# UPSMODE [ disable | share ] +# Normally disable unless you share an UPS using an APC ShareUPS card. +UPSMODE disable + +# +# ===== Configuration statements to control apcupsd system logging ======== +# + +# Time interval in seconds between writing the STATUS file; 0 disables +STATTIME 0 + +# Location of STATUS file (written to only if STATTIME is non-zero) +STATFILE /var/log/apcupsd.status + +# LOGSTATS [ on | off ] on enables, off disables +# Note! This generates a lot of output, so if +# you turn this on, be sure that the +# file defined in syslog.conf for LOG_NOTICE is a named pipe. +# You probably do not want this on. +LOGSTATS off + +# Time interval in seconds between writing the DATA records to +# the log file. 0 disables. +DATATIME 0 + +# FACILITY defines the logging facility (class) for logging to syslog. +# If not specified, it defaults to "daemon". This is useful +# if you want to separate the data logged by apcupsd from other +# programs. +#FACILITY DAEMON + +# +# ========== Configuration statements used in updating the UPS EPROM ========= +# + +# +# These statements are used only by apctest when choosing "Set EEPROM with conf +# file values" from the EEPROM menu. THESE STATEMENTS HAVE NO EFFECT ON APCUPSD. +# + +# UPS name, max 8 characters +#UPSNAME UPS_IDEN + +# Battery date - 8 characters +#BATTDATE mm/dd/yy + +# Sensitivity to line voltage quality (H cause faster transfer to batteries) +# SENSITIVITY H M L (default = H) +#SENSITIVITY H + +# UPS delay after power return (seconds) +# WAKEUP 000 060 180 300 (default = 0) +#WAKEUP 60 + +# UPS Grace period after request to power off (seconds) +# SLEEP 020 180 300 600 (default = 20) +#SLEEP 180 + +# Low line voltage causing transfer to batteries +# The permitted values depend on your model as defined by last letter +# of FIRMWARE or APCMODEL. Some representative values are: +# D 106 103 100 097 +# M 177 172 168 182 +# A 092 090 088 086 +# I 208 204 200 196 (default = 0 => not valid) +#LOTRANSFER 208 + +# High line voltage causing transfer to batteries +# The permitted values depend on your model as defined by last letter +# of FIRMWARE or APCMODEL. Some representative values are: +# D 127 130 133 136 +# M 229 234 239 224 +# A 108 110 112 114 +# I 253 257 261 265 (default = 0 => not valid) +#HITRANSFER 253 + +# Battery charge needed to restore power +# RETURNCHARGE 00 15 50 90 (default = 15) +#RETURNCHARGE 15 + +# Alarm delay +# 0 = zero delay after pwr fail, T = power fail + 30 sec, L = low battery, N = never +# BEEPSTATE 0 T L N (default = 0) +#BEEPSTATE T + +# Low battery warning delay in minutes +# LOWBATT 02 05 07 10 (default = 02) +#LOWBATT 2 + +# UPS Output voltage when running on batteries +# The permitted values depend on your model as defined by last letter +# of FIRMWARE or APCMODEL. Some representative values are: +# D 115 +# M 208 +# A 100 +# I 230 240 220 225 (default = 0 => not valid) +#OUTPUTVOLTS 230 + +# Self test interval in hours 336=2 weeks, 168=1 week, ON=at power on +# SELFTEST 336 168 ON OFF (default = 336) +#SELFTEST 336 \ No newline at end of file From af466ac394d713d5fccf3bbea29cf64ff2ee5144 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Fri, 9 Jun 2023 12:43:02 -0400 Subject: [PATCH 13/28] Mount custom apcupsd.conf --- install/templates/addons/apcupsd/addon_apcupsd.tmpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index 2d955dce..c2f29a76 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -16,6 +16,8 @@ services: stop_signal: SIGKILL stop_grace_period: 1s devices: ["${ADDON_APCUPSD_MOUNT_POINT}"] + volumes: + - ${ROCKETPOOL_FOLDER}/runtime/addons/apcupsd/addon_apcupsd_config:/etc/apcupsd/apcupsd.conf ports: - 3551:3551 addon_apcupsd_exporter: From 5ab242a5368058505f796b97336bd30e7d57b3b3 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Fri, 9 Jun 2023 13:24:43 -0400 Subject: [PATCH 14/28] change location to expect apcupsd.conf --- install/templates/addons/apcupsd/addon_apcupsd.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index c2f29a76..ff05c0b9 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -17,7 +17,7 @@ services: stop_grace_period: 1s devices: ["${ADDON_APCUPSD_MOUNT_POINT}"] volumes: - - ${ROCKETPOOL_FOLDER}/runtime/addons/apcupsd/addon_apcupsd_config:/etc/apcupsd/apcupsd.conf + - ${ROCKETPOOL_FOLDER}/apcupsd.conf:/etc/apcupsd/apcupsd.conf ports: - 3551:3551 addon_apcupsd_exporter: From 9b580796d3d46d5e6187814139814f016f08bea9 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Fri, 9 Jun 2023 13:26:20 -0400 Subject: [PATCH 15/28] prefix filename --- install/templates/addons/apcupsd/addon_apcupsd.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index ff05c0b9..6617cc9d 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -17,7 +17,7 @@ services: stop_grace_period: 1s devices: ["${ADDON_APCUPSD_MOUNT_POINT}"] volumes: - - ${ROCKETPOOL_FOLDER}/apcupsd.conf:/etc/apcupsd/apcupsd.conf + - ${ROCKETPOOL_FOLDER}/addon_apcupsd.conf:/etc/apcupsd/apcupsd.conf ports: - 3551:3551 addon_apcupsd_exporter: From c70dbc33f7b09e135b348c310f7de9dd50b1ac07 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Fri, 9 Jun 2023 13:41:37 -0400 Subject: [PATCH 16/28] Add a blank file so it can be overwritten by the cli --- install/addon_apcupsd.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 install/addon_apcupsd.conf diff --git a/install/addon_apcupsd.conf b/install/addon_apcupsd.conf new file mode 100644 index 00000000..e7c9954f --- /dev/null +++ b/install/addon_apcupsd.conf @@ -0,0 +1 @@ +# Intentionally blank \ No newline at end of file From 2c9dbb973f3fe2e39cf07a8429375eb4b629c424 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Fri, 9 Jun 2023 13:44:11 -0400 Subject: [PATCH 17/28] update install script --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index 93df5768..d29640cb 100755 --- a/install.sh +++ b/install.sh @@ -422,6 +422,7 @@ progress 8 "Copying package files to Rocket Pool user data directory..." { cp -r "$PACKAGE_FILES_PATH/scripts" "$RP_PATH" || fail "Could not copy scripts folder to the Rocket Pool user data directory."; } >&2 { cp -r "$PACKAGE_FILES_PATH/templates" "$RP_PATH" || fail "Could not copy templates folder to the Rocket Pool user data directory."; } >&2 { cp "$PACKAGE_FILES_PATH/grafana-prometheus-datasource.yml" "$PACKAGE_FILES_PATH/prometheus.tmpl" "$RP_PATH" || fail "Could not copy base files to the Rocket Pool user data directory."; } >&2 +{ cp "$PACKAGE_FILES_PATH/addon_apcupsd.conf" "$PACKAGE_FILES_PATH/addon_apcupsd.conf" "$RP_PATH" || fail "Could not copy base files to the Rocket Pool user data directory."; } >&2 { find "$RP_PATH/scripts" -name "*.sh" -exec chmod +x {} \; 2>/dev/null || fail "Could not set executable permissions on package files."; } >&2 { touch -a "$RP_PATH/.firstrun" || fail "Could not create the first-run flag file."; } >&2 From 78ebac6526b967d10b71cfb89786d36e55663765 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Fri, 9 Jun 2023 13:53:13 -0400 Subject: [PATCH 18/28] Add TODO comment --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index d29640cb..691022cb 100755 --- a/install.sh +++ b/install.sh @@ -422,6 +422,7 @@ progress 8 "Copying package files to Rocket Pool user data directory..." { cp -r "$PACKAGE_FILES_PATH/scripts" "$RP_PATH" || fail "Could not copy scripts folder to the Rocket Pool user data directory."; } >&2 { cp -r "$PACKAGE_FILES_PATH/templates" "$RP_PATH" || fail "Could not copy templates folder to the Rocket Pool user data directory."; } >&2 { cp "$PACKAGE_FILES_PATH/grafana-prometheus-datasource.yml" "$PACKAGE_FILES_PATH/prometheus.tmpl" "$RP_PATH" || fail "Could not copy base files to the Rocket Pool user data directory."; } >&2 +# TODO: Confirm this is a good way of bootstrapping a config file to be overwritten by the CLI { cp "$PACKAGE_FILES_PATH/addon_apcupsd.conf" "$PACKAGE_FILES_PATH/addon_apcupsd.conf" "$RP_PATH" || fail "Could not copy base files to the Rocket Pool user data directory."; } >&2 { find "$RP_PATH/scripts" -name "*.sh" -exec chmod +x {} \; 2>/dev/null || fail "Could not set executable permissions on package files."; } >&2 { touch -a "$RP_PATH/.firstrun" || fail "Could not create the first-run flag file."; } >&2 From c5d2cc72084263a8bdd1c8c87bcabc9fcddcf207 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Fri, 9 Jun 2023 13:58:16 -0400 Subject: [PATCH 19/28] Update configuration to allow external connections --- install/templates/addons/apcupsd/addon_apcupsd_config.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/templates/addons/apcupsd/addon_apcupsd_config.tmpl b/install/templates/addons/apcupsd/addon_apcupsd_config.tmpl index 9824a23a..f470a7e2 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd_config.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd_config.tmpl @@ -207,7 +207,7 @@ NETSERVER on # NIS will listen for connections only on that interface. Use the # loopback address (127.0.0.1) to accept connections only from the # local machine. -NISIP 127.0.0.1 +NISIP 0.0.0.0 # NISPORT default is 3551 as registered with the IANA # port to use for sending STATUS and EVENTS data over the network. From 6e4d84db178e4587ba0a86f03f7ed11e5d1d0142 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Mon, 12 Jun 2023 12:52:55 -0400 Subject: [PATCH 20/28] Update to use a collector --- install/prometheus.tmpl | 6 +++++- install/templates/addons/apcupsd/addon_apcupsd.tmpl | 11 +++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/install/prometheus.tmpl b/install/prometheus.tmpl index 01600f82..04fdb9c2 100644 --- a/install/prometheus.tmpl +++ b/install/prometheus.tmpl @@ -43,4 +43,8 @@ scrape_configs: scrape_interval: 5m scrape_timeout: 5m static_configs: - - targets: ['watchtower:${WATCHTOWER_METRICS_PORT:-9104}'] \ No newline at end of file + - targets: ['watchtower:${WATCHTOWER_METRICS_PORT:-9104}'] + + - job_name: 'apcupsd' + static_configs: + - targets: ['addon_apcupsd:${ADDON_APCUPSD_METRICS_PORT:-9162}'] \ No newline at end of file diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index 6617cc9d..c1a79cee 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -28,13 +28,8 @@ services: restart: unless-stopped stop_signal: SIGKILL stop_grace_period: 1s - volumes: ["/var/lib/node_exporter/textfile_collector:/root/textfile_collector:rw"] - environment: - APCUPSD_HOST: "addon_apcupsd" - APCUPSD_PORT: "3551" - APCUPSD_OUTPUT_FILEPATH: "${ADDON_APCUPSD_OUTPUT_FILEPATH}" - APCUPSD_DEBUG: ${ADDON_APCUPSD_DEBUG} - APCUPSD_POLL_CRON: "${ADDON_APCUPSD_POLL_CRON}" - APCUPSD_TIMEOUT: ${ADDON_APCUPSD_TIMEOUT} + command: "-apcupsd.addr addon_apcupsd:3551 -apcupsd.network tcp -telemetry.addr 0.0.0.0:9162 -telemetry.path /metrics" + ports: + - "9162:9162" networks: net: \ No newline at end of file From 70c1e9cb4f62cf287b65e83454411e83f8af8cfd Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Mon, 12 Jun 2023 20:31:45 -0400 Subject: [PATCH 21/28] update prometheus template and add container to network --- install/prometheus.tmpl | 2 +- install/templates/addons/apcupsd/addon_apcupsd.tmpl | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/install/prometheus.tmpl b/install/prometheus.tmpl index 04fdb9c2..509fdf8d 100644 --- a/install/prometheus.tmpl +++ b/install/prometheus.tmpl @@ -47,4 +47,4 @@ scrape_configs: - job_name: 'apcupsd' static_configs: - - targets: ['addon_apcupsd:${ADDON_APCUPSD_METRICS_PORT:-9162}'] \ No newline at end of file + - targets: ['addon_apcupsd_exporter:${ADDON_APCUPSD_METRICS_PORT:-9162}'] \ No newline at end of file diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index c1a79cee..39234cb3 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -29,6 +29,8 @@ services: stop_signal: SIGKILL stop_grace_period: 1s command: "-apcupsd.addr addon_apcupsd:3551 -apcupsd.network tcp -telemetry.addr 0.0.0.0:9162 -telemetry.path /metrics" + networks: + - net ports: - "9162:9162" networks: From bd2dfc44d4b462ae9334a71436c9edeb645f59fa Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Mon, 12 Jun 2023 20:54:27 -0400 Subject: [PATCH 22/28] Fix addon_apcupsd on wrong network --- install/templates/addons/apcupsd/addon_apcupsd.tmpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index 39234cb3..fffb123e 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -18,6 +18,8 @@ services: devices: ["${ADDON_APCUPSD_MOUNT_POINT}"] volumes: - ${ROCKETPOOL_FOLDER}/addon_apcupsd.conf:/etc/apcupsd/apcupsd.conf + networks: + - net ports: - 3551:3551 addon_apcupsd_exporter: From 90b25fd940b82d8be9d3993965c2d18bb131c491 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Tue, 13 Jun 2023 12:54:59 -0400 Subject: [PATCH 23/28] add docker host gateway to exporter --- install/templates/addons/apcupsd/addon_apcupsd.tmpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.tmpl index fffb123e..63666a86 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.tmpl @@ -31,6 +31,8 @@ services: stop_signal: SIGKILL stop_grace_period: 1s command: "-apcupsd.addr addon_apcupsd:3551 -apcupsd.network tcp -telemetry.addr 0.0.0.0:9162 -telemetry.path /metrics" + extra_hosts: + - "host.docker.internal:host-gateway" networks: - net ports: From e8965923208769ff729c9c584c357b4bb770183e Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Tue, 13 Jun 2023 13:51:00 -0400 Subject: [PATCH 24/28] Split compose config into two variants --- ...upsd.tmpl => addon_apcupsd.container.tmpl} | 0 .../addons/apcupsd/addon_apcupsd.network.tmpl | 26 +++++++++++++++++++ 2 files changed, 26 insertions(+) rename install/templates/addons/apcupsd/{addon_apcupsd.tmpl => addon_apcupsd.container.tmpl} (100%) create mode 100644 install/templates/addons/apcupsd/addon_apcupsd.network.tmpl diff --git a/install/templates/addons/apcupsd/addon_apcupsd.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.container.tmpl similarity index 100% rename from install/templates/addons/apcupsd/addon_apcupsd.tmpl rename to install/templates/addons/apcupsd/addon_apcupsd.container.tmpl diff --git a/install/templates/addons/apcupsd/addon_apcupsd.network.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.network.tmpl new file mode 100644 index 00000000..af181dec --- /dev/null +++ b/install/templates/addons/apcupsd/addon_apcupsd.network.tmpl @@ -0,0 +1,26 @@ +# Autogenerated - DO NOT MODIFY THIS FILE DIRECTLY +# If you want to overwrite some of these values with your own customizations, +# please add them to `override/api.yml`. +# +# See https://docs.docker.com/compose/extends/#adding-and-overriding-configuration +# for more information on overriding specific parameters of docker-compose files. + +version: "3.7" +services: + addon_apcupsd_exporter: + image: ${ADDON_APCUPSD_EXPORTER_CONTAINER_TAG} + container_name: ${COMPOSE_PROJECT_NAME}_addon_apcupsd_exporter + cap_drop: + - ALL + restart: unless-stopped + stop_signal: SIGKILL + stop_grace_period: 1s + command: "-apcupsd.addr ${ADDON_APCUPSD_NETWORK_ADDRESS:-host.docker.internal:3551} -apcupsd.network tcp -telemetry.addr 0.0.0.0:9162 -telemetry.path /metrics" + extra_hosts: + - "host.docker.internal:host-gateway" + networks: + - net + ports: + - "9162:9162" +networks: + net: \ No newline at end of file From 3c0cc28090e2980bc4b5036269ad00ae428e3093 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Tue, 13 Jun 2023 14:18:13 -0400 Subject: [PATCH 25/28] Comment out services defined in overrides folder to avoid undefined service --- install/override/addons/apcupsd/addon_apcupsd.yml | 8 +++++--- .../templates/addons/apcupsd/addon_apcupsd.container.tmpl | 2 +- .../templates/addons/apcupsd/addon_apcupsd.network.tmpl | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/install/override/addons/apcupsd/addon_apcupsd.yml b/install/override/addons/apcupsd/addon_apcupsd.yml index 04112c63..63ae4bef 100644 --- a/install/override/addons/apcupsd/addon_apcupsd.yml +++ b/install/override/addons/apcupsd/addon_apcupsd.yml @@ -1,9 +1,11 @@ -# Enter your own customizations for the Graffiti Wall Addon container here. These changes will persist after upgrades, so you only need to do them once. +# Enter your own customizations for the APCUPSD Addon container here. These changes will persist after upgrades, so you only need to do them once. # # See https://docs.docker.com/compose/extends/#adding-and-overriding-configuration # for more information on overriding specific parameters of docker-compose files. version: "3.7" services: - addon_apcupsd: - x-rp-comment: Add your customizations below this line \ No newline at end of file + # addon_apcupsd: + # x-rp-comment: Add your customizations below this line + # addon_apcupsd_exporter: + # x-rp-comment: Add your customizations below this line \ No newline at end of file diff --git a/install/templates/addons/apcupsd/addon_apcupsd.container.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.container.tmpl index 63666a86..39bda5e2 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.container.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.container.tmpl @@ -1,6 +1,6 @@ # Autogenerated - DO NOT MODIFY THIS FILE DIRECTLY # If you want to overwrite some of these values with your own customizations, -# please add them to `override/api.yml`. +# please add them to `override/addons/apcupsd/addon_apcupsd.yml`. # # See https://docs.docker.com/compose/extends/#adding-and-overriding-configuration # for more information on overriding specific parameters of docker-compose files. diff --git a/install/templates/addons/apcupsd/addon_apcupsd.network.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.network.tmpl index af181dec..afa594d3 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.network.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.network.tmpl @@ -1,6 +1,6 @@ # Autogenerated - DO NOT MODIFY THIS FILE DIRECTLY # If you want to overwrite some of these values with your own customizations, -# please add them to `override/api.yml`. +# please add them to `override/addons/apcupsd/addon_apcupsd.yml`. # # See https://docs.docker.com/compose/extends/#adding-and-overriding-configuration # for more information on overriding specific parameters of docker-compose files. From 9d1d1c8f4d6c06f03720936fbe8b13242c263484 Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Tue, 13 Jun 2023 14:49:01 -0400 Subject: [PATCH 26/28] No need to publish ports on host --- install/override/addons/apcupsd/addon_apcupsd.yml | 2 +- install/templates/addons/apcupsd/addon_apcupsd.container.tmpl | 4 ---- install/templates/addons/apcupsd/addon_apcupsd.network.tmpl | 2 -- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/install/override/addons/apcupsd/addon_apcupsd.yml b/install/override/addons/apcupsd/addon_apcupsd.yml index 63ae4bef..3d41d768 100644 --- a/install/override/addons/apcupsd/addon_apcupsd.yml +++ b/install/override/addons/apcupsd/addon_apcupsd.yml @@ -4,7 +4,7 @@ # for more information on overriding specific parameters of docker-compose files. version: "3.7" -services: +#services: # addon_apcupsd: # x-rp-comment: Add your customizations below this line # addon_apcupsd_exporter: diff --git a/install/templates/addons/apcupsd/addon_apcupsd.container.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.container.tmpl index 39bda5e2..53fb9882 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.container.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.container.tmpl @@ -20,8 +20,6 @@ services: - ${ROCKETPOOL_FOLDER}/addon_apcupsd.conf:/etc/apcupsd/apcupsd.conf networks: - net - ports: - - 3551:3551 addon_apcupsd_exporter: image: ${ADDON_APCUPSD_EXPORTER_CONTAINER_TAG} container_name: ${COMPOSE_PROJECT_NAME}_addon_apcupsd_exporter @@ -35,7 +33,5 @@ services: - "host.docker.internal:host-gateway" networks: - net - ports: - - "9162:9162" networks: net: \ No newline at end of file diff --git a/install/templates/addons/apcupsd/addon_apcupsd.network.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.network.tmpl index afa594d3..acae6a65 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.network.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.network.tmpl @@ -20,7 +20,5 @@ services: - "host.docker.internal:host-gateway" networks: - net - ports: - - "9162:9162" networks: net: \ No newline at end of file From 596d3cbc5ebcfccaae76f714214ebed8ec559f2c Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Tue, 13 Jun 2023 15:07:34 -0400 Subject: [PATCH 27/28] Allow for changing metrics port --- install/templates/addons/apcupsd/addon_apcupsd.container.tmpl | 2 +- install/templates/addons/apcupsd/addon_apcupsd.network.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/install/templates/addons/apcupsd/addon_apcupsd.container.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.container.tmpl index 53fb9882..4775ad22 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.container.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.container.tmpl @@ -28,7 +28,7 @@ services: restart: unless-stopped stop_signal: SIGKILL stop_grace_period: 1s - command: "-apcupsd.addr addon_apcupsd:3551 -apcupsd.network tcp -telemetry.addr 0.0.0.0:9162 -telemetry.path /metrics" + command: "-apcupsd.addr addon_apcupsd:3551 -apcupsd.network tcp -telemetry.addr 0.0.0.0:${ADDON_APCUPSD_METRICS_PORT:-9162} -telemetry.path /metrics" extra_hosts: - "host.docker.internal:host-gateway" networks: diff --git a/install/templates/addons/apcupsd/addon_apcupsd.network.tmpl b/install/templates/addons/apcupsd/addon_apcupsd.network.tmpl index acae6a65..731a9895 100644 --- a/install/templates/addons/apcupsd/addon_apcupsd.network.tmpl +++ b/install/templates/addons/apcupsd/addon_apcupsd.network.tmpl @@ -15,7 +15,7 @@ services: restart: unless-stopped stop_signal: SIGKILL stop_grace_period: 1s - command: "-apcupsd.addr ${ADDON_APCUPSD_NETWORK_ADDRESS:-host.docker.internal:3551} -apcupsd.network tcp -telemetry.addr 0.0.0.0:9162 -telemetry.path /metrics" + command: "-apcupsd.addr ${ADDON_APCUPSD_NETWORK_ADDRESS:-host.docker.internal:3551} -apcupsd.network tcp -telemetry.addr 0.0.0.0:${ADDON_APCUPSD_METRICS_PORT:-9162} -telemetry.path /metrics" extra_hosts: - "host.docker.internal:host-gateway" networks: From 8eda5c14cd73bf3511b4b8e6a5f788e612c2998c Mon Sep 17 00:00:00 2001 From: Dan Imbrogno Date: Tue, 13 Jun 2023 15:23:30 -0400 Subject: [PATCH 28/28] No need to copy the apcupsd config file --- install.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/install.sh b/install.sh index 691022cb..93df5768 100755 --- a/install.sh +++ b/install.sh @@ -422,8 +422,6 @@ progress 8 "Copying package files to Rocket Pool user data directory..." { cp -r "$PACKAGE_FILES_PATH/scripts" "$RP_PATH" || fail "Could not copy scripts folder to the Rocket Pool user data directory."; } >&2 { cp -r "$PACKAGE_FILES_PATH/templates" "$RP_PATH" || fail "Could not copy templates folder to the Rocket Pool user data directory."; } >&2 { cp "$PACKAGE_FILES_PATH/grafana-prometheus-datasource.yml" "$PACKAGE_FILES_PATH/prometheus.tmpl" "$RP_PATH" || fail "Could not copy base files to the Rocket Pool user data directory."; } >&2 -# TODO: Confirm this is a good way of bootstrapping a config file to be overwritten by the CLI -{ cp "$PACKAGE_FILES_PATH/addon_apcupsd.conf" "$PACKAGE_FILES_PATH/addon_apcupsd.conf" "$RP_PATH" || fail "Could not copy base files to the Rocket Pool user data directory."; } >&2 { find "$RP_PATH/scripts" -name "*.sh" -exec chmod +x {} \; 2>/dev/null || fail "Could not set executable permissions on package files."; } >&2 { touch -a "$RP_PATH/.firstrun" || fail "Could not create the first-run flag file."; } >&2