influxdb 安装 wget https: // dl.influxdata.com/influxdb/releases/influxdb-1.7.6.x86_64.rpm yum localinstall influxdb-1.7.6.x86_64.rpmsystemctl start influxd telegraf 安装 wget https: // dl.influxdata.com/telegraf/releases/telegraf-1.11.
influxdb 安装
wget https://dl.influxdata.com/influxdb/releases/influxdb-1.7.6.x86_64.rpm yum localinstall influxdb-1.7.6.x86_64.rpm systemctl start influxd
telegraf 安装
wget https://dl.influxdata.com/telegraf/releases/telegraf-1.11.0-1.x86_64.rpm yum localinstall telegraf-1.11.0-1.x86_64.rpm
systemctl start telegraf
创建 Influxdb数据库
[[email protected] software]# influx Connected to http://localhost:8086 version 1.7.6 InfluxDB shell version: 1.7.6 Enter an InfluxQL query > create databese telegraf > create database jmeter > show databases name: databases name ---- _internal telegraf jmeter > CREATE USER root WITH PASSWORD ‘123456‘ WITH ALL PRIVILEGES # (创建一个新的管理员用户) > GRANT ALL PRIVILEGES TO root #为一个已有用户授权管理员权限 > exit
配置Telegraf
[[email protected] software]# vi /etc/telegraf/telegraf.conf ## 修改内容如下 [[outputs.influxdb]] urls = ["http://localhost:8086"] #infulxdb地址 database = "telegraf" #数据库 precision = "s" timeout = "5s" username = "admin" #帐号 password = "admin" #密码 retention_policy = "" [[email protected]_172_102_centos tools]# systemctl restart telegraf
检查Telegraf配置
## 转态是running说明配置加载成功
[[email protected] software]# service telegraf status
Redirecting to /bin/systemctl status telegraf.service
?.telegraf.service - The plugin-driven server agent for reporting metrics into InfluxDB
Loaded: loaded (/usr/lib/systemd/system/telegraf.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2019-06-18 04:59:48 EDT; 9s ago
Docs: https://github.com/influxdata/telegraf
Main PID: 7429 (telegraf)
CGroup: /system.slice/telegraf.service
?..7429 /usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/teleg...
Jun 18 04:59:48 localhost.localdomain systemd[1]: Stopped The plugin-driven server agent for repo...DB.
Jun 18 04:59:48 localhost.localdomain systemd[1]: Started The plugin-driven server agent for repo...DB.
Jun 18 04:59:48 localhost.localdomain telegraf[7429]: 2019-06-18T08:59:48Z I! Starting Telegraf 1.11.0
Jun 18 04:59:48 localhost.localdomain telegraf[7429]: 2019-06-18T08:59:48Z I! Loaded inputs: cpu d...em
telegrfa默认开启下列几项系统性能收集,也可以通过配置文件自定义收集应用服务性能数据
安装配置完后,进到influxdb的telegraf数据库里面可以看到几张表,如下:
安装Grafana
wget https://dl.grafana.com/oss/release/grafana-6.2.3-1.x86_64.rpm
yum localinstall grafana-6.2.3-1.x86_64.rpm
安装完成后启动服务:systemctl start grafana-server,service grafana-server restart(重启),记住要关闭防火墙喔,systemctl stop firewalld.service(临时关闭)和systemctl disable firewalld.service(禁止开机启动)systemctl status firewalld.service(查看防火墙状态)
然后访问,ip+3000端口,默认用户名和密码是admin;
通过命令getenforce来查看一下SELinux的状态,
安装好了grafana之后,我们可以配置一下grafana从influxdb中读取数据,从设置->Data Sources然后进行如下的配置: