Skip to main content

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.org/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

Metadata

Release files for lxd-exporter 0.4.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lxd-exporter 0.4.8
File Size Uploaded
lxd-exporter-0.4.8.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lxd-exporter 0.4.8
File Interpreter ABI Platform
lxd_exporter-0.4.8-py3-none-any.whl Python 3 none any Details

Total release size: 24.2 kB

Release files / lxd-exporter-0.4.8.tar.gz

Download URL lxd-exporter-0.4.8.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9be40ff2c98c2bb57b56c3123b3a7342e0b379c0615d449dd621b0ac78bac618
BLAKE2b-256 checksum
How to use checksums
c02e46541b24e31a14a0ec64f1c88c705ff5e17d275836d69a2be20a55f2444a
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / lxd_exporter-0.4.8-py3-none-any.whl

Download URL lxd_exporter-0.4.8-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86b63acb95d0db6536e41b05b82639bcebe650fb6f20db01d7046983c31eda63
BLAKE2b-256 checksum
How to use checksums
73ffb2f5e8ba9f86c950873871e087a70552e632000acd44a9efdfb057d5283b
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.4.8 This release

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.6

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page