grafana 自动部署安装包
This commit is contained in:
55
grafana-auto-deploy/README.md
Normal file
55
grafana-auto-deploy/README.md
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# README #
|
||||||
|
|
||||||
|
@Date : 2019/09/12
|
||||||
|
|
||||||
|
@Author : lwp
|
||||||
|
|
||||||
|
|
||||||
|
**说明**
|
||||||
|
|
||||||
|
此目录下的文件,用于 grafana 的自动部署(用于展示 tfe/kni 的 fieldstatu 数据)。
|
||||||
|
|
||||||
|
```
|
||||||
|
./
|
||||||
|
├── dashboard-tfe.json # dashboard 样式,界面
|
||||||
|
├── dashboard-tfe.yaml # dashboard 配置文件
|
||||||
|
├── datasources-influxdb.yaml # 数据源配置文件
|
||||||
|
├── grafana-6.3.0-1.x86_64.rpm # grafan 安装包
|
||||||
|
└── install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
**配置**
|
||||||
|
|
||||||
|
需要根据实际情况修改 datasources-influxdb.yaml 文件中的下列配置项:
|
||||||
|
|
||||||
|
* url : influxdb 访问地址
|
||||||
|
* user : influxdb 用户
|
||||||
|
* password: influxdb 用户密码
|
||||||
|
* database: influxdb 数据库名
|
||||||
|
|
||||||
|
**安装**
|
||||||
|
|
||||||
|
``` sh
|
||||||
|
sh install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
**访问**
|
||||||
|
|
||||||
|
使用浏览器访问下述地址(${HOST}: 为部署 grafana 的机器 IP)。
|
||||||
|
|
||||||
|
``` sh
|
||||||
|
http://${HOST}:3000/
|
||||||
|
```
|
||||||
|
|
||||||
|
* 默认管理账户:admin
|
||||||
|
* 默认管理密码:admin
|
||||||
|
|
||||||
|
|
||||||
|
**注意**
|
||||||
|
|
||||||
|
用于数据聚合的 telegraf 配置文件 /etc/telegraf/telegraf.conf 中建议增加下述配置,使 telegraf 聚合的直方图统计分布与 fieldstat 的配置一致,便于 grafana 进行数据展示。
|
||||||
|
|
||||||
|
``` sh
|
||||||
|
[[inputs.statsd]]
|
||||||
|
percentiles = [50,80,90,95] # 建议与 fieldstat 的配置一致
|
||||||
|
```
|
||||||
4052
grafana-auto-deploy/dashboard-tfe.json
Normal file
4052
grafana-auto-deploy/dashboard-tfe.json
Normal file
File diff suppressed because it is too large
Load Diff
13
grafana-auto-deploy/dashboard-tfe.yaml
Normal file
13
grafana-auto-deploy/dashboard-tfe.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# config file version
|
||||||
|
apiVersion: 1
|
||||||
|
|
||||||
|
providers:
|
||||||
|
- name: 'default'
|
||||||
|
orgId: 1
|
||||||
|
folder: ''
|
||||||
|
folderUid: ''
|
||||||
|
type: file
|
||||||
|
disableDeletion: false
|
||||||
|
editable: true
|
||||||
|
options:
|
||||||
|
path: /var/lib/grafana/dashboard-tfe.json
|
||||||
65
grafana-auto-deploy/datasources-influxdb.yaml
Normal file
65
grafana-auto-deploy/datasources-influxdb.yaml
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# # config file version
|
||||||
|
apiVersion: 1
|
||||||
|
|
||||||
|
# # list of datasources that should be deleted from the database
|
||||||
|
#deleteDatasources:
|
||||||
|
deleteDatasources:
|
||||||
|
# - name: Graphite
|
||||||
|
# orgId: 1
|
||||||
|
- name: InfluxDB
|
||||||
|
orgId: 1
|
||||||
|
|
||||||
|
# # list of datasources to insert/update depending
|
||||||
|
# # on what's available in the database
|
||||||
|
#datasources:
|
||||||
|
datasources:
|
||||||
|
# # <string, required> name of the datasource. Required
|
||||||
|
# - name: Graphite
|
||||||
|
- name: InfluxDB
|
||||||
|
# # <string, required> datasource type. Required
|
||||||
|
# type: graphite
|
||||||
|
type: influxdb
|
||||||
|
# # <string, required> access mode. direct or proxy. Required
|
||||||
|
# access: proxy
|
||||||
|
access: proxy
|
||||||
|
# # <int> org id. will default to orgId 1 if not specified
|
||||||
|
# orgId: 1
|
||||||
|
# # <string> url
|
||||||
|
# url: http://localhost:8080
|
||||||
|
url: http://192.168.10.152:8086
|
||||||
|
# # <string> database password, if used
|
||||||
|
# password:
|
||||||
|
# # <string> database user, if used
|
||||||
|
# user:
|
||||||
|
user: telegraf
|
||||||
|
# # <string> database name, if used
|
||||||
|
# database:
|
||||||
|
database: telegraf
|
||||||
|
# # <bool> enable/disable basic auth
|
||||||
|
# basicAuth:
|
||||||
|
# # <string> basic auth username
|
||||||
|
# basicAuthUser:
|
||||||
|
# # <string> basic auth password
|
||||||
|
# basicAuthPassword:
|
||||||
|
# # <bool> enable/disable with credentials headers
|
||||||
|
# withCredentials:
|
||||||
|
# # <bool> mark as default datasource. Max one per org
|
||||||
|
# isDefault:
|
||||||
|
# # <map> fields that will be converted to json and stored in json_data
|
||||||
|
jsonData:
|
||||||
|
password: telegraf
|
||||||
|
# graphiteVersion: "1.1"
|
||||||
|
# tlsAuth: true
|
||||||
|
# tlsAuthWithCACert: true
|
||||||
|
# httpHeaderName1: "Authorization"
|
||||||
|
# # <string> json object of data that will be encrypted.
|
||||||
|
# secureJsonData:
|
||||||
|
# tlsCACert: "..."
|
||||||
|
# tlsClientCert: "..."
|
||||||
|
# tlsClientKey: "..."
|
||||||
|
# # <openshift\kubernetes token example>
|
||||||
|
# httpHeaderValue1: "Bearer xf5yhfkpsnmgo"
|
||||||
|
# version: 1
|
||||||
|
# # <bool> allow users to edit datasources from the UI.
|
||||||
|
# editable: false
|
||||||
|
|
||||||
BIN
grafana-auto-deploy/grafana-6.3.0-1.x86_64.rpm
Executable file
BIN
grafana-auto-deploy/grafana-6.3.0-1.x86_64.rpm
Executable file
Binary file not shown.
56
grafana-auto-deploy/install.sh
Normal file
56
grafana-auto-deploy/install.sh
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
################################################################################
|
||||||
|
# @File : install.sh
|
||||||
|
#
|
||||||
|
# @Date : 2019/09/12 11:42:17
|
||||||
|
# @Author : lwp
|
||||||
|
#
|
||||||
|
# @Brief :
|
||||||
|
#
|
||||||
|
#--------------------------- Revision History ----------------------------------
|
||||||
|
# No Version Date Revised By Item Description
|
||||||
|
# @1
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
#!bin/bash
|
||||||
|
|
||||||
|
# 安装
|
||||||
|
|
||||||
|
yum localinstall -y grafana-6.3.0-1.x86_64.rpm
|
||||||
|
|
||||||
|
# 配置
|
||||||
|
rm -rf /var/lib/grafana/grafana.db
|
||||||
|
|
||||||
|
# 展示 tfe 数据的 dashboard
|
||||||
|
cp dashboard-tfe.json /var/lib/grafana/
|
||||||
|
chown root:grafana /var/lib/grafana/dashboard-tfe.json
|
||||||
|
|
||||||
|
# dashboard 的配置文件
|
||||||
|
cp dashboard-tfe.yaml /etc/grafana/provisioning/dashboards/
|
||||||
|
chown root:grafana /etc/grafana/provisioning/dashboards/dashboard-tfe.yaml
|
||||||
|
|
||||||
|
# 需要根据实际情况修改 datasources-influxdb.yaml 文件中的下列配置项
|
||||||
|
# url : influxdb 访问地址
|
||||||
|
# user : influxdb 用户
|
||||||
|
# password: influxdb 用户密码
|
||||||
|
# database: influxdb 数据库名
|
||||||
|
cp datasources-influxdb.yaml /etc/grafana/provisioning/datasources/
|
||||||
|
chown root:grafana /etc/grafana/provisioning/datasources/datasources-influxdb.yaml
|
||||||
|
|
||||||
|
# 开机自启
|
||||||
|
systemctl enable grafana-server.service
|
||||||
|
|
||||||
|
# 启动
|
||||||
|
systemctl start grafana-server
|
||||||
|
|
||||||
|
# 卸载
|
||||||
|
# systemctl stop grafana-server
|
||||||
|
# rpm -e grafana-6.3.0-1
|
||||||
|
# rm -rf /var/lib/grafana
|
||||||
|
# rm -rf /var/log/grafana
|
||||||
|
# rm -rf /etc/grafana
|
||||||
|
|
||||||
|
# 管理地址
|
||||||
|
#http://host:3000/
|
||||||
|
#账户名:admin
|
||||||
|
#密码:admin
|
||||||
Reference in New Issue
Block a user