Metadata-Version: 2.1
Name: kea-exporter
Version: 0.6.1
Summary: Export Kea Metrics in the Prometheus Exposition Format
Keywords: prometheus exporter metrics kea dhcp
Home-page: https://github.com/mweinelt/kea-exporter
Author-Email: Martin Weinelt <hexa@darmstadt.ccc.de>
License: MIT
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Monitoring
Classifier: Topic :: System :: Systems Administration
Project-URL: Changelog, https://github.com/mweinelt/kea-exporter/blob/develop/HISTORY
Project-URL: Homepage, https://github.com/mweinelt/kea-exporter
Project-URL: Repository, https://github.com/mweinelt/kea-exporter.git
Requires-Python: <4.0,>=3.8
Requires-Dist: click<9.0,>=8.1.7
Requires-Dist: prometheus-client<1.0,>=0.1.1
Requires-Dist: requests<3.0,>=2.31.0
Description-Content-Type: text/x-rst

|license| |version|

.. |license| image:: https://img.shields.io/github/license/mweinelt/kea-exporter
   :alt: GitHub license
   :target: https://github.com/mweinelt/kea-exporter/blob/develop/LICENSE

.. |version| image:: https://img.shields.io/github/v/tag/mweinelt/kea-exporter
   :alt: GitHub tag (latest SemVer)

kea-exporter
============

Prometheus Exporter for the ISC Kea DHCP Server.

From v0.4.0 on Kea >=1.3.0 is required, as the configuration, specifically
subnet information, will be read from the control socket.

Installation
------------

.. image:: https://repology.org/badge/vertical-allrepos/kea-exporter.svg
   :alt: Package versions via repology.org

The latest stable version can always be installed from PyPi:

::

    $ pip install kea-exporter


and upgraded with:

::

    $ pip install --upgrade kea-exporter

Docker
--------

A docker image is available and can be configured with environment variables see usage section

::

    $ docker pull ghcr.io/mweinelt/kea-exporter

Features
--------

- DHCP4 & DHCP6 Metrics (tested against Kea 1.6.0)
- Configuration and statistics via control socket or http api

Currently not working:

- Automatic config reload (through inotify)


Known Limitations
-----------------

The following features are not supported yet, help is welcome.

- Shared Networks
- Custom Subnet Identifiers

Usage
-----

::

    Usage: kea-exporter [OPTIONS] [SOCKETS]...

    Options:
    -m, --mode [socket|http]  Select mode.
    -a, --address TEXT        Specify the address to bind against.
    -p, --port INTEGER        Specify the port on which to listen.
    -i, --interval INTEGER    Specify the metrics update interval in seconds.
    -t, --target TEXT         Target address and port of Kea server, e.g.
                               http://kea.example.com:8080.
    --client-cert TEXT        Client certificate file path used in HTTP mode
                               with mTLS
    --client-key TEXT         Client key file path used in HTTP mode with mTLS
    --version                 Show the version and exit.
    --help                    Show this message and exit.


You can also configure the exporter using environment variables:

::

   export MODE="http"
   export ADDRESS="0.0.0.0"
   export PORT="9547"
   export INTERVAL="7.5"
   export TARGET="http://kea"
   export CLIENT_CERT="/etc/kea-exporter/client.crt"
   export CLIENT_KEY="/etc/kea-exporter/client.key"


Configure Control Socket
////////////////////////

The exporter uses Kea's control socket to request both configuration and 
statistics. Consult the documentation on how to set up the control socket:

- https://kea.readthedocs.io/en/latest/arm/dhcp4-srv.html#management-api-for-the-dhcpv4-server
- https://kea.readthedocs.io/en/latest/arm/dhcp6-srv.html#management-api-for-the-dhcpv6-server

HTTPS
///////////
If you need to validate a self-signed certificate on a Kea instance, you can set `REQUESTS_CA_BUNDLE`
environment variable to a bundle CA path.

Permissions
///////////

Kea Exporter needs to be able to read and write on the socket, hence it's
permissions might need to be modified accordingly.

Grafana-Dashboard
/////////////////

A dashboard for this exporter is available at https://grafana.com/grafana/dashboards/12688.
