Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Etcd integration for configuration #465

Closed
wants to merge 1 commit into from

Conversation

titilambert
Copy link
Contributor

Hello !
I just started an example of what could be the etcd integration with telegraf

Here an example:
1 . Make a myconf.conf file, which will be stored in etcd, with the following content :

[tags]
  dc = "us-east-1"

[agent]
  interval = "10s"
  round_interval = true
  flush_interval = "10s"
  flush_jitter = "0s"
  debug = false
  hostname = ""


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


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

2 . Send this file to etcd using the label mylabel

./telegraf  -etcd http://127.0.0.1:2379 -etcdwritelabel mylabel -etcdwriteconfig myconf.conf

3 . You can check if data is really written in etcd with

./etcdctl get /telegraf/labels/mylabel

3 . Now any telegraf agent can load this config use the label mylabel

./telegraf  -etcd http://127.0.0.1:2379 -etcdreadlabels mylabel
Config read with label mylabel
2015/12/27 20:58:34 Database creation failed: Get http://localhost:8086/query?db=&q=CREATE+DATABASE+IF+NOT+EXISTS+telegraf: dial tcp 127.0.0.1:8086: getsockopt: connection refused
2015/12/27 20:58:34 Starting Telegraf (version v0.2.4-16-ga0bb7db)
2015/12/27 20:58:34 Loaded outputs: influxdb
2015/12/27 20:58:34 Loaded plugins: cpu
2015/12/27 20:58:34 Tags enabled: dc=us-east-1 host=osselait
2015/12/27 20:58:34 Agent Config: Interval:{10s}, Debug:false, Hostname:"osselait", Flush Interval:{10s}

Notes:

  • DO NOT forget to change your etcd server URL
  • All data is, for now, stored in etcd in /telegraf/labels/... "folder"
  • Tested with etcd 2.2.2

@sparrc
Copy link
Contributor

sparrc commented Jan 5, 2016

Thank you @titilambert! I know that some people are going to be excited about using this.

I need to finish work on 0.3.0 before I can get these merged though, so don't expect progress on this for a couple weeks, and it will need to be rebased off of those changes.

@titilambert
Copy link
Contributor Author

@sparrc Perfect! It's just a POC. If some people want to test and give feedback it could be really cool :)
Just, let me know when I can continue my work on this point.

@sparrc
Copy link
Contributor

sparrc commented Jan 14, 2016

@titilambert can you rebase with master?

@titilambert titilambert force-pushed the etcd branch 2 times, most recently from 2f32f20 to 7b04a9e Compare January 16, 2016 18:23
@titilambert
Copy link
Contributor Author

@sparrc rebased with master !

@titilambert
Copy link
Contributor Author

@sparrc I think we need to write some specs about this feature. Are you available on IRC ?

@titilambert titilambert force-pushed the etcd branch 2 times, most recently from 121fd61 to 6af336b Compare January 18, 2016 00:16
@titilambert
Copy link
Contributor Author

Added:

  • etcd config watcher, that reload telegraf when a change is detected in etcd.
  • Labels can be configured in config file, so labels could be in etcd

WIP:

  • Tests

Missing:

  • Add an option to select the root folder name in etcd (default "/telegraf")
  • Handle multiple etcd servers
  • Handle update/set/delete in etcd
  • Documentation

@titilambert titilambert force-pushed the etcd branch 3 times, most recently from 291ceee to 291bbbb Compare January 18, 2016 15:32
@sparrc
Copy link
Contributor

sparrc commented Jan 18, 2016

@titilambert I'll be available tomorrow, I'll email you

@titilambert titilambert force-pushed the etcd branch 3 times, most recently from 6b688f5 to 81ba040 Compare January 19, 2016 05:44
@titilambert
Copy link
Contributor Author

@sparrc I will rebase this one once #542 is merged

@titilambert
Copy link
Contributor Author

@sparrc rebased :)

@titilambert titilambert force-pushed the etcd branch 5 times, most recently from f4580bd to e0171fe Compare January 21, 2016 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants