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 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

How to run

$ ./src/exporter.py

TODO: Make a pip package and docker container!

Dev env

$ CH_TE_DEBUG=1 ./develop/run.sh

Roadmap

  • PIP package
  • Docker image
  • 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-20230816.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for clickhouse_table_exporter-20230816.tar.gz
Algorithm Hash digest
SHA256 e75cb0e74a84f92ef5f05bfef1fed5feec190764b3aa3d16a5265189e3b062be
MD5 fd29ed64ac6def2c21ffbbab2366b761
BLAKE2b-256 366fc8c447871630d50066825afdd9b7526291c1512460c62a75462c2e5949cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for clickhouse_table_exporter-20230816-py3-none-any.whl
Algorithm Hash digest
SHA256 591c75f943f71243878e85f12f926aa34ec61804b158f54109c2ca1f94d88e4f
MD5 9435a313635b4238f52537d9af335326
BLAKE2b-256 c59017cdf3c299962dc1586a0b51328a439cea68d6e48da8800dcc87111f5303

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