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

相关推荐
逻辑与&&10 小时前
[Prometheus学习笔记]从架构到案例,一站式教程
笔记·学习·prometheus
Walden-202011 小时前
构建基于 DCGM-Exporter, Node exporter,PROMETHEUS 和 GRAFANA 构建算力监控系统
docker·容器·grafana·prometheus
牛角上的男孩1 天前
部署Prometheus、Grafana、Zipkin、Kiali监控度量Istio
grafana·prometheus·istio
福大大架构师每日一题3 天前
文心一言 VS 讯飞星火 VS chatgpt (383)-- 算法导论24.5 3题
prometheus
小安运维日记5 天前
Linux云计算 |【第五阶段】CLOUD-DAY10
linux·运维·云计算·k8s·grafana·prometheus
川石课堂软件测试6 天前
性能测试|linux服务器搭建JMeter+Grafana+Influxdb监控可视化平台
linux·服务器·python·jmeter·机器学习·grafana·1024程序员节
福大大架构师每日一题6 天前
29.2 golang实战项目log2metrics架构说明
架构·prometheus
花开了¥6 天前
prometheus 快速入门
prometheus
無爲謂6 天前
入门 | Kafka数据使用vector消费到Loki中使用grafana展示
分布式·kafka·vector·grafana·loki·日志存储·es限制解决办法
typ20047 天前
promtail+Loki+Grafana
grafana