grafana , 访问各种数据源 , 自定义报表、显示图表等等 , 用于提供界面监控 , 默认端口为3000 ,如http://127.0.0.1:3000访问, 默认登录信息帐号和密码分别admin和adminmysql
本人系统版本centos7,用yum安装nginx
yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.6.3-1.x86_64.rpm
#启动服务
systemctl start grafana
#查看服务状态
systemctl status grafana
复制代码
其余版本安装参考官网: http://docs.grafana.org/installation/rpm/sql
InfluxDB是一个开源数据库别名时序数据库,针对时间序列数据的快速,高可用性存储和检索进行了优化。 InfluxDB很是适合运营监控,应用指标和实时分析。默认端口为Web端8083 , API端8086数据库
#新建一个源仓库
vi /etc/yum.repos.d/influxdata.repo
#输入如下内容
[influxdb]
name = InfluxData Repository - RHEL $releasever
baseurl = https://repos.influxdata.com/rhel/$releasever/$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
#安装
yum install influxdb
#启动服务
systemctl start influxdb
#查看服务状态
systemctl status influxdb
复制代码
安装完能够登陆http://127.0.0.1:8083,默认安装是不须要帐号和密码。centos
Telegraf是收集系统和服务器各类源入mysql,nginx等的统计数据 , 并写入到 InfluxDB数据库 ,最后InfluxDB收集到数据给Grafana以各类图表显示bash
同时Telegraf和Grafana是配套,由于上面设置源,所以能够直接安装服务器
#安装
yum install telegraf
复制代码
重点是否收集数据到Influx时序库:app
vi /etc/telegraf/telegraf.conf
复制代码
[[outputs.influxdb]]
## The full HTTP or UDP endpoint URL for your InfluxDB instance.
## 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,这个url能够改为本身host
## The target database for metrics (telegraf will create it if not exists).
database = "telegraf" # required,这个会在influx库建立一个库
复制代码
#启动服务
systemctl start telegraf
#查看服务状态
systemctl status telegraf
复制代码
#进入Influx
influx
#查看可用数据库
show databases
#结果以下:
Output
name: databases
name
----
_internal
telegraf #这个是启动服务后自动生成
#查看收集的字段有那些
show measurements
#结果以下:
Output
name: measurements
name
----
cpu
disk
diskio
kernel
mem
processes
swap
system
复制代码
啦啦,看到这些数听说明已经收集到数据,咱们差一点展现数据就ok了。优化
1).登录grafana , 左上角菜单新建数据源 , 并配置好相关信息ui
这里具体配置源参数
2).咱们是监控cpu,内存等等,所以咱们直接用别人写好面板直接导入
而后从别人编辑好面板复制grafana.com/dashboards/…ID到上面
3).最后看到一切都ok的图表,是否是很happy。
第一张:
第二张: