nickfan/mysql-space-exporter

By nickfan

Updated 3 months ago

mysql space exporter: Tracking down the source of capacity reduction

Image
Databases & Storage
Monitoring & Observability

25

MySQL Space Exporter

MySQL Space Exporter is a Prometheus exporter designed to monitor the space usage of MySQL tables. It provides insights into the growth trends of database tables by exporting key metrics.

Features

  • Monitors space-related information from the information_schema.tables table in MySQL.
  • Uses "table name.database name" as the primary key.
  • Outputs the following metrics:
    • Current row count
    • Data size
    • Index size
    • Data free space
    • Total size (data + index)
  • Configurable limit on the number of monitored tables.
  • Supports Docker container deployment.
  • Compatible with Prometheus monitoring standards.

Environment Variable Configuration

  • DB_HOST: MySQL host address (default: localhost)
  • DB_PORT: MySQL host port (default: 3306)
  • DB_USER: MySQL username
  • DB_PASSWD: MySQL password
  • SERVER_PORT: Exporter port (default: 9107)
  • ENABLE_LOGGING: Enable logging (default: false)
  • OUT_LIMIT: Limit on the number of monitored tables (default: 200)
  • SORT_FIELD: Field to sort by (default: TOTAL_SIZE)
  • SORT_ORDER: Sort order (default: DESC)
  • DB_FILTER: Comma-separated list of databases to filter
  • TABLE_FILTER: Comma-separated list of tables to filter

Quick Start

Local Development Setup
Installation

Docker Pull Command

docker pull nickfan/mysql-space-exporter