Coder Social home page Coder Social logo

soerenhenning / prometheus-raritan-pdu-exporter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from psyinfra/prometheus-raritan-pdu-exporter

0.0 1.0 0.0 232 KB

Python-based Raritan PDU exporter for prometheus.io.

License: ISC License

Python 99.61% Dockerfile 0.39%

prometheus-raritan-pdu-exporter's Introduction

Maintainer GitHub Build Status GitHub tag (latest by date) Python Version

Prometheus Raritan PDU Exporter

Python-based Raritan PDU exporter for prometheus.io.

This exporter uses the Raritan JSON-RPC API to find inlet, outlet, pole, and device sensors to expose their readings to the Prometheus monitoring system.

We have purposely opted not to use the Raritan PDU Python API since direct calls to the JSON-RPC API are very straight-forward. Furthermore, only a handful of methods are used (getInlets, getOutlets, getMetaData, getDeviceSlots, getDevice, getReading and getState) on the /bulk endpoint, ignoring most of the methods included in the Python API. As a result we do not have to bundle the Raritan PDU Python API with this project.

Installation

git clone [email protected]:psyinfra/prometheus-raritan-pdu-exporter.git
cd prometheus_raritan_pdu_exporter
pip install .

Usage for PDU collection

raritanpdu [-h] -c config [-w LISTEN_ADDRESS] [-l LOG_LEVEL [LOG_LEVEL ...]]

optional arguments:
  -h, --help            show this help message and exit
  -c config, --config config
                        configuration json file containing PDU addresses 
                        and login info
  -w LISTEN_ADDRESS, --web.listen-address LISTEN_ADDRESS
                        Address and port to listen on (default = :9950)
  -l LOG_LEVEL [LOG_LEVEL ...], --log LOG_LEVEL [LOG_LEVEL ...]
                        Specify logging level for internal and external 
                        logging, respectively (Default is WARNING,CRITICAL)

Example

raritanpdu --web.listen-address :9950

The entry points raritanpdu and prometheus_raritan_pdu_exporter are identical and can be used interchangeably.

Debugging

To enable debugging, set -l debug to log debug messages. Note that this will provide a lot of additional information and is therefore not a recommended setting for long-term use in production.

Docker Image

A Docker image can be built with:

docker build -t raritanpdu .

To run the image, expose port 9950 and mount the configuration file:

docker run -p 9950:9950 -v <path/to/config.json>:/prometheus-raritan-pdu-exporter/config.json raritanpdu

Testing

Run tests using tox

pip3 install tox
tox

Testing without VCR cassettes

Our tests use vcrpy to record responses from the Raritan PDU JSON-RPC API, because access to this data is not guaranteed. If you want to test the Raritan PDU Exporter on your PDU setup, copy your config.json file to tests/fixtures/config.json and remove the tests/fixtures/vcr_cassettes/ folder and its contents. Tests can then be run as usual, but will take longer as PDUs are requested for data to re-establish the VCR cassettes with data from the PDUs in the config file.

prometheus-raritan-pdu-exporter's People

Contributors

nhjjr avatar soerenhenning avatar

Watchers

 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.