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=[[email protected]] SMTP_FROM=[[email protected]] SMTP_SMARTHOST=smtp.gmail.com:587 SMTP_USER=[[email protected]] 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

相关推荐
XMYX-06 小时前
Spring Boot + Prometheus 实现应用监控(基于 Actuator 和 Micrometer)
spring boot·后端·prometheus
SailingCoder1 天前
grafana-mcp-analyzer:基于 MCP 的轻量 AI 分析监控图表的运维神器!
运维·人工智能·typescript·node.js·grafana
xbd_zc3 天前
【使用 Loki + Promtail + Grafana 搭建轻量级容器日志分析平台】
grafana·loki·promtail
时间裂缝里的猫-O-3 天前
@Prometheus 监控-MySQL (Mysqld Exporter)
数据库·mysql·prometheus
qq_312920114 天前
K8S上使用helm部署 Prometheus + Grafana
kubernetes·grafana·prometheus
MyikJ5 天前
Java 面试实录:从Spring到微服务的技术探讨
java·spring boot·微服务·kafka·spring security·grafana·prometheus
怡人蝶梦6 天前
Java大厂后端技术栈故障排查实战:Spring Boot、Redis、Kafka、JVM典型问题与解决方案
java·jvm·redis·elk·kafka·springboot·prometheus
tatasix6 天前
从监控到告警:Prometheus+Grafana+Alertmanager+告警通知服务全链路落地实践
grafana·prometheus
时间裂缝里的猫-O-6 天前
@Docker Compose部署Alertmanager
docker·容器·eureka·prometheus
怡人蝶梦6 天前
Java后端技术栈问题排查实战:Spring Boot启动慢、Redis缓存击穿与Kafka消费堆积
java·jvm·redis·kafka·springboot·prometheus