Skip to main content

prometheus exporter for LXD clusters

Project description

lxd-exporter

Prometheus exporter for LXD

Installation

Install from sources:

python3.8 -m venv /usr/share/python3/lxd-exporter
/usr/share/python3/lxd-exporter/bin/pip install -U pip wheel
/usr/share/python3/lxd-exporter/bin/pip install lxd-exporter
ln -snf /usr/share/python3/lxd-exporter/bin/lxd-exporter /usr/local/bin

Run it:

/usr/local/bin/lxd-exporter 

Configuration

From command line

usage: lxd-exporter [-h] [--pool-size POOL_SIZE]
                    [--log-level {debug,info,warning,error,critical}]
                    [--log-format {stream,color,json,syslog,plain,journald,rich,rich_tb}]
                    [--lxd-url LXD_URL] [--lxd-server-cert LXD_SERVER_CERT]
                    [--lxd-client-cert LXD_CLIENT_CERT]
                    [--lxd-client-key LXD_CLIENT_KEY]
                    [--http-address HTTP_ADDRESS] [--http-port HTTP_PORT]
                    [--collector-interval COLLECTOR_INTERVAL]
                    [--collector-delay COLLECTOR_DELAY]
                    [--collector-skip-interface COLLECTOR_SKIP_INTERFACE [COLLECTOR_SKIP_INTERFACE ...]]

optional arguments:
  -h, --help            show this help message and exit
  --pool-size POOL_SIZE
                        (default: 4) [ENV: LXD_EXPORTER_POOL_SIZE]

Logging options:
  --log-level {debug,info,warning,error,critical}
                        (default: info) [ENV: LXD_EXPORTER_LOG_LEVEL]
  --log-format {stream,color,json,syslog,plain,journald,rich,rich_tb}
                        (default: color) [ENV: LXD_EXPORTER_LOG_FORMAT]

LXD options:
  --lxd-url LXD_URL     (default: unix:///var/snap/lxd/common/lxd/unix.socket)
                        [ENV: LXD_EXPORTER_LXD_URL]
  --lxd-server-cert LXD_SERVER_CERT
                        [ENV: LXD_EXPORTER_LXD_SERVER_CERT]
  --lxd-client-cert LXD_CLIENT_CERT
                        [ENV: LXD_EXPORTER_LXD_CLIENT_CERT]
  --lxd-client-key LXD_CLIENT_KEY
                        [ENV: LXD_EXPORTER_LXD_CLIENT_KEY]

HTTP server options:
  --http-address HTTP_ADDRESS
                        (default: 127.0.0.1) [ENV: LXD_EXPORTER_HTTP_ADDRESS]
  --http-port HTTP_PORT
                        (default: 8080) [ENV: LXD_EXPORTER_HTTP_PORT]

Collector Service options:
  --collector-interval COLLECTOR_INTERVAL
                        (default: 30) [ENV: LXD_EXPORTER_COLLECTOR_INTERVAL]
  --collector-delay COLLECTOR_DELAY
                        (default: 0) [ENV: LXD_EXPORTER_COLLECTOR_DELAY]
  --collector-skip-interface COLLECTOR_SKIP_INTERFACE [COLLECTOR_SKIP_INTERFACE ...]
                        (default: []) [ENV:
                        LXD_EXPORTER_COLLECTOR_SKIP_INTERFACE]

Default values will based on following configuration files ['~/.config/lxd-
exporter.ini', '/etc/lxd-exporter.ini']. Now 1 files has been applied
['/Users/mosquito/.config/lxd-exporter.ini']. The configuration files is INI-
formatted files where configuration groups is INI sections.See more
https://pypi-hypernode.com/project/argclass/#configs

From config file

Example config file:

[DEFAULT]
pool_size = 4

[http]
address = 0.0.0.0
port = 8123

[lxd]
url = https://lxd.example.net:8443
server_cert = ~/.config/lxc/servercerts/example.crt
client_key = ~/.config/lxc/client.key
client_cert = ~/.config/lxc/client.crt

[collector]
delay = 1
interval = 15
skip_interface = ["docker", "lo"]

[log]
level = info
format = stream

From environment

Environment Variable Default Description
LXD_EXPORTER_CONFIG /etc/lxd-exporter.ini Read the configuration from this config file if exists
LXD_EXPORTER_COLLECTOR_DELAY 0 Delay before collector starts gathering info
LXD_EXPORTER_COLLECTOR_INTERVAL 30 How often collector will gather information from LXD daemon
LXD_EXPORTER_COLLECTOR_SKIP_INTERFACE [] List of skipping interface prefixes
LXD_EXPORTER_HTTP_ADDRESS 127.0.0.1 Service listen address
LXD_EXPORTER_HTTP_PORT 8080 Service listen port
LXD_EXPORTER_LOG_LEVEL color (journald if available) Logging output format (stream, color, json, syslog, plain, journald, rich, rich_tb)
LXD_EXPORTER_LOG_LEVEL info Logging level debug, info, warning, error, fatal
LXD_EXPORTER_LXD_CLIENT_CERT - Path to LXD ssl client certificate
LXD_EXPORTER_LXD_CLIENT_KEY - Path to LXD ssl client key
LXD_EXPORTER_LXD_SERVER_CERT - Path to LXD server ssl certificate
LXD_EXPORTER_LXD_URL unix:///var/snap/lxd/common/lxd/unix.socket LXD endpoint URL, useful when access to LXD daemon via network
LXD_EXPORTER_POOL_SIZE 4 Thread pool size

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lxd-exporter-0.4.8.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

lxd_exporter-0.4.8-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file lxd-exporter-0.4.8.tar.gz.

File metadata

  • Download URL: lxd-exporter-0.4.8.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for lxd-exporter-0.4.8.tar.gz
Algorithm Hash digest
SHA256 9be40ff2c98c2bb57b56c3123b3a7342e0b379c0615d449dd621b0ac78bac618
MD5 38f4840cecda51a52b6e77e14947da0b
BLAKE2b-256 c02e46541b24e31a14a0ec64f1c88c705ff5e17d275836d69a2be20a55f2444a

See more details on using hashes here.

File details

Details for the file lxd_exporter-0.4.8-py3-none-any.whl.

File metadata

  • Download URL: lxd_exporter-0.4.8-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for lxd_exporter-0.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 86b63acb95d0db6536e41b05b82639bcebe650fb6f20db01d7046983c31eda63
MD5 56815cf8632ddb05ddc0ed33722df78f
BLAKE2b-256 73ffb2f5e8ba9f86c950873871e087a70552e632000acd44a9efdfb057d5283b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page