Svolence

Telegraf+Influxdb+Grafana (1)

Telegraf+InfluxDB+Grafana初探

1.Configuration information

  • system info

    1
    unbuntu 16.04 x86_64
  • InfluxDB v1.1.1 install

    1
    2
    wget https://dl.influxdata.com/influxdb/releases/influxdb_1.1.1_amd64.deb
    sudo dpkg -i influxdb_1.1.1_amd64.deb
  • Telegraf v1.1.1 install

    1
    2
    wget https://dl.influxdata.com/telegraf/releases/telegraf_1.1.1_amd64.deb
    sudo dpkg -i telegraf_1.1.1_amd64.deb
  • Chronograf v1.1.0~beta1 install

    1
    2
    wget https://dl.influxdata.com/chronograf/releases/chronograf_1.1.0~beta1_amd64.deb
    sudo dpkg -i chronograf_1.1.0~beta1_amd64.deb
  • Kapacitor v1.1.1 install

    1
    2
    wget https://dl.influxdata.com/kapacitor/releases/kapacitor_1.1.1_amd64.deb
    sudo dpkg -i kapacitor_1.1.1_amd64.deb
  • grafana_4.0.1 install

    1
    2
    3
    wget https://grafanarel.s3.amazonaws.com/builds/grafana_4.0.1-1480694114_amd64.deb
    sudo apt-get install -y adduser libfontconfig
    sudo dpkg -i grafana_4.0.1-1480694114_amd64.deb

2.Telegraf 抓取本机信息

  • 自动生成telegraf.conf
    1
    telegraf config > telegraf.conf

Note: Telegraf will start automatically using the default configuration when installed from a deb package.

通过deb安装的话,Telegraf默认启动的配置文件在/etc/telegraf/telegraf.conf

手动生成一个简单的配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
telegraf -sample-config -input-filter cpu:mem -output-filter influxdb > telegraf.conf
root@test:/etc/telegraf# cat test.conf
[agent]
interval = "1s"
[outputs]
# Configuration to send data to InfluxDB.
[outputs.influxdb]
urls = ["http://localhost:8086"]
database = "kapacitor_example"
user_agent = "telegraf"
# Collect metrics about cpu usage
[cpu]
percpu = false
totalcpu = true
drop = ["cpu_time"]
root@test:/etc/telegraf#

InfluxDB中查看抓取信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
root@test:/etc/telegraf# influx
Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring.
Connected to http://localhost:8086 version 1.1.0
InfluxDB shell version: 1.1.0
> show databases;
name: databases
name
----
telegraf
_internal
kapacitor_example
test_log
error_log
> use telegraf
Using database telegraf
> show measurements;
name: measurements
name
----
cpu
disk
diskio
kernel
mem
processes
swap
system
>

To enable the Admin UI, edit the configuration file to set enabled = true in the [admin] section.
You must restart the process for any configuration changes to take effect.

Once enabled, the Admin UI is available by default at port 8083, i.e. http://localhost:8083.
You can control the port in the InfluxDB config file using the port option in the [admin] section.

InfluxDB v1.1之前默认开启后台管理界面,直接访问:http://localhost:8083,新的版本默认关闭,开启的话需要在
/etc/influxdb/influxdb.conf下[admin]选项下开启

3.Chronograf 可视化展示

1
influxd # 启动influxdb

访问http://localhost:10000,会看到如下界面
可视化界面

参考链接: