Greetings guys!. Here I present to you the most efficient and amazing way to Monitor your VMware ESXi infrastructure with Grafana, Telegraf, and InfluxDB. The setup is pretty straightforward and you should have your VMware metrics visualized on Grafana in less than 30 minutes. Our last VMware monitoring was on How To Monitor VMware ESXi Host Using LibreNMS.
This setup uses an official vSphere plugin for Telegraf to pull metrics from vCenter. This includes metrics for vSphere hosts compute(RAM&CPU), Networking, Datastores and Virtual Machines running on vSphere hypervisors. So let’s get started.
Step 1: Install InfluxDB and Grafana
All collected metrics are stored in InfluxDB database. Grafana will connect to InfluxDB to query and display metrics on its dashboards. You need to install both InfluxDB and Grafana before other stuff.
- How to install InfluxDB on Ubuntu , Debian and on CentOS
- How to Install Grafana on Ubuntu and CentOS
Once both InfluxDB and Grafana are installed, proceed to install and configure Telegraf which is a powerful metrics collector written in Go.
Step 2: Install and Configure Telegraf
If you used links on step 1 to install InfluxDB, the repository required for Telegraf installation was added. Just use the following commands to install Telegraf.
# CentOS
sudo yum -y install telegraf
# Ubuntu
sudo apt-get -y install telegraf
After installation, we need to configure Telegraf to pull Monitoring metrics from vCenter. Edit Telegraf main configuration file:
sudo vim /etc/telegraf/telegraf.conf
1.
Add InfluxDB output storage backend where metrics will be stored.
# Configuration for sending metrics to InfluxDB
[[outputs.influxdb]]
urls = ["http://10.10.1.20:8086"]
database = "vmware"
timeout = "0s"
username = "monitoring"
password = "DBPassword"
Replace 10.10.1.20
with your InfluxDB server IP address. if you don’t have authentication enabled on InfluxDB, you can safely remove the username
and password
line in the configuration.
2.
Configure vsphere
input plugin for Telegraf. The complete configuration should look similar to this:
The only variables to change on your end are:
- 10.10.1.2 should be replaced with the vCenter IP address
- [email protected] should match your vCenter user account
- AdminPassword with the password to authenticate with
If your vCenter server has a self-signed certificate, make sure you turn insecure_skip_verify flag
to true.
insecure_skip_verify = true
Start and enable telegraf service after making the changes.
sudo systemctl restart telegraf
sudo systemctl enable telegraf
Step 3: Check InfluxDB Metrics
We need to confirm that our metrics are being pushed to InfluxDB and that we can see them.
Open InfluxDB shell:
With Authentication:
$ influx -username 'username' -password 'DBPassword'
Connected to http://localhost:8086 version 1.6.4
InfluxDB shell version: 1.6.4
- ‘username‘ – InfluxDB authentication username
- ‘StrongPassword‘ – InfluxDB password
Without Authentication:
$ influx
Connected to http://localhost:8086 version 1.6.4
InfluxDB shell version: 1.6.4
Switch to vmware
database we configured on telegraf.
> USE vmware
Using database vmware
Check if there is inflow of time series metrics.
> 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
>
Step 3: Add InfluxDB Data Source to Grafana
Login to Grafana and add InfluxDB data source – Specify server IP, database name and authentication credentials if applicable.
Give it a name, choose type, specify server IP.
Provide database name and authentication credentials if applicable.
Save and test settings.
Step 4: Import Grafana Dashboards
We have configured all dependencies and test to be working. The last action is to create or import Grafana dashboards that will display vSphere metrics.
In this post, we will use great Grafana dashboards created by Jorge de la Cruz.
- Grafana vSphere Overview Dashboard – 8159
- Grafana vSphere Datastore Dashboard – 8162
- Grafana vSphere Hosts Dashboard – 8165
- Grafana vSphere VMs Dashboard – 8168
Login to your Grafana and navigate to the Dashboard import section. Use Dashboard IDs to import.
On successful imports, you should start seeing data appearing on the dashboards.
The visualization may need your little extra effort to get perfect displays for your environment and specific metrics to be shown.