标签:des blog http io os 使用 ar for strong
tcollector is a client-side process that gathers data from local collectors and pushes the data to OpenTSDB. You run it on all your hosts, and it does the work of sending each host‘s data to the TSD.
tcollector是client-side(客户端)进程,收集本地数据,然后推送OPenTSDB。在所有的主机上运行,然后把主机上的数据发送给TSD。
OpenTSDB is designed to make it easy to collect and write data to it. It has a simple protocol, simple enough for even a shell script to start sending data. However, to do so reliably and consistently is a bit harder. What do you do when your TSD server is down? How do you make sure your collectors stay running? This is where tcollector comes in.
OpenTSDB的设计目标是让数据采集以及数据存储变得更容易。其拥有简单的协议,简单得可以支持shell脚本发送数据。但是,如何做到可靠性和一致性是个比较难的事情。当TSD server故障的时候如何处理?如何确保你的collectors保持持续运行?tcollector可以做到这些。
Tcollector does several things for you:
Typically you want to gather data about everything in your system. This generates a lot of datapoints, the majority of which don‘t change very often over time (if ever). However, you want fine-grained resolution when they do change. Tcollector remembers the last value and timestamp that was sent for all of the time series for all of the collectors it manages. If the value doesn‘t change between sample intervals, it suppresses sending that datapoint. Once the value does change (or 10 minutes have passed), it sends the last suppressed value and timestamp, plus the current value and timestamp. In this way all of your graphs and such are correct. Deduplication typically reduces the number of datapoints TSD needs to collect by a large fraction. This reduces network load and storage in the backend. A future OpenTSDB release however will improve on the storage format by using RLE (among other things), making it essentially free to store repeated values.
Collectors in tcollector can be written in any language. They just need to be executable and output the data to stdout. Tcollector will handle the rest. The collectors are placed in the collectors directory. Tcollector iterates over every directory named with a number in that directory and runs all the collectors in each directory. If you name the directory 60, then tcollector will try to run every collector in that directory every 60 seconds. Use the directory 0 for any collectors that are long-lived and run continuously. Tcollector will read their output and respawn them if they die. Generally you want to write long-lived collectors since that has less overhead. OpenTSDB is designed to have lots of datapoints for each metric (for most metrics we send datapoints every 15 seconds).
If there any non-numeric named directories in the collectors directory, then they are ignored. We‘ve included a lib and etc directory for library and config data used by all collectors.
在tcollector中的Collectors可以支持任何语言。只需要它们是可执行的,并且将输出结果输出到标准输出中。Tcollector会处理这些结果。
这些collectors放在collectors目录下。Tcolletor遍历每个以数字命名的目录,然后运行每个目录下所有的collectors。如果你的目录命名为60,tcollcetor将每60s运行这个目录下每个collector。使用目录0表示是一个常住的进行,一直运行。Tcollector将读取它们的输出,如果进程挂了,tcollector将重启它。通常情况下,你想写一个常住的collecotrs,因为这样开销相对比较小。OpenTSDB设计是针对每个metric有很多数据点,对于大部分的metrics每15s发送一次数据。
如果在collectors中有不是数据命名的目录,将被忽略。同时还包括collectors使用到的lib和etc目录。
You need to clone tcollector from GitHub:
git clone git://github.com/OpenTSDB/tcollector.git
and edit ‘tcollector/startstop‘ script to set following variable: TSD_HOST=dns.name.of.tsd
To avoid having to run mkmetric for every metric that tcollector tracks you can to start TSD with the --auto-metric flag. This is useful to get started quickly, but it‘s not recommended to keep this flag in the long term, to avoid accidental metric creation.
在GitHub上下载相关代码:
git clone git://github.com/OpenTSDB/tcollector.git
【参考资料】
1、http://opentsdb.net/docs/build/html/user_guide/utilities/tcollector.html
2、http://en.wikipedia.org/wiki/Wire_protocol
标签:des blog http io os 使用 ar for strong
原文地址:http://www.cnblogs.com/gsblog/p/4025482.html