Giter Club home page Giter Club logo

pyapcupsdexporter's Introduction

pyapcupsdexporter

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

This is a fork of https://github.com/atribe/apcupsd-influxdb-exporter to add InfluxDB 2.x support.

How to build

Building the image is straight forward:

  • Git clone this repo
  • docker build -t pyapcupsdexporter .

Environment Variables

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

With the changes to InfluxDB 2.0, this currently requires you to have an ORG + Token setup instead of the base username/password.

Environment Variable 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
INFLUX_URL http://192.168.1.100:8086 required. URL to your InfluxDB Instance.
INFLUX_ORG my-org required, the name of the organization.
INFLUX_TOKEN somebase64string required, needed to log in to InfluxDB instance
INFLUXDB_PORT 8086 optional, defaults to 8086
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="pyapcupsdexporter" \
    -e "WATTS=600" \
    -e "INFLUX_URL=http://10.0.1.11:8086" \
    -e "INFLUX_TOKEN=asdflkajwse;orfiajsdklfjaskl==" \
    -e "INFLUX_ORG=my-org" \
    -e "APCUPSD_HOST=10.0.1.11" \
    -t xNinjaKittyx/pyapcupsdexporter

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:
  pyapcupsdexporter:
    image: xNinjaKittyx/pyapcupsdexporter
    container_name: pyapcupsdexporter
    restart: always
    environment:
      WATTS: 1000
      APCUPSD_HOST: 10.0.1.11
      INFLUX_URL: http://10.0.1.11:8086
      INFLUX_ORG: my-org
      INFLUX_TOKEN:
      INTERVAL: 5

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

pyapcupsdexporter's People

Contributors

atribe avatar brilthor avatar gilbn avatar macourteau avatar mlevy94 avatar mrhotio avatar xninjakittyx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.