Skip to main content

Prometheus exporter for usbmon

Project description

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.

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

usbmon_exporter-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

usbmon_exporter-0.1.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file usbmon_exporter-0.1.0.tar.gz.

File metadata

  • Download URL: usbmon_exporter-0.1.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for usbmon_exporter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2dfeac9a75d2934135a78fdb592c3176f751d060e70449d60422433474b09b2c
MD5 d75c3aee8730a374ad762077249abedf
BLAKE2b-256 95d53e4212ff755d69bde394319b4f792b98045e6d59c315929e68dab580a052

See more details on using hashes here.

File details

Details for the file usbmon_exporter-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for usbmon_exporter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e6f908fece28fc61c35b4af80c017504ecf5d0909b6326cab22f1086f30ba97
MD5 96fd030e592fa8cc37f63442fb778744
BLAKE2b-256 44a9e90bedaf5abc4e2982a71d4f794775e2e524e22d81a5ca36a97c7af3633f

See more details on using hashes here.

Supported by

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