Coder Social home page Coder Social logo

prometheus-ethtool-exporter's Introduction

prometheus-ethtool-exporter

A python script that pulls information from ethtool and publishes it in prometheus format.

This utility drew some inspiration from https://github.com/adeverteuil/ethtool_exporter, but simplified it and added a few new features. This version has consistent label names with node_exporter, which makes it more intuitive to use. You're also able to make this script export the data in prometheus file format on disk to achieve easier integration with node exporter without the need to run another daemon.

You can either use this as a standalone exporter that listens on an HTTP port, or use it to save data on disk in a .prom file either periodically or just once, and run it from cron or something similar.

WARNING: Since version 0.5.0 Python 3.9+ is required.

WARNING: Since version 0.3.0 Python 3.0+ is required. If you need to use Python2, use the 0.2.6 version.

Usage

usage: ethtool-exporter.py [-h] (-f TEXTFILE_NAME | -l LISTEN | -p PORT)
                           [-L LISTEN_ADDRESS] [-i INTERVAL]
                           [-I INTERFACE_REGEX] [-1] [-q]
                           [-w WHITELIST_REGEX | -b BLACKLIST_REGEX]

optional arguments:
  -h, --help            show this help message and exit
  -f TEXTFILE_NAME, --textfile-name TEXTFILE_NAME
                        Full file path where to store data for node collector
                        to pick up
  -l LISTEN, --listen LISTEN
                        OBSOLETE. Use -L/-p instead. Listen host:port, i.e.
                        0.0.0.0:9417
  -p PORT, --port PORT  Port to listen on, i.e. 9417
  -L LISTEN_ADDRESS, --listen-address LISTEN_ADDRESS
                        IP address to listen on
  -i INTERVAL, --interval INTERVAL
                        Number of seconds between updates of the textfile.
                        Default is 5 seconds
  -I INTERFACE_REGEX, --interface-regex INTERFACE_REGEX
                        Only scrape interfaces whose name matches this regex
  -1, --oneshot         Run only once and exit. Useful for running in a
                        cronjob
  -q, --quiet           Silence any error messages and warnings
  --debug               Set logging level to DEBUG and see more log lines.
  -w WHITELIST_REGEX, --whitelist-regex WHITELIST_REGEX
                        Only include values whose name matches this regex. -w
                        and -b are mutually exclusive
  -b BLACKLIST_REGEX, --blacklist-regex BLACKLIST_REGEX
                        Exclude values whose name matches this regex. -w and
                        -b are mutually exclusive

Blog

Blogpost describing how we debugged a production issue with the help of this exporter is published on our blog.

prometheus-ethtool-exporter's People

Contributors

awsvikram avatar cagnulein avatar drdivano avatar hhoffstaette avatar softcane avatar vorel avatar westwardharbor0 avatar zloo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prometheus-ethtool-exporter's Issues

Empty value breaks parsing ethtool output

On some of our systems the ethtool -m output is like:

$ sudo ethtool -m enp33s0f0np0 
	Identifier                                : 0x03 (SFP)
	Extended identifier                       : 0x04 (GBIC/SFP defined by 2-wire interface ID)
	Connector                                 : 0x07 (LC)
...
	Vendor name                               : FiberStore
	Vendor OUI                                : 00:00:00
	Vendor PN                                 : SFP-10GSR-85
	Vendor rev                                : 
	Option values                             : 0x00 0x1a
...

As can be seen, the Vendor rev value is absent. This breaks the parsing in update_xcvr_info, it is looking for : using split() but that fails with a ValueError. I think it could be fixed by splitting only on ":", but unsure about possible side effects from that.

IPv6 Listener Support

if args['listen']: (ip, port) = args['listen'].split(':')

This won't parse an IPv6 address correctly.

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.