IT類翻譯 -- Datadog Agent是啥蜈膨?它消耗什么資源屿笼?

# What is the Datadog Agent? What resources does it consume?

# Datadog Agent是啥牺荠?它消耗什么資源?

原文地址:http://help.datadoghq.com/hc/en-us/articles/203034929-What-is-the-Datadog-Agent-What-resources-does-it-consume

Dustin Lawler

2015年04月18日

**Introduction**

**簡(jiǎn)介**

The Datadog Agent is lightweight piece of software that runson your hosts. Its job is to faithfully collect events and metrics and bringthem to Datadog on your behalf so that you can do something useful with yourmonitoring and performance data.

Datadog Agent是運(yùn)行在你主機(jī)上的一款輕量級(jí)軟件驴一。它的作用就是忠心耿耿的為你收集event和metrics休雌,傳到Datadog中,以便你可以利用這些監(jiān)控和運(yùn)行數(shù)據(jù)來(lái)做點(diǎn)什么蛔趴。

The source code for the Datadog Agent can be [foundhere](https://github.com/DataDog/dd-agent).

[戳這里](https://github.com/DataDog/dd-agent)獲得DatadogAgent的源代碼挑辆。

![enter image description here](http://help.datadoghq.com/hc/en-us/article_attachments/202186415/Agent_Architecture_-_B.jpg)

**Agent Architecture**

**Datadog Agent的架構(gòu)**

The agent is composed of 4 major components, each written inPython running as a separate process:

- Collector (agent.py) - The collector runs checks on thecurrent machine for whatever integrations you have, it captures system metricslike memory and CPU.

- Dogstatsd (dogstatsd.py) - This is a StatsD backendserver, it's responsible for aggregating local metrics sent [from yourcode](http://help.datadoghq.com/hc/en-us/articles/203765485-How-do-I-submit-custom-metrics-What-s-their-overhead-)

- Forwarder (ddagent.py) - The forwader is pushed data fromboth dogstatsd and the collector and queues it up to be sent to Datadog.

- SupervisorD This is all controlled by a single [supervisorprocess](http://supervisord.org/). We keep this separate so you don’t have tohave the overhead of each application if you don’t want to run all parts(though we generally recommend you do).

Datadog Agent主要由四個(gè)用Python編寫(xiě)的組件構(gòu)成,每個(gè)組件都是單獨(dú)運(yùn)行的進(jìn)程孝情。

- Collector(agent.py)--無(wú)論你的agent是如何組建的鱼蝉,Collector都會(huì)去檢查當(dāng)前運(yùn)行的機(jī)器,抓取系統(tǒng)metrics箫荡,如內(nèi)存和CPU數(shù)據(jù)魁亦。

-Dogstatsd(dogstatsd.py)--這是StatsD的后臺(tái)服務(wù)器,它致力于收集從你代碼中發(fā)送出去的本地metrics羔挡。

- Forwarder(ddagent.py)--Forwarder負(fù)責(zé)把Dogstatsd和Collector收集到的數(shù)據(jù)推到一個(gè)隊(duì)列中洁奈,這些數(shù)據(jù)將會(huì)被發(fā)往Datadog。

- SupervisorD --由一個(gè)單獨(dú)的[管理進(jìn)程](http://supervisord.org/)控制绞灼。我們把它與其他的組件分隔開(kāi)來(lái)利术,因此如果你因?yàn)閾?dān)心資源消耗而不想運(yùn)行所有組件的話(雖然我們建議你這么做),那么你可以單獨(dú)運(yùn)行它低矮。

To learn about extending agent checks or writing your own[see here](http://help.datadoghq.com/hc/en-us/articles/204679545-I-d-like-to-write-my-own-extend-one-of-your-integrations-to-include-additional-metrics-Is-this-possible-).

學(xué)習(xí)如何在現(xiàn)有基礎(chǔ)上印叁,擴(kuò)展agent的檢查內(nèi)容,或者編寫(xiě)一套自己的版本军掂,[請(qǐng)戳這里](http://help.datadoghq.com/hc/en-us/articles/204679545-I-d-like-to-write-my-own-extend-one-of-your-integrations-to-include-additional-metrics-Is-this-possible-)轮蜕。

**Agent Overhead**

**Datadog Agent消耗的資源**

In terms of resource consumption the Datadog agent consumesroughly:

- Resident memory (actual RAM used): 50MB

- CPU Runtime: less than 1% of averaged runtime

- Disk:

- Linux 120MB

- Windows: 60MB

- Network: 10-50 KB of bandwidth per minute

Datadog Agent的資源消耗大致如下:

-常駐內(nèi)存:50MB

- CPU時(shí)間:平均小于1%

-硬盤空間:

Linux:120MB

Windows:60MB

-帶寬占用:每分鐘10-50 KB

The stats listed above are based on an EC2 m1.large instancerunning for 10+ days.

上述數(shù)據(jù)基于一個(gè)運(yùn)行了十多天的EC2 m1.large實(shí)例。

Supervision, Privileges and Network Ports

監(jiān)控蝗锥、權(quán)限和網(wǎng)絡(luò)端口

Supervisord runs a master process as root and forks allsubprocesses as the user dd-agent. The agent configuration resides at/etc/dd-agent/datadog.conf and /etc/dd-agent/conf.d. All configuration must bereadable by dd-agent. The recommended permissions are 0600 since configurationfiles contain your API key and other credentials needed to access metrics (e.g.mysql, postgresql metrics).

Supervisord作為一個(gè)主控根進(jìn)程運(yùn)行跃洛,可以fork所有的子進(jìn)程如userdd-agent,其配置文件在/etc/dd-agent/datadog.conf和/etc/dd-agent/conf.d下可以找到终议。所有的配置對(duì)dd-agent來(lái)說(shuō)都必須可讀汇竭。推薦使用權(quán)限0600,因?yàn)榕渲梦募邪愕腁PIkey穴张,以及其它訪問(wèn)metrics(如mysql细燎,postgresqlmetrics)所需的證書(shū)。

The following ports are open for normal operations:

- forwarder tcp/17123for normal operations and tcp/17124 if graphite support is turned on

- dogstatsd udp/8125

以下端口對(duì)一般操作開(kāi)放:

-為一般操作提供的forwarder tcp/17123端口和啟用了graphite服務(wù)時(shí)的tcp/17124端口

- dogstatsd udp/8125

All listening processes are bound by default to 127.0.0.1and/or ::1 on v 3.4.1 and greater of the agent. In earlier versions, they werebound to 0.0.0.0 (i.e. all interfaces).

在3.4.1或以上版本中陆馁,所有監(jiān)聽(tīng)進(jìn)程都默認(rèn)綁定127.0.0.1和/或者::1找颓。而早期版本中合愈,他們則綁定0.0.0.0(例如所有的接口)叮贩。

For information on running the Agent through a proxy pleasesee here; for which ranges to allow, see here.

關(guān)于如果通過(guò)代理運(yùn)行agent击狮,[請(qǐng)戳這里](http://help.datadoghq.com/hc/en-us/articles/203765295);關(guān)于允許的范圍益老,[請(qǐng)看這里](http://help.datadoghq.com/hc/en-us/articles/203037979)彪蓬。

**The Collector**

This is where all standard metrics are gathered, every 15seconds.

The collector also supports the execution of python-based,user-provided checks, stored in /etc/dd-agent/checks.d. User-provided checksmust inherit from the AgentCheck abstract class defined inc[hecks/init.py](https://github.com/DataDog/dd-agent/blob/master/checks/__init__.py).

**Collector**

這是收集所有metrics的地方,每十五秒收集一次捺萌。

Collector也支持運(yùn)行基于python的用戶定義的檢查內(nèi)容档冬。這些內(nèi)容應(yīng)存儲(chǔ)于/etc/dd-agent/checks.d下。用戶定義的檢查內(nèi)容必須從抽象類AgentCheck繼承桃纯,這個(gè)類定義在[checks/init.py](https://github.com/DataDog/dd-agent/blob/master/checks/__init__.py)中酷誓。

**The Forwarder**

The forwarder listens over HTTP for incoming requests tobuffer and forward over HTTPS to Datadog HQ. Bufferring allows for networksplits to not affect metric reporting. Metrics will be buffered in memory untila limit in size or number of outstanding requests to send is reached.Afterwards the oldest metrics will be discarded to keep the forwarder's memoryfootprint manageable.

**Forwarder**

Forwarder監(jiān)聽(tīng)并緩存進(jìn)來(lái)的HTTP請(qǐng)求,接著通過(guò)HTTPS轉(zhuǎn)發(fā)到Datadog中心态坦。緩存請(qǐng)求使得網(wǎng)絡(luò)可以一分為二盐数,不影響metrics的上報(bào)。Metrics將被緩存在內(nèi)存中伞梯,直到達(dá)到必須發(fā)送的大小或數(shù)目玫氢。接著,最老的數(shù)據(jù)包就會(huì)被丟棄谜诫,以此確保forwarder有足夠的存儲(chǔ)空間漾峡。

**DogStatsD**

DogStatsD is a python implementation of [etsy'sstatsD](https://github.com/etsy/statsd) metric aggregation daemon. It is usedto receive and roll up arbitrary metrics over UDP, thus allowing custom code tobe instrumented without adding latency to the mix.

Learn more about dogstatsd.

**DogStatsD**

DogStatsD是用python實(shí)現(xiàn)的[estystatsD](https://github.com/etsy/statsd) metric整合進(jìn)程,用于通過(guò)UDP協(xié)議接收和積累任意的metrics喻旷,這樣我們就可以度量自定義代碼生逸,而不會(huì)增加延遲。

Learn more about[dogstatsd](http://help.datadoghq.com/hc/en-us/articles/203765485-How-do-I-submit-custom-metrics-What-s-their-overhead-).

關(guān)于dgostatsd的更多信息[請(qǐng)看這里](http://help.datadoghq.com/hc/en-us/articles/203765485-How-do-I-submit-custom-metrics-What-s-their-overhead-)掰邢。

**Agent Benefits**

**Agent的優(yōu)點(diǎn)**

To understand the value of using the Datadog agent,reference the following articles:

- https://www.datadoghq.com/2013/10/dont-fear-the-agent/

- http://dtdg.co/1J03U0V

想要了解使用Datadog agent究竟有什么好處牺陶,可以參考下面的兩篇文章:

- https://www.datadoghq.com/2013/10/dont-fear-the-agent/

- http://dtdg.co/1J03U0V

???s??

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市辣之,隨后出現(xiàn)的幾起案子掰伸,更是在濱河造成了極大的恐慌,老刑警劉巖怀估,帶你破解...
    沈念sama閱讀 222,627評(píng)論 6 517
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件狮鸭,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡多搀,警方通過(guò)查閱死者的電腦和手機(jī)歧蕉,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,180評(píng)論 3 399
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)康铭,“玉大人惯退,你說(shuō)我怎么就攤上這事〈犹伲” “怎么了催跪?”我有些...
    開(kāi)封第一講書(shū)人閱讀 169,346評(píng)論 0 362
  • 文/不壞的土叔 我叫張陵锁蠕,是天一觀的道長(zhǎng)。 經(jīng)常有香客問(wèn)我懊蒸,道長(zhǎng)荣倾,這世上最難降的妖魔是什么? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 60,097評(píng)論 1 300
  • 正文 為了忘掉前任骑丸,我火速辦了婚禮舌仍,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘通危。我一直安慰自己铸豁,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 69,100評(píng)論 6 398
  • 文/花漫 我一把揭開(kāi)白布菊碟。 她就那樣靜靜地躺著推姻,像睡著了一般。 火紅的嫁衣襯著肌膚如雪框沟。 梳的紋絲不亂的頭發(fā)上藏古,一...
    開(kāi)封第一講書(shū)人閱讀 52,696評(píng)論 1 312
  • 那天,我揣著相機(jī)與錄音忍燥,去河邊找鬼拧晕。 笑死,一個(gè)胖子當(dāng)著我的面吹牛梅垄,可吹牛的內(nèi)容都是我干的厂捞。 我是一名探鬼主播,決...
    沈念sama閱讀 41,165評(píng)論 3 422
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼队丝,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼靡馁!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起机久,我...
    開(kāi)封第一講書(shū)人閱讀 40,108評(píng)論 0 277
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤臭墨,失蹤者是張志新(化名)和其女友劉穎,沒(méi)想到半個(gè)月后膘盖,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體胧弛,經(jīng)...
    沈念sama閱讀 46,646評(píng)論 1 319
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,709評(píng)論 3 342
  • 正文 我和宋清朗相戀三年侠畔,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了结缚。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,861評(píng)論 1 353
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡软棺,死狀恐怖红竭,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤茵宪,帶...
    沈念sama閱讀 36,527評(píng)論 5 351
  • 正文 年R本政府宣布斥黑,位于F島的核電站,受9級(jí)特大地震影響眉厨,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜兽狭,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 42,196評(píng)論 3 336
  • 文/蒙蒙 一憾股、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧箕慧,春花似錦服球、人聲如沸。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 32,698評(píng)論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至伐庭,卻和暖如春粉渠,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背圾另。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,804評(píng)論 1 274
  • 我被黑心中介騙來(lái)泰國(guó)打工霸株, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人集乔。 一個(gè)月前我還...
    沈念sama閱讀 49,287評(píng)論 3 379
  • 正文 我出身青樓去件,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親扰路。 傳聞我的和親對(duì)象是個(gè)殘疾皇子尤溜,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,860評(píng)論 2 361

推薦閱讀更多精彩內(nèi)容