性能监控(grafana + influxdb + telegraf)

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数据库

[root@localhost 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

[root@localhost 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 = ""
  
[root@VM_172_102_centos tools]# systemctl restart telegraf

检查Telegraf配置

 

## 转态是running说明配置加载成功
[root@localhost 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然后进行如下的配置:

 

转载于:https://www.cnblogs.com/laraine/p/11046858.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值