Using Prometheus+Grafana+VMware-exporter to monitor VMware EXSi Hosts and VMs

This article introduces a simple method to monitor VMware EXSi and VMs with VMware-exporter, related metrics can be pulled by Prometheus, and visualized by Grafana.

Here we use docker to run 4 containers that compose of the entire environment.

First of all, git clone the project from the URL: VMware-ESXI-Monitoring-Tools: Prometheus / Grafana / VMWare ESXi Metrics for Prometheus

then, you need to download docker: Get Docker | Docker Docs, and install the docker for providing docker environment.

Finally, run the command:

复制代码
SMTP_HELLO=[yourdomain.com] SMTP_TO=[first.last@gmail.com] SMTP_FROM=[prometheus@yourdomain.com] SMTP_SMARTHOST=smtp.gmail.com:587 SMTP_USER=[your_gmail_user@gmail.com] SMTP_PASS=[your_google_app_password]
HOST_IP=[host_ip_running_docker_compose] VSPHERE_HOST=[esxi_host_ip_or_hostname] VSPHERE_USER=[vsphere_user] VSPHERE_PASS=[vsphere_pass] ./start_containers.sh 

If there's no need to use alert function, just remove the SMTP parameters from the command.

That's it!

If you want to get metrics from multiple vCenters, you can modify ./configs/prometheus.yml.tpl to add more jobs, for example,

复制代码
- job_name: 'vmware_vcenter_0'

  ......

  static_configs:

    - targets: 

      - '{{HOST_IP}}:9272'

- job_name: 'vmware_vcenter_1'

  ......

  static_configs:

    - targets: 

      - '{{HOST_IP}}:9273'

Run docker ps to get containers, and docker compose logs to get logs.

If it's too slow to download images, you can configure Aliyun docker image mirror to speed up.

Navigate to 容器镜像服务 to get registry-mirrors

Modify daemon configuration file /etc/docker/daemon.json to use accelerator:

复制代码
sudo mkdir -p /etc/docker 

sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://{{serial number}}.mirror.aliyuncs.com"] } EOF 

sudo systemctl daemon-reload  

sudo systemctl restart docker

After all set. you can get Dashboard template from Grafana Dashboard. Searching the dashboards with filters vmware or exsi and lable of prometheus to get the one you want. Remember to configure the data source first: https://{``{host_ip}}:3000

相关推荐
爱敲代码的TOM3 天前
Prometheus+Grafana构建企业级监控方案
prometheus
Insist7533 天前
prometheus安装部署与alertmanager邮箱告警
linux·运维·grafana·prometheus
爱敲代码的TOM3 天前
Grafana+Loki+Alloy构建企业级日志平台
grafana
小阳睡不醒4 天前
小白成长之路-部署prometheus监控平台
prometheus
linux修理工5 天前
n1 ARMbian部署Grafana
arm开发·架构·grafana
运维成长记7 天前
云原生监控系统 Prometheus大总结 20250909
云原生·prometheus
_何同学8 天前
Spring Boot 监控实战:集成 Prometheus 与 Grafana,打造全方位监控体系
spring boot·grafana·prometheus
g66x10 天前
自建prometheus监控腾讯云k8s集群
kubernetes·腾讯云·prometheus
苦逼IT运维10 天前
Jenkins 监控方案:Prometheus + Grafana 实践
jenkins·grafana·prometheus
迦蓝叶12 天前
JAiRouter 配置文件重构纪实 ——基于单一职责原则的模块化拆分与内聚性提升
java·网关·ai·重构·openai·prometheus·单一职责原则