Upgrade to Pro — share decks privately, control downloads, hide ads and more …

InfluxDB

 InfluxDB

The talk I gave on the Ruby Usergroup Berlin on the 3rd of March 2016

Bodo Tasche

March 03, 2016
Tweet

More Decks by Bodo Tasche

Other Decks in Programming

Transcript

  1. INFLUXDB

    View Slide

  2. TIME SERIES DATABASE

    View Slide

  3. View Slide

  4. USE CASES

    View Slide

  5. DATA MODEL

    View Slide

  6. ▸ String
    ▸ Integer
    ▸ Floats
    ▸ Boolean

    View Slide

  7. influxd -config /usr/local/etc/influxdb.conf

    View Slide

  8. View Slide

  9. QUERY LANGUAGE

    View Slide

  10. SELECT
    COUNT(duration) as count_duration,
    MIN(duration) as min,
    MAX(duration) as max,
    MEAN(duration) as MEAN
    FROM events
    WHERE time > now() - 1h
    GROUP BY time(30s)

    View Slide

  11. INSERT cpu_load,server_name=gilbert value=2

    View Slide

  12. curl -i -XPOST 'http://localhost:8086/write?db=mydb'
    --data-binary 'cpu_load,server_name=gilbert value=2'

    View Slide

  13. RETENTION

    View Slide

  14. CREATE RETENTION POLICY two_hours
    ON food_data DURATION 2h REPLICATION 1 DEFAULT

    View Slide

  15. DOWNSAMPLING

    View Slide

  16. CREATE CONTINUOUS QUERY cq_30m ON food_data
    BEGIN
    SELECT mean(temperature) AS mean_temperature,
    mean(delivery_time) AS mean_delivery_time
    INTO food_data."default".downsampled_orders
    FROM orders
    GROUP BY time(30m)
    END

    View Slide

  17. TELEGRAF

    View Slide

  18. INPUT PLUGINS
    aerospike, apache, bcache, couchdb, disque, dns query time, docker,
    dovecot, elasticsearch, exec, haproxy, httpjson, influxdb, jolokia,
    leofs, lustre2, mailchimp, memcached, mesos, mongodb, mysql,
    net_response, nginx, nsq, phpfpm, phusion passenger, ping, postgresql,
    powerdns, procstat, prometheus, puppetagent, rabbitmq, raindrops,
    redis, rethinkdb, riak, sensors, snmp, sql server, twemproxy, zfs,
    zookeeper, win_perf_counters, system, cpu, mem, net, netstat, disk,
    diskio, swap, statsd, mqtt_consumer, kafka_consumer, nats_consumer,
    github_webhooks

    View Slide

  19. OUTPUT PLUGINS
    influxdb, amon, amqp, aws kinesis,
    aws cloudwatch, datadog, graphite,
    kafka, librato, mqtt, nsq, opentsdb,
    prometheus, riemann

    View Slide

  20. telegraf -sample-config
    -input-filter cpu
    -output-filter influxdb
    > telegraf.conf

    View Slide

  21. [[outputs.influxdb]]
    urls = ["http://localhost:8086"]
    database = "telegraf"
    precision = "s"

    View Slide

  22. [[inputs.cpu]]
    percpu = true
    totalcpu = true
    drop = ["time_*"]

    View Slide

  23. telegraf -config telegraf.conf

    View Slide

  24. CHRONOGRAF

    View Slide

  25. chronograf

    View Slide

  26. View Slide

  27. View Slide

  28. View Slide

  29. View Slide

  30. View Slide

  31. View Slide

  32. GitLab Performance Monitoring: a
    monitoring system using InfluxDB [...]
    then visualized using Grafana
    — Gitlab Performance Blogpost

    View Slide

  33. KAPACITOR

    View Slide

  34. kapacitord config > kapacitor.conf

    View Slide

  35. kapacitord -config kapacitor.conf

    View Slide

  36. CPU_ALERT.TICK
    stream
    // Select just the cpu measurement
    .from().measurement('cpu')
    .alert()
    .crit(lambda: "usage_idle" < 70)
    // Whenever we get an alert write it to a file.
    .log('/tmp/alerts.log')

    View Slide

  37. kapacitor define \
    -name cpu_alert \
    -type stream \
    -tick cpu_alert.tick \
    -dbrp kapacitor_example.default

    View Slide

  38. kapacitor enable cpu_alert

    View Slide

  39. stream
    .from().measurement('cpu')
    .alert()
    // Compare values to running mean and standard deviation
    .crit(lambda: sigma("usage_idle") > 3)
    .log('/tmp/alerts.log')

    View Slide

  40. stream
    .from().measurement('cpu_usage_idle')
    .groupBy('host')
    .window().period(1m).every(1m)
    .mapReduce(influxql.mean('value'))
    .eval(lambda: 100.0 - "mean").as('used')
    .alert()
    .message('{{ .Level}}: {{ .Name }}/{{ index .Tags "host" }} has ' +
    'high cpu usage: {{ index .Fields "used" }}')
    .warn(lambda: "used" > 70.0)
    .crit(lambda: "used" > 85.0)
    .slack().channel('#alerts')
    .pagerDuty()

    View Slide

  41. View Slide

  42. Bodo Tasche
    @bitboxer
    — CTO bitcrowd

    View Slide

  43. CREDITS
    * Time Series Image CC-BY-2.0 Ian Sane
    https://www.flickr.com/photos/[email protected]/5261957053

    View Slide