1. 安装依赖包
apt-get install -y adduser libfontconfig1 curl wget vim unzip net-tools
2. 下载安装包
https://dl.grafana.com/oss/release/grafana_7.3.6_amd64.deb
https://dl.influxdata.com/telegraf/releases/telegraf_1.17.0-1_amd64.deb
https://dl.influxdata.com/influxdb/releases/influxdb_1.8.3_amd64.deb
3. 安装软件包
dpkg -i grafana_7.3.6_amd64.deb influxdb_1.8.3_amd64.deb telegraf_1.17.0-1_amd64.deb
4. 安装grafana插件,用于显示饼图
wget -nv https://grafana.com/api/plugins/grafana-piechart-panel/versions/latest/download -O /tmp/grafana-piechart-panel.zip
cd /tmp
unzip grafana-piechart-panel.zip
mv grafana-piechart-panel /var/lib/grafana/plugins/
5. 修改influxdb配置文件
/etc/influxdb/influxdb.conf
将下面三行取消注释并修改监听的IP地址,出于安全考虑只监听在127.0.0.1的地址
[http]
enabled = true
bind-address = "127.0.0.1:8086"
6. 启动influxdb
systemctl start influxdb
7. 修改telegraf配置文件
/etc/telegraf/telegraf.conf
将下面三行取消注释,数据记录到influxdb中,出于安全考虑只监听在127.0.0.1的地址
[[outputs.influxdb]]
urls = ["http://127.0.0.1:8086"]
database = "telegraf"
添加vCenter的连接地址和认证信息
[[inputs.vsphere]]
vcenters = [ "https://192.168.1.250/sdk" ]
username = "administrator@vsphere.local"
password = "your_password"
将需要监控的项目取消注释
vm_include = [ "/*/vm/**"]
host_include = [ "/*/host/**"]
cluster_include = [ "/*/host/**"]
datastore_include = [ "/*/datastore/**"]
datacenter_include = [ "/*/host/**"]
separator = "_"
提升轮询速度
collect_concurrency = 5
discover_concurrency = 5
忽略自签名证书
insecure_skip_verify = true
测试telegraf配置
telegraf -config /etc/telegraf/telegraf.conf -test
8. 启动telegraf
systemctl start telegraf
9. 配置grafana
1. 启动grafana
systemctl start grafana-server
2. 登录Web-UI,修改初始密码
http://IP:3000
默认账号 admin 密码 admin
强制修改默认密码
3. 添加数据源
4. 通过链接导入模板
https://grafana.com/api/dashboards/8162/revisions/7/download
https://grafana.com/api/dashboards/8168/revisions/11/download
https://grafana.com/api/dashboards/8159/revisions/32/download
https://grafana.com/api/dashboards/8165/revisions/14/download