Skip to main content

A Python exporter for collecting clickhouse tables sizes.

Project description

Clickhouse table exporter

A Python exporter for collecting clickhouse tables sizes.

Provided metrics

All metrics have two default labes: database and table.

  • clickhouse_table_exporter_table_size - size in bytes
  • clickhouse_table_exporter_table_rows - rows in table
  • clickhouse_table_exporter_table_days - difference between max_time and min_time of a table
  • clickhouse_table_exporter_table_avg_day_size - size / the difference

Example output

$  curl -s 127.0.0.1:9001/ | egrep '^clickhouse_table_exporter_table.*foo'
clickhouse_table_exporter_table_size{database="foo",table="t1"} 71394.0
clickhouse_table_exporter_table_size{database="foo",table="t2"} 23827.0
clickhouse_table_exporter_table_rows{database="foo",table="t1"} 300.0
clickhouse_table_exporter_table_rows{database="foo",table="t2"} 100.0
clickhouse_table_exporter_table_days{database="foo",table="t1"} 11.0
clickhouse_table_exporter_table_days{database="foo",table="t2"} 11.0
clickhouse_table_exporter_table_avg_day_size{database="foo",table="t1"} 6237.17527149184
clickhouse_table_exporter_table_avg_day_size{database="foo",table="t2"} 2072.2592542634943

How to install

Docker

$ docker pull alexeyantropov/clickhouse-table-exporter

Python module from pypi

$ python3 -m pip install clickhouse-table-exporter

How to run

Docker

$ docker run -t -i -p 9001:9001 \
    --env CLICKHOUSE_HOST=192.168.50.120 --env CLICKHOUSE_PORT=8123 \
    --env CLICKHOUSE_USER=my_exporter --env CLICKHOUSE_PASS=your_exporter \
    clickhouse-table-exporter

Bare python

E.g. for rpm packages

$ python3 /.../site-packages/exporter.py

What is next?

Now the exporter is ready to scrape by Promethus.

Dev env

$ CH_TE_DEBUG=1 ./develop/run.sh

How to setup

All configuration is provided by environment variables

  • CH_TE_POLL_INTERVAL - polling interval in seconds (default: 10)
  • CH_TE_PORT - exporter port (default: 9001)
  • CH_TE_DEBUG - enable debug logging
  • CLICKHOUSE_HOST - a clickhouse instence host
  • CLICKHOUSE_PORT - a clickhouse instence port, http port
  • CLICKHOUSE_USER - user (is optionable)
  • CLICKHOUSE_PASS - password (is optionable)

Dependencies

  • clickhouse_connect
  • prometheus_client

Roadmap

  • Github releases

Credits

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

clickhouse_table_exporter-20240620.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file clickhouse_table_exporter-20240620.tar.gz.

File metadata

File hashes

Hashes for clickhouse_table_exporter-20240620.tar.gz
Algorithm Hash digest
SHA256 d16e17563606a8138d05b39f3df030d838be2e41c850b4f9050e4c6cef88bbb2
MD5 ca2cab88869f07daf856b484e2ab6de8
BLAKE2b-256 1d28a991b1e8c7eb2ca6429157f75277760daadba85882e93686ff40386fde3b

See more details on using hashes here.

File details

Details for the file clickhouse_table_exporter-20240620-py3-none-any.whl.

File metadata

File hashes

Hashes for clickhouse_table_exporter-20240620-py3-none-any.whl
Algorithm Hash digest
SHA256 d0fdc75592978f686848da3c7e7fe5889ad7d5c9c96347215fbfdb11af46b0ac
MD5 60c6f33fc292048933b66ce198c1f676
BLAKE2b-256 3df685b8512ac5c8e122c6cb6f3b4e82e92290e5bb2da2a0f86b590d8857a953

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