前提要求
- 安装docker,docker-compose
创建vmware_exporter目录
mkdir -p /vmware_exporter
创建基于docker部署vmware_exporter脚本
- VSPHERE_HOST: "vCenter 管理地址"
- VSPHERE_IGNORE_SSL: "True"
- VSPHERE_USER: "administrator@vsphere.local"
- VSPHERE_PASSWORD: "密码"
vim /vmware_exporter/docker-compose.yml
version: '3'
services:
vmware-exporter:
image: pryorda/vmware_exporter:v0.11.1
container_name: vmware-exporter
hostname: vmware-exporter
restart: always
ports:
- '9272:9272'
expose:
- 9272
environment:
VSPHERE_HOST: "You_vCenter"
VSPHERE_IGNORE_SSL: "True"
VSPHERE_USER: "administrator@vsphere.local"
VSPHERE_PASSWORD: "YOU_password"
labels:
org.label-schema.group: "monitoring"
运行vmware_exporter容器
docker-compose up -d
vmware_exporter采集结果查看,部分展示
- http://YOU_IP:9272/metrics
Prometheus 配置
- static_configs 此处vCenter 管理地址
- replacement此处是vmware_exporter采集数据地址
scrape_configs:
- job_name: 'web'
scrape_interval: 5s
static_configs:
- targets:
- localhost:9090
- job_name: 'vmware_vcenter'
metrics_path: '/metrics'
static_configs:
- targets:
- YOU_vCenter_IP
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: YOU_vmware_vcenter_IP:9272
Grafana 图形展示
- 11243 模板号 VMware stats