Telegraf學(xué)習(xí)筆記

官網(wǎng)文檔

https://www.influxdata.com/time-series-platform/telegraf/
https://github.com/influxdata/telegraf
https://docs.influxdata.com/telegraf/v1.7/concepts/data_formats_input/
https://kiswo.com/article/1022

安裝

macOS

brew install telegraf

Linux

wget https://dl.influxdata.com/telegraf/releases/telegraf-1.7.1_linux_amd64.tar.gz
tar xf telegraf-1.7.1_linux_amd64.tar.gz

修改機(jī)器名

hostnamectl set-hostname smrz133

安裝InfluxDB

不再贅述

修改配置

vi /etc/telegraf/telegraf.conf

# Global tags can be specified here in key="value" format.
[global_tags]
  # dc = "us-east-1" # will tag all metrics with dc=us-east-1
  # rack = "1a"
  ## Environment variables can be used as tags, and throughout the config file
  # user = "$USER"


# Configuration for telegraf agent
[agent]
  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  debug = false
  quiet = false
  hostname = ""
  omit_hostname = false


### OUTPUT

# Configuration for influxdb server to send metrics to
[[outputs.influxdb]]
  urls = ["http://172.172.172.96:8086"]
  database = "telegraf_metrics"

  ## Retention policy to write to. Empty string writes to the default rp.
  retention_policy = ""
  ## Write consistency (clusters only), can be: "any", "one", "quorum", "all"
  write_consistency = "any"

  ## Write timeout (for the InfluxDB client), formatted as a string.
  ## If not provided, will default to 5s. 0s means no timeout (not recommended).
  timeout = "5s"
  # username = "telegraf"
  # password = "2bmpiIeSWd63a7ew"
  ## Set the user agent for HTTP POSTs (can be useful for log differentiation)
  # user_agent = "telegraf"
  ## Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes)
  # udp_payload = 512


# Read metrics about cpu usage
[[inputs.cpu]]
  ## Whether to report per-cpu stats or not
  percpu = true
  ## Whether to report total system cpu stats or not
  totalcpu = true
  ## Comment this line if you want the raw CPU time metrics
  fielddrop = ["time_*"]


# Read metrics about disk usage by mount point
[[inputs.disk]]
  ## By default, telegraf gather stats for all mountpoints.
  ## Setting mountpoints will restrict the stats to the specified mountpoints.
  # mount_points = ["/"]

  ## Ignore some mountpoints by filesystem type. For example (dev)tmpfs (usually
  ## present on /run, /var/run, /dev/shm or /dev).
  ignore_fs = ["tmpfs", "devtmpfs"]


# Read metrics about disk IO by device
[[inputs.diskio]]
  ## By default, telegraf will gather stats for all devices including
  ## disk partitions.
  ## Setting devices will restrict the stats to the specified devices.
  # devices = ["sda", "sdb"]
  ## Uncomment the following line if you need disk serial numbers.
  # skip_serial_number = false


# Get kernel statistics from /proc/stat
[[inputs.kernel]]
  # no configuration


# Read metrics about memory usage
[[inputs.mem]]
  # no configuration


# Get the number of processes and group them by status
[[inputs.processes]]
  # no configuration


# Read metrics about swap memory usage
[[inputs.swap]]
  # no configuration


# Read metrics about system load & uptime
[[inputs.system]]
  # no configuration

# Read metrics about network interface usage
[[inputs.net]]
  # collect data only about specific interfaces
  interfaces = ["ens192"]


[[inputs.netstat]]
  # no configuration

[[inputs.interrupts]]
  # no configuration

[[inputs.linux_sysctl_fs]]
  # no configuration

添加Dashboard模板

Dashboard 928:
https://grafana.com/dashboards/928

左上加號(hào)->Import


image

Grafana.com Dashboard處杂拨,輸入928編碼


image
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末酷勺,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子扳躬,更是在濱河造成了極大的恐慌脆诉,老刑警劉巖甚亭,帶你破解...
    沈念sama閱讀 221,635評(píng)論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異击胜,居然都是意外死亡亏狰,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,543評(píng)論 3 399
  • 文/潘曉璐 我一進(jìn)店門偶摔,熙熙樓的掌柜王于貴愁眉苦臉地迎上來暇唾,“玉大人,你說我怎么就攤上這事辰斋〔咧荩” “怎么了?”我有些...
    開封第一講書人閱讀 168,083評(píng)論 0 360
  • 文/不壞的土叔 我叫張陵宫仗,是天一觀的道長够挂。 經(jīng)常有香客問我,道長藕夫,這世上最難降的妖魔是什么孽糖? 我笑而不...
    開封第一講書人閱讀 59,640評(píng)論 1 296
  • 正文 為了忘掉前任,我火速辦了婚禮毅贮,結(jié)果婚禮上办悟,老公的妹妹穿的比我還像新娘。我一直安慰自己滩褥,他們只是感情好病蛉,可當(dāng)我...
    茶點(diǎn)故事閱讀 68,640評(píng)論 6 397
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著瑰煎,像睡著了一般铺然。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上丢间,一...
    開封第一講書人閱讀 52,262評(píng)論 1 308
  • 那天探熔,我揣著相機(jī)與錄音驹针,去河邊找鬼烘挫。 笑死,一個(gè)胖子當(dāng)著我的面吹牛柬甥,可吹牛的內(nèi)容都是我干的饮六。 我是一名探鬼主播,決...
    沈念sama閱讀 40,833評(píng)論 3 421
  • 文/蒼蘭香墨 我猛地睜開眼苛蒲,長吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼卤橄!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起臂外,我...
    開封第一講書人閱讀 39,736評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤窟扑,失蹤者是張志新(化名)和其女友劉穎喇颁,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體嚎货,經(jīng)...
    沈念sama閱讀 46,280評(píng)論 1 319
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡橘霎,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,369評(píng)論 3 340
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了殖属。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片姐叁。...
    茶點(diǎn)故事閱讀 40,503評(píng)論 1 352
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖洗显,靈堂內(nèi)的尸體忽然破棺而出外潜,到底是詐尸還是另有隱情,我是刑警寧澤挠唆,帶...
    沈念sama閱讀 36,185評(píng)論 5 350
  • 正文 年R本政府宣布处窥,位于F島的核電站,受9級(jí)特大地震影響损搬,放射性物質(zhì)發(fā)生泄漏碧库。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,870評(píng)論 3 333
  • 文/蒙蒙 一巧勤、第九天 我趴在偏房一處隱蔽的房頂上張望嵌灰。 院中可真熱鬧,春花似錦颅悉、人聲如沸沽瞭。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,340評(píng)論 0 24
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽驹溃。三九已至,卻和暖如春延曙,著一層夾襖步出監(jiān)牢的瞬間豌鹤,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,460評(píng)論 1 272
  • 我被黑心中介騙來泰國打工枝缔, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留布疙,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,909評(píng)論 3 376
  • 正文 我出身青樓愿卸,卻偏偏與公主長得像灵临,于是被迫代替她去往敵國和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子趴荸,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,512評(píng)論 2 359

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