VMware exporter收集Vcenter实现Prometheus监控-2023-10
本文章不做调整,直接使用重写标签 replacement : locahost:9272;vcenter.company.com可修改为VcenterIP。这里的账户密码为 SSO账户密码,不是Esxi 的系统密码。替换其中账户、密码、Vcenter IP。a.装有Docker环境;部分配置需要根据环境修改。
在学习的时候,发现新的网上资料比较少,所以打算梳理一份;
一、VMware exporter
pryorda/vmware_exporter: VMWare vCenter Exporter for Prometheus (github.com)
1.1、预备环境:(已经安装好 Prometheus Grafana)
a.装有Docker环境;
1.2 解压vmware_exporter-main
cd vmware_exporter-main
1.3查看Docker-compose.yml
version: '2'
services:
vmware_exporter:
# Using the latest tag, but you can use vers(v0.9.5 for example
image: pryorda/vmware_exporter:latest
ports:
- "9275:9272"
environment:
VSPHERE_HOST: "vcenter-host"
VSPHERE_USER: "username"
VSPHERE_PASSWORD: "P@ssw0rd"
VSPHERE_IGNORE_SSL: "True"
VSPHERE_COLLECT_VMS: "False"
VSPHERE_COLLECT_VMGUESTS: "False"
restart: always
#FOR DEBUG UNCOMMENT NEXT LINE
#command: ["-l","DEBUG"]
1.4 Docker run 直接运行,输入ESXi -
这里的账户密码为 SSO(vmware SSO域)账户密码,不是Esxi 的系统密码
docker run -itd -p 9272:9272 -e VSPHERE_USER='账户\administrator' -e VSPHERE_PASSWORD='密码' -e VSPHERE_HOST='xx.xx.xx.xx' -e VSPHERE_IGNORE_SSL=True -e VSPHERE_SPECS_SIZE=2000 --name vmware_exporter pryorda/vmware_exporter
替换其中账户、密码、Vcenter IP
1.5 Prometheus 配置文件添加 监听 运行此容器的宿主机的ip
根据官方作者提供的配置, 添加job_name:
部分配置需要根据环境修改,本文章不做调整,直接使用重写标签 replacement : locahost:9272 ;(直接写在最后一行)
vcenter.company.com可修改为VcenterIP
- job_name: 'vmware_vcenter'
metrics_path: '/metrics'
static_configs:
- targets:
- 'vcenter.company.com'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: localhost:9272
1.6 重启Prometheus
systemctl daemon-reload
systemctl restart prometheus
systemctl status prometheus
1.7 Prometheus查看收集数据 IP:9090
二、Grafana展示数据
2.1选择合适的模板 两个都行
2.2新仪表盘
2.3选择数据源(省略数据源的创建)
3.最终展示
将Grafana 界面改为中文:
vim /etc/grafana/grafana.ini
去掉前面的';'
default_language = zh-Hans
重启:
systemctl restart grafana-server.service
引用:
prometheus监控VMware EsXi - 知乎 (zhihu.com)
Grafana :Start the Grafana server | Grafana documentation
Prometheus: Getting started | Prometheus
中文: 【Grafana】中文界面配置 v10.0.3_docker grafana汉化_legend_yst的博客-CSDN博客
更多推荐
所有评论(0)