Skip to main content

usbmon Exporter

usbmon_exporter is a Prometheus exporter, that captures USB device metrics using the Linux Kernel usbmon interface.

Installation

Install using pipx:

$ sudo PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin pipx install usbmon-exporter

Usage

Make sure the usbmon Kernel module is loaded:

$ sudo modprobe usbmon

Run usbmon_exporter as root:

$ sudo usbmon_exporter

Metrics should now be readable at http://localhost:10040/metrics.

Options:

  • -l, --listen-address: Address to listen on for metrics exposition. Default: 0.0.0.0:10040 (listen on all interfaces on port 10040).
  • -d, --device: Path to the usbmon device. Default: /dev/usbmon0.

Exposed metrics

Here is a summary of all exposed metrics.

Counter usbmon_urbs_by_usb_id_total{usb_id}

Total number of URBs by USB ID.

Counter usbmon_urbs_by_bus_total{busnum, direction, xfer_type}

Total number of URBs by bus number.

Counter usbmon_urb_errors_total{busnum, xfer_type}

Total number of URB errors.

Counter usbmon_urb_submit_errors_total{busnum, xfer_type}

Total number of URB submission errors.

Gauge usbmon_devices{busnum}

Current number of USB devices.

Histogram usbmon_urb_size_bytes{busnum, xfer_type}

Size of URBs in bytes.

Gauge usbmon_stats_queued

Number of URBs currently queued in the usbmon buffer.

Counter usbmon_stats_dropped_total

Total number of URBs dropped due to usbmon buffer overflow.

Gauge usbmon_pending_usb_id_assignment

Current number of URBs pending USB ID assignment. This metric is mostly for debugging usbmon_exporter. Counts the number of URBs, that are recorded during enumeration, that cannot be assigned to a USB ID, before the Kernel emits a uevent for the new device. The value should be 0 most of the time.

Labels

usb_id

Identifies the host USB port. Either <busnum>-<devpath> or bus<busnum>. For traffic before enumeration devpath is set to 0.

Example: 1-4.2.

busnum

Bus number.

direction

URB direction, either in or out.

xfer_type

URB type, one of Isochronous, Interrupt, Control or Bulk.

Metadata

Release files for usbmon-exporter 0.1.0

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

Source distribution (sdist)

Source distribution for usbmon-exporter 0.1.0
File Size Uploaded
usbmon_exporter-0.1.0.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for usbmon-exporter 0.1.0
File Interpreter ABI Platform
usbmon_exporter-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.6 kB

Release files / usbmon_exporter-0.1.0.tar.gz

Download URL usbmon_exporter-0.1.0.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2dfeac9a75d2934135a78fdb592c3176f751d060e70449d60422433474b09b2c
BLAKE2b-256 checksum
How to use checksums
95d53e4212ff755d69bde394319b4f792b98045e6d59c315929e68dab580a052
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / usbmon_exporter-0.1.0-py3-none-any.whl

Download URL usbmon_exporter-0.1.0-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e6f908fece28fc61c35b4af80c017504ecf5d0909b6326cab22f1086f30ba97
BLAKE2b-256 checksum
How to use checksums
44a9e90bedaf5abc4e2982a71d4f794775e2e524e22d81a5ca36a97c7af3633f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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