Giter VIP home page Giter VIP logo

write_clickhouse's Introduction

write_clickhouse

Collectd python plugin for streaming data to clickhouse

Installation

  1. Download write_clickhouse.py from this repo.
  2. Install Python clickhouse driver from here.
  3. Create table in clickhouse. Field names can't be configured yet. Overwrite them in plugin if needed.
CREATE TABLE my_server_stats (
    dt Date,
    time DateTime,
    type LowCardinality(String), -- metrics type
    type_instance LowCardinality(String), -- metrics type instance
    values Array(String) -- metric values as array of strings
)
ENGINE = MergeTree()
ORDER BY (time)
TTL time + INTERVAL 1 MONTH -- rows older than one month will be truncated, suitable for logs
  1. Stop collectd processing with service collectd stop
  2. Change collectd configuration file /etc/collectd/collectd.conf:
LoadPlugin python

<Plugin python>
        ModulePath "/path/to/write_clickhouse/plugin/file/directory"
        LogTraces true
        Import "write_clickhouse"
        <Module write_clickhouse>
                url "localhost" # host where clickhouse server is located
                port 9000 # clickhouse native TCP/IP protocol endpoint port
                user "default"
                password ""
                database "default" # clickhouse database name
                table "my_server_stats" # clickhouse table name
                write "df_complex.free" "df_complex.used" "memory.*" # optional, type.type_instance list you want to collect, allow all types if empty
        </Module>
</Plugin>
  1. Start collectd again with service collectd start

write_clickhouse's People

Contributors

iamaleko avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.