安裝influxdb監控套件

  • 2019 年 11 月 22 日
  • 筆記

三件套:influxdb telegraf grafana

infuluxdb

下載安裝

wget https://dl.influxdata.com/influxdb/releases/influxdb-1.2.2.x86_64.rpm  yum localinstall influxdb-1.2.2.x86_64.rpm

修改配置:

vim /etc/influxdb/influxdb.conf  reporting-disabled = true  #bind-address = ":8086"  [admin]    # Determines whether the admin service is enabled.    enabled = true (web管理介面)    bind-address = ":8083"    (web服務介面的埠)

開機啟動

systemctl start influxdb  systemctl enable influxdb

進入db

influx  # 進入控制台,創建個db試試  create database test_db  show databases;    name: databases  name  ----  _internal  test_db

搞定。 注意: influxdb的數據文件

/var/log/influxdb/influxd.log 日誌文件  /var/lib/influxdb/data 數據文件  /var/cache/yum/influxdb 快取處理數據  記得掛盤或者ln -s

telegraf

wget https://dl.influxdata.com/telegraf/releases/telegraf-1.3.0-1.x86_64.rpm  yum localinstall telegraf-1.3.0-1.x86_64.rpm    ## 編輯,配置  vi /etc/telegraf/telegraf.conf    # 查找influx,修改influx的上報埠  [[outputs.influxdb]]    ## The HTTP or UDP URL for your InfluxDB instance.  Each item should be    ## of the form:    ##   scheme "://" host [ ":" port]    ##    ## Multiple urls can be specified as part of the same cluster,    ## this means that only ONE of the urls will be written to each interval.    # urls = ["udp://localhost:8089"] # UDP endpoint example    urls = ["http://localhost:8086"] # required    ## The target database for metrics (telegraf will create it if not exists).    database = "telegraf" # required    # 打開注釋,監控k8s  [[inputs.kubernetes]]  #   ## URL for the kubelet      url = "http://localhost:10255"    systemctl start telegraf  systemctl enable telegraf  systemctl status telegraf

grafana

wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.4.0-1.x86_64.rpm    yum localinstall grafana-5.4.0-1.x86_64.rpm    systemctl daemon-reload  systemctl start grafana-server  systemctl status grafana-server    systemctl enable grafana-server.service

編輯配置:

vim /etc/grafana/grafana.ini # 把3000埠改成你要的

打開web頁,用默認賬戶登錄,添加源

配置telegraf監控

進入 https://grafana.com/dashboards/928 按它的配置,修改telegraf的配置。 下載json文件,進入new dashboard,然後導入這個json。 簡直吊爆了。