转自:https://www.scriptjc.com/article/1284
prometheus 监控 exsi vcenter,kvm libvirt
来源:原创 时间:2021-10-20 作者:脚本小站 分类:Linux监控vcenter:
github地址:
1 |
https: //github .com /pryorda/vmware_exporter
|
启动:
1 2 3 4 5 6 7 |
#!/bin/bash
export VSPHERE_USERNAME=administrator@vsphere. local
export VSPHERE_PASSWORD=123456
export VSPHERE_HOST=192.168.1.123
docker run -it --restart=always -d -p 9272:9272 -e VSPHERE_USER=${VSPHERE_USERNAME} -e VSPHERE_PASSWORD=${VSPHERE_PASSWORD} -e VSPHERE_HOST=${VSPHERE_HOST} -e VSPHERE_IGNORE_SSL=True -e VSPHERE_SPECS_SIZE=2000 --name vmware_exporter pryorda /vmware_exporter
|
prometheus中添加如下配置:
1 2 3 4 5 6 7 8 9 10 11 12 |
- job_name: 'vmware_vcenter'
metrics_path: '/metrics'
static_configs:
- targets:
- 'vcenter.scriptjc.com'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: localhost:9272
|
grafana Dashboard:
1 |
https: //grafana .com /grafana/dashboards/11243
|
监控kvm:
github地址:
1 |
https: //github .com /zhangjianweibj/prometheus-libvirt-exporter
|
systemd:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
cat > /usr/lib/systemd/system/libvirt_exporter .service <<EOF
[Unit]
Description=prometheus-libvirt-exporter
[Service]
ExecStart= /usr/local/libvirt_exporter/prometheus-libvirt-exporter
Restart=on-failure
KillMode=process
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
|