一: 简介
1.安装
yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.5.2-1.x86_64.rpm
2.开机启动配置
systemctl daemon-reload
systemctl start grafana-server
systemctl status grafana-server
3.相关文件目录
Installs binary to /usr/sbin/grafana-server
Copies init.d script to /etc/init.d/grafana-server
Installs default file (environment vars) to /etc/sysconfig/grafana-server
Copies configuration file to /etc/grafana/grafana.ini
Installs systemd service (if systemd is available) name grafana-server.service
The default configuration uses a log file at /var/log/grafana/grafana.log
The default configuration specifies an sqlite3 database at /var/lib/grafana/grafana.db
4.应用页面 http://ip:3000 用户名/密码:admin/admin
三:配置
1.通过rpm安装,配置信息在/etc/grafana/grafana.ini文件中,通过安装包安装配置文件在/usr/share/grafana/conf/目录下。
通过启动日志可以看到,会读取defaults.ini和grafana.ini的配置信息, 因此如果要修改访问端口(如3000改成3001)需要修改defaults.ini
配置文件中的信息,感觉有点奇怪。
2.dashboards配置
编辑配置文件/etc/grafana/grafana.ini,修改dashboards.json段落下两个参数的值:
[dashboards.json]
enabled = true
path = /var/lib/grafana/dashboards
一定要去掉开头的分号(“;”)否则配置不起作用
安装仪表盘(Percona提供),重新启动应用
$ git clone https://github.com/percona/grafana-dashboards.git
$ cp -r grafana-dashboards/dashboards /var/lib/grafana/
systemctl restart grafana-server
四:同prometheus一起监控Mysql
1.Prometheus安装 请参考上一篇博文
2.配置文件
3.部署node_exporters和mysqld_exporters
查看
Prometheus http://ip:9090
4.Grafana中创建Prometheus数据源
5.服务器监控结果画面
6.Mysql数据库监控结果画面
Grafana 是一个开源仪表盘工具,它可用于Graphite、InfluxDB与 OpenTSDB 一起使用。最新的版本还可以用于其他的数据源,比如Elasticsearch。
从本质上说,它是一个功能丰富的Graphite-web 替代品,能帮助用户更简单地创建和编辑仪表盘。它包含一个独一无二的Graphite目标解析器,从而可以简化度量和函数的编辑
二: 安装与配置1.安装
yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.5.2-1.x86_64.rpm
2.开机启动配置
systemctl daemon-reload
systemctl start grafana-server
systemctl status grafana-server
3.相关文件目录
Installs binary to /usr/sbin/grafana-server
Copies init.d script to /etc/init.d/grafana-server
Installs default file (environment vars) to /etc/sysconfig/grafana-server
Copies configuration file to /etc/grafana/grafana.ini
Installs systemd service (if systemd is available) name grafana-server.service
The default configuration uses a log file at /var/log/grafana/grafana.log
The default configuration specifies an sqlite3 database at /var/lib/grafana/grafana.db
4.应用页面 http://ip:3000 用户名/密码:admin/admin
三:配置
1.通过rpm安装,配置信息在/etc/grafana/grafana.ini文件中,通过安装包安装配置文件在/usr/share/grafana/conf/目录下。
通过启动日志可以看到,会读取defaults.ini和grafana.ini的配置信息, 因此如果要修改访问端口(如3000改成3001)需要修改defaults.ini
配置文件中的信息,感觉有点奇怪。
2.dashboards配置
编辑配置文件/etc/grafana/grafana.ini,修改dashboards.json段落下两个参数的值:
[dashboards.json]
enabled = true
path = /var/lib/grafana/dashboards
一定要去掉开头的分号(“;”)否则配置不起作用
安装仪表盘(Percona提供),重新启动应用
$ git clone https://github.com/percona/grafana-dashboards.git
$ cp -r grafana-dashboards/dashboards /var/lib/grafana/
systemctl restart grafana-server
四:同prometheus一起监控Mysql
1.Prometheus安装 请参考上一篇博文
2.配置文件
点击(此处)折叠或打开
- global:
- scrape_interval: 15s
- evaluation_interval: 15s
-
- scrape_configs:
- - job_name: prometheus
- static_configs:
- - targets: ['localhost:9090']
- labels:
- instance: prometheus
-
- - job_name: linux
- static_configs:
- - targets: ['10.10.0.186:9100']
- labels:
- instance: db1
-
- - job_name: mysql
- static_configs:
- - targets: ['10.10.0.186:9104']
- labels:
- instance: db1
点击(此处)折叠或打开
- $ wget https://github.com/prometheus/node_exporter/releases/download/v0.14.0/node_exporter-0.14.0.linux-amd64.tar.gz -O node_exporter-0.14.0.linux-amd64.tar.gz
- $ wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.10.0/mysqld_exporter-0.10.0.linux-amd64.tar.gz -O mysqld_exporter-0.10.0.linux-amd64.tar.gz
- $ mkdir /usr/local/services/prometheus_exporters
- $ tar zxf node_exporter-0.14.0.linux-amd64.tar.gz -C /usr/local/services/prometheus_exporters --strip-components=1
- $ tar zxf mysqld_exporter-0.10.0.linux-amd64.tar.gz -C /usr/local/services/prometheus_exporters --strip-components=1
-
- $ cd /usr/local/services/prometheus_exporters
- $ ./node_exporter
-
- $ cd /usr/local/services/prometheus_exporters
- $ cat << EOF > .my.cnf
- [client]
- user=prom
- password=abc123
- EOF
- $ ./mysqld_exporter -config.my-cnf=".my.cnf"
4.Grafana中创建Prometheus数据源
5.服务器监控结果画面
6.Mysql数据库监控结果画面
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28624388/viewspace-2146458/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/28624388/viewspace-2146458/