[转帖]使用Grafana和Telegraf监视VMware ESXi的方法

使用Grafana和Telegraf监视VMware ESXi的方法

2019-04-03 15:28:30作者:曾秀珠稿源:云网牛站

https://ywnz.com/linuxyffq/4660.html

坐着很牛B  我比较傻逼.. 照葫芦画瓢之


本文介绍使用Grafana和Telegraf监视VMware ESXi的方法,设置非常简单,使用Telegraf的官方vSphere插件从vCenter中提取指标,这包括在vSphere虚拟机管理程序上运行的vSphere主机计算(RAM和CPU),网络,数据存储和虚拟机的度量标准。

一、安装InfluxDB和Grafana参考文章

所有收集的指标都存储在InfluxDB数据库中,Grafana将连接到InfluxDB,以在其仪表板上查询和显示指标。参考以下文章:

在Ubuntu 18.04/Debian 9系统上安装InfluxDB的方法

在RHEL 8/CentOS 8上安装InfluxDB的方法

在Ubuntu 18.04系统中安装Grafana 6的方法

在CentOS 7系统中安装Grafana 6的方法

一旦安装了InfluxDB和Grafana,继续安装和配置Telegraf。

二、安装和配置Telegraf

如果你使用步骤一中的链接来安装InfluxDB,则会添加Telegraf安装所需的存储库,只需使用以下命令安装Telegraf即可。

CentOS系统运行:

sudo yum -y install telegraf

Ubuntu系统运行:

sudo apt-get -y install telegraf

安装后,我们需要配置Telegraf以从vCenter中提取监控指标,编辑Telegraf主配置文件:

sudo vim /etc/telegraf/telegraf.conf

1、添加InfluxDB输出存储后端,以存储指标:

# Configuration for sending metrics to InfluxDB

[[outputs.influxdb]]

urls = ["http://10.10.1.20:8086"]

database = "vmware"

timeout = "0s"

username = "monitoring"

password = "DBPassword"

将10.10.1.20替换为InfluxDB服务器IP地址,如果你没有在InfluxDB上启用身份验证,则可以安全地删除配置中的用户名和密码行。

2、为Telegraf配置vsphere输入插件,完整配置应该类似以下内容:

# Read metrics from VMware vCenter

[[inputs.vsphere]]

## List of vCenter URLs to be monitored. These three lines must be uncommented

## and edited for the plugin to work.

vcenters = [ "https://10.10.1.2/sdk" ]

username = "[email protected]"

password = "AdminPassword"

#

## VMs

## Typical VM metrics (if omitted or empty, all metrics are collected)

vm_metric_include = [

"cpu.demand.average",

"cpu.idle.summation",

"cpu.latency.average",

"cpu.readiness.average",

"cpu.ready.summation",

"cpu.run.summation",

"cpu.usagemhz.average",

"cpu.used.summation",

"cpu.wait.summation",

"mem.active.average",

"mem.granted.average",

"mem.latency.average",

"mem.swapin.average",

"mem.swapinRate.average",

"mem.swapout.average",

"mem.swapoutRate.average",

"mem.usage.average",

"mem.vmmemctl.average",

"net.bytesRx.average",

"net.bytesTx.average",

"net.droppedRx.summation",

"net.droppedTx.summation",

"net.usage.average",

"power.power.average",

"virtualDisk.numberReadAveraged.average",

"virtualDisk.numberWriteAveraged.average",

"virtualDisk.read.average",

"virtualDisk.readOIO.latest",

"virtualDisk.throughput.usage.average",

"virtualDisk.totalReadLatency.average",

"virtualDisk.totalWriteLatency.average",

"virtualDisk.write.average",

"virtualDisk.writeOIO.latest",

"sys.uptime.latest",

]

# vm_metric_exclude = [] ## Nothing is excluded by default

# vm_instances = true ## true by default

#

## Hosts

## Typical host metrics (if omitted or empty, all metrics are collected)

host_metric_include = [

"cpu.coreUtilization.average",

"cpu.costop.summation",

"cpu.demand.average",

"cpu.idle.summation",

"cpu.latency.average",

"cpu.readiness.average",

"cpu.ready.summation",

"cpu.swapwait.summation",

"cpu.usage.average",

"cpu.usagemhz.average",

"cpu.used.summation",

"cpu.utilization.average",

"cpu.wait.summation",

"disk.deviceReadLatency.average",

"disk.deviceWriteLatency.average",

"disk.kernelReadLatency.average",

"disk.kernelWriteLatency.average",

"disk.numberReadAveraged.average",

"disk.numberWriteAveraged.average",

"disk.read.average",

"disk.totalReadLatency.average",

"disk.totalWriteLatency.average",

"disk.write.average",

"mem.active.average",

"mem.latency.average",

"mem.state.latest",

"mem.swapin.average",

"mem.swapinRate.average",

"mem.swapout.average",

"mem.swapoutRate.average",

"mem.totalCapacity.average",

"mem.usage.average",

"mem.vmmemctl.average",

"net.bytesRx.average",

"net.bytesTx.average",

"net.droppedRx.summation",

"net.droppedTx.summation",

"net.errorsRx.summation",

"net.errorsTx.summation",

"net.usage.average",

"power.power.average",

"storageAdapter.numberReadAveraged.average",

"storageAdapter.numberWriteAveraged.average",

"storageAdapter.read.average",

"storageAdapter.write.average",

"sys.uptime.latest",

]

# host_metric_exclude = [] ## Nothing excluded by default

# host_instances = true ## true by default

#

## Clusters

cluster_metric_include = [] ## if omitted or empty, all metrics are collected

# cluster_metric_exclude = [] ## Nothing excluded by default

# cluster_instances = false ## false by default

#

## Datastores

datastore_metric_include = [] ## if omitted or empty, all metrics are collected

# datastore_metric_exclude = [] ## Nothing excluded by default

# datastore_instances = false ## false by default for Datastores only

#

## Datacenters

datacenter_metric_include = [] ## if omitted or empty, all metrics are collected

datacenter_metric_exclude = [ "*" ] ## Datacenters are not collected by default.

# datacenter_instances = false ## false by default for Datastores only

#

## Plugin Settings

## separator character to use for measurement and field names (default: "_")

# separator = "_"

#

## number of objects to retreive per query for realtime resources (vms and hosts)

## set to 64 for vCenter 5.5 and 6.0 (default: 256)

# max_query_objects = 256

#

## number of metrics to retreive per query for non-realtime resources (clusters and datastores)

## set to 64 for vCenter 5.5 and 6.0 (default: 256)

# max_query_metrics = 256

#

## number of go routines to use for collection and discovery of objects and metrics

# collect_concurrency = 1

# discover_concurrency = 1

#

## whether or not to force discovery of new objects on initial gather call before collecting metrics

## when true for large environments this may cause errors for time elapsed while collecting metrics

## when false (default) the first collection cycle may result in no or limited metrics while objects are discovered

# force_discover_on_init = false

#

## the interval before (re)discovering objects subject to metrics collection (default: 300s)

# object_discovery_interval = "300s"

#

## timeout applies to any of the api request made to vcenter

# timeout = "60s"

#

## Optional SSL Config

# ssl_ca = "/path/to/cafile"

# ssl_cert = "/path/to/certfile"

# ssl_key = "/path/to/keyfile"

## Use SSL but skip chain & host verification

insecure_skip_verify = true

要改变的变量是:

1]、10.10.1.2应替换为vCenter IP地址。

2]、[email protected]应与你的vCenter用户帐户匹配。

3]、带有密码的AdminPassword用于进行身份验证。

如果vCenter Server具有自签名证书,请确保将insecure_skip_verify标志设置为true:

insecure_skip_verify = true

进行更改后启动并启用Telegraf服务:

sudo systemctl restart telegraf

sudo systemctl enable telegraf

三、检查InfluxDB指标

我们需要确认我们的指标被推送到InfluxDB并且可以看到它们。

1、打开InfluxDB shell

使用身份验证:

$ influx -username ‘username‘ -password ‘StrongPassword‘

Connected to http://localhost:8086 version 1.6.4

InfluxDB shell version: 1.6.4

1]、 ‘username‘ - InfluxDB身份验证用户名。

2]、‘StrongPassword‘ - InfluxDB密码。

没有认证:

$ influx

Connected to http://localhost:8086 version 1.6.4

InfluxDB shell version: 1.6.4

切换到我们在telegraf上配置的vmware数据库:

> USE vmware

Using database vmware

检查时间序列指标是否inflow:

> SHOW MEASUREMENTS

name: measurements

name

----

cpu

disk

diskio

kernel

mem

processes

swap

system

vsphere_cluster_clusterServices

vsphere_cluster_mem

vsphere_cluster_vmop

vsphere_datacenter_vmop

vsphere_datastore_datastore

vsphere_datastore_disk

vsphere_host_cpu

vsphere_host_disk

vsphere_host_mem

vsphere_host_net

vsphere_host_power

vsphere_host_storageAdapter

vsphere_host_sys

vsphere_vm_cpu

vsphere_vm_mem

vsphere_vm_net

vsphere_vm_power

vsphere_vm_sys

vsphere_vm_virtualDisk

>

四、将InfluxDB数据源添加到Grafana

登录Grafana并添加InfluxDB数据源,指定服务器IP、数据库名称和身份验证帐户:

给它命名,选择类型,指定服务器IP:

提供数据库名称和身份验证帐户:

保存并测试设置:

五、导入Grafana仪表板

我们已将所有依赖项和测试配置好,最后一项操作是创建或导入将显示vSphere指标的Grafana仪表板。

登录你的Grafana并导航到Dashboard导入部分,使用仪表板ID导入,链接如下:

https://grafana.com/dashboards/8159

https://grafana.com/dashboards/8162

https://grafana.com/dashboards/8165

https://grafana.com/dashboards/8168

操作截图如下:

成功导入后,应该能看到仪表板上显示的数据了,如下图所示:

看到如上图,表明导入Grafana全部成功了。

相关主题

原文地址:https://www.cnblogs.com/jinanxiaolaohu/p/11277267.html

时间: 2024-08-12 05:00:58

[转帖]使用Grafana和Telegraf监视VMware ESXi的方法的相关文章

dell r730 xd 安装vmware esxi 5.5 u1

今天公司上架一台dell r730 xd,需要安装vmware esxi 5.5,进行过程中遇到一些问题,导致预计半小时结束的工作,持续了近四个小时. 问题1:服务器是1U,硬盘满配,没有光驱 答:多亏待了U盘,于是做了U盘启动 问题2:不识别磁盘阵列 答:在bios中修改磁盘模式为ATA 问题3:提示"buffer 太小" 答:安装模式选择"UEFI",并且把U盘启动放在第一个,否则会导致无法安装 问题4:通过终端无法进入bios设置 答:可以通过IPMI进入,选

安装VMware ESXi 6的配置方法图文教程

前期准备:将VMware ESXi 6的安装镜像要提前准备好,并且保证主机需要6GB以上的内存(创建4GB.2CPU.40GB硬盘的虚拟机). 具体配置步骤: 1.版本选择:VMware Workstation中创建'VMware ESXi'的虚拟机.在VMware Workstation 11上,版本选择为'VMware vSphere 2015 Beta版'. 2.加载VMware ESXi 6 RC版的ISO文件,ESXi引导装入程序,并且开始安装. 3.在ESXi引导装入过程,窗口上可以

UltraISO制作U盘启动盘安装Vmware ESXI 5.5 中途卡住解决方法

使用UltraISO制作u盘启动选择打开iso文件,然后选择启动--写入硬盘映像即可 这样制作的U盘启动盘在安装系统时需在Bios选择HDD的安装模式 最近安装Vmware ESXI 5.5,VMware-VMvisor-Installer-5.5.0.update01-1623387.x86_64.iso 按照惯例使用HDD的安装模式安装,总是在安装到中途卡住,尝试了多次,都是一样的结果. 最后查了一下,BIOS中尝试使用EFI的安装模式安装,一切顺利, esxi 5.5  6.0同样的解决方

VMware ESXI 搭建

VMware ESXI 搭建 云计算 时间:2016年10月28日 博客:www.abcdocker.com 微信公众号:abcdocker 笔者QQ:381493251 Abcdocker交流群:454666672 如果遇到什么问题可以进群询问,我们是一个乐于帮助的集体! 版权介绍 本软件安装使用方法由强哥指导讲解,章曾整理总结. 提前制作U盘镜像启动 小朱测试pc机不能使用,镜像测试的话可以使用vmwear里边添加硬盘第三项   其中三个   最后一个是U盘 必须使用U盘启动盘制作 VMwa

VMware ESXi启动卡在 vmkibft loaded successfully

VMware ESXi 启动卡在 vmkibft loaded successfully 这里 前一段时间有一台测试VMware ESXi6.0 主机突然失去连接,去现场查看,系统已死机. 重启机器卡在vmkibft loaded successfully这里,百度了一下果断换Google. 发现了蛛丝马迹,有人说是磁盘坏了,有人说将系统装在USB上面尝试一下.. . 因为觉得磁盘不应该影响系统启动,折腾一番USB无果,尝试排查磁盘问题. 但是磁盘灯都是正常的,只好采取笨办法,卸载全部磁盘,一块

【ESXI6.0】Vmware ESXI 6.0 【Customize System/View Logs】简介

Vmware ESXI 6.0 安装完毕后重启进入如下界面. 按F2进入系统设置与日志查询.会要求输入帐号密码.如下图 进入后界面如下图 Configure Password 修改密码简单不表.符合密码策略即可.至少7位,有字母数字. Configure Management Network 配置网络 回车进入后界面如下图 Network Adapters进入后可以查看网卡数量,如下图 VLan配置,暂时不太明白. 进IPv4 Configuration 配置IP地址,如下图. Configur

VMware ESXi中不能显示CPU及内存使用情况的解决方法

今天一个网友问我,他管理的机房有4台ESXi 5.1的服务器,其中三台ESXi Server不能显示各个虚拟机占用的CPU.内存情况了,如图1-1所示. 图1-1在"虚拟机"选项卡中不能显示每个启动虚拟机的资源占用情况 另外,在VMware ESXi的"摘要"中,CPU与内存的使用情况也统计出错,如图1-2所示. 图1-2 摘要统计出错 在出现这个问题时,各个ESXi Server上的虚拟机可以正常启动.关闭,并且各虚拟机运行的系统及应用不受影响. 从上面两个图我看

【VMware虚拟化解决方案】备份VMWare ESXi虚拟机

备份VMWare ESXi虚拟机 VMware Data Recovery(简称VDR)介绍: VMware DataRecovery是vSphere新提供的数据备份功能,是一种基于磁盘的数据备份方式,不支持以磁带为目标的备份.VDR由vc插件.运行在ESX主机上的虚拟机以及备份存储这三个部件组成.通过在vc上的插件以向导的方式进行配置和调度备份任务. VMwareData Recovery 可创建虚拟机备份,同时不会中断虚拟机的使用或其提供的数据和服务.Data Recovery会管理现有备份

VMware ESXi vsan.v00卡 停

重装VMware ESXi 6.5,结果在loading vsan.v00文件的时候卡住了,过了几个小时都停留在这个界面.无意间重启使用UEFI 启动,提示某文件校验出错,MD5对不上,重新写入安装镜像到U盘,很快就OK了. 不明白U盘安装文件怎么会被修改?上次安装完了之后当普通U盘复制转移文件,没动过安装文件阿,而且vsan.v00这个文件也不是普通文件,百思不得其解.