apcupsd-influxdb-exporter

Docker app from atribe's Repository

Overview

Docker wrapper for a python script to query apcupsd via a python version of apcaccess, it then sends the data to influxdb.

apcupsd-influxdb-exporter

Dockerized Python script that will send data from apcupsd to influxdb.

How to build

Building the image is straight forward:

  • Git clone this repo
  • docker build -t apcupsd-influxdb-exporter .

Environment Variables

These are all the available environment variables, along with some example values, and a description.

Environment Varialbe Example Value Description
WATTS 1000 if your ups doesn't have NOMPOWER, set this to be the rated max power, if you do have NOMPOWER, don't set this variable
APCUPSD_HOST 192.168.1.100 host running apcupsd, defaults to the value of influxdb_host
INFLUXDB_HOST 192.168.1.101 host running influxdb
HOSTNAME unraid host you want to show up in influxdb. Optional, defaults to apcupsd hostname value
INFLUXDB_DATABASE apcupsd db name for influxdb. optional, defaults to apcupsd
INFLUXDB_USER myuser optional, defaults to empty
INFLUXDB_PASSWORD pass optional, defaults to empty
INFLUXDB_PORT 8086 optional, defaults to 8086
INTERVAL 10 optional, defaults to 10 seconds
VERBOSE true if anything but true docker logging will show no output

How to Use

Run docker container directly

docker run --rm  -d --name="apcupsd-influxdb-exporter" \
    -e "WATTS=600" \
    -e "INFLUXDB_HOST=10.0.1.11" \
    -e "APCUPSD_HOST=10.0.1.11" \
    -t atribe/apcupsd-influxdb-exporter

Note: if your UPS does not include the NOMPOWER metric, you will need to include the WATTS environment variable in order to compute the live-power consumption metric.

Run from docker-compose

version: '3'
services:
  apcupsd-influxdb-exporter:
    image: atribe/apcupsd-influxdb-exporter
    container_name: apcupsd-influxdb-exporter
    restart: always
    environment:
      WATTS: 1000
      APCUPSD_HOST: 10.0.1.11
      INFLUXDB_HOST: 10.0.1.11
      INTERVAL: 5

If you want to debug the apcaccess output or the send to influxdb, set the environment variable "VERBOSE" to "true"

Install apcupsd-influxdb-exporter on Unraid in a few clicks.

Find apcupsd-influxdb-exporter in Community Apps on your Unraid server, review the template, and click Install. Unraid handles the Docker app or plugin setup from the published template.

Open the Apps tab on your Unraid server Search Community Apps for apcupsd-influxdb-exporter Review the template variables and paths Click Install

Download Statistics

866,704
Total Downloads
262
This Month
92
Avg / Month

Total Downloads Over Time

Loading chart...

Related apps

Explore more like this

Explore all

Details

Repository
atribe/apcupsd-influxdb-exporter
Last Updated2020-06-23
First Seen2019-01-23

Runtime arguments

Network
bridge
Shell
sh
Privileged
false

Template configuration

HOSTNAMEVariable

host you want the measurements to show up as in influxdb

Default
unraid
Value
panthro
WATTSVariable

If your UPS doesn't have the NOMPOWER metric then specify the rated watts so that the load percentage can be used to calculate the current watts

Value
1500
INFLUXDB_HOSTVariable

ip address of influxdb

Default
localhost
Value
10.13.13.15
APCUPSD_HOSTVariable

address of host running apcupsd

Default
localhost
Value
10.13.13.15
INFLUXDB_PORTVariable

Container Variable: INFLUXDB_PORT

Default
8086
Value
8086
INFLUXDB_DATABASEVariable

influxdb database name to store values

Default
apcupsd
Value
apcupsd
INFLUXDB_USERVariable

User name for Influxdb

INFLUXDB_PASSWORDVariable

Password for Influxdb

Debugging OutputVariable

Set this variable to true to see the output in the docker log.

Target
VERBOSE
Default
false
Value
false