Monitor your vSphere workload using Grafana

VMware vSphere is an enterprise grade virtualization platform and having a data visualization tool integrated to it is like icing on the cake. Grafana is an opensource platform that provides great support to query, visualize, alert and understand the vSphere metrics using some really cool dashboards.

For this integration we will use the following Grafana vSphere dashboards:

 A big thanks to Jorge for developing such nice dashboards to visualize the vSphere data in Grafana.

Components to integrate this solution:

  • vSphere 7.x 
  • Docker images: 
    • grafana (v7.5.4)
    • influxdb (1.8.5)
    • telegraf (1.18.1)

  

While preparing this integration document, dashboards were supporting only the InfluxQL as the query language. And that's the reason I have used influxdb v1.8.5. Because the latest influxdb v2.0 wont support InfluxQL instead its having Flux which is the advanced version of InfluxQL.

Data Flow:

 

  • Telegraf is an opensource server agent that will collect metrics data from vSphere Server.
  • InfluxDB is an opensource time series db that'll store the metrics data collected by telegraf.
  • Grafana will populate the data in the dashboard by collecting it from InfluxDB.

 

 For this deployment we have used the docker images and host port binding approach. Each container will run with their respective ports inside the container. Let's continue with the configuration by following the below steps:

Pull docker images:

Get the required docker images on the docker host in order to start the deployment:

    # docker pull grafana/grafana

    # docker pull telegraf

    # docker pull influxdb:1.8.5

 

Configure InfluxDB:

Run the influxdb container by using the below command. This will bind port 8086 on the docker host with port 8086 in the container:

    # docker run -d -it -p <docker-host-ip>:8086:8086 --name=influxdb influxdb:1.8.5

Once the influxdb container is ready, login to the container from docker host and create the 'admin' user with some password and allow all the required permissions to push the data by telegraf as mentioned in the below images showing how to perform the required steps:

    1. Go to the 'influxdb' container.

    2. Execute the command with admin user and your own password. 

    3. Use the 'influx' command and go to the db console.

    4. Use the 'show users' command to see the newly created user details.  


 Now influxdb is ready to receive the data when telegraf is ready to push it after collecting from vSphere Server.

 

Configure Telegraf:

Telegraf container need to have the vSphere credentials along with the influxdb configuration. Generate the telegraf.conf file by using the below command:

    # docker run --rm telegraf telegraf config > telegraf.conf

Modify the telegraf.conf file along with your vSphere and fluxdb details as mentioned below template file:

Then run the telegraf container using the below command to load the configuration file:

    #  docker run -d -v /root/telegraf.conf:/etc/telegraf/telegraf.conf:ro --name=telegraf telegraf


Configure Grafana:

Run the grafana container by using the below command. This will bind the port 80 on the docker host with port 3000 in the container:

    # docker run -d -it -p <docker-host-ip>:80:3000 --name=grafana grafana/grafana

Now start browsing the grafana url in your system's browser to complete the remaining configuration:

        URL: http://<docker-host-ip>/login

       

        Default grafana login is admin/admin. Change the password on the first login.

To configure the data sources, go to Configuration ->Data Sources

       

You will see the following page. Click on the 'Add data source':

         

Select 'InfluxDB':

         

Fill all the information as shown in the below image with correct docker-host-ip address and port:

Then Click on 'Save & Test' and you should be able to see a message like below one:


Import Dashboard:

Now your grafana configuration is ready. You have to import all the 4 dashboards as mentioned in the beginning of this article. To start the import process, follow the below steps:

         

Every dashboard is mapped with a number. Collect the number as mentioned in the below image:

 

Enter the number and click on 'Load' to get the dashboard and select the InfluxDB and click on Import:

 

 

Repeat the above process for importing the remaining 3 dashboards. Once all the import is complete, go to the Manage -> General folder and start checking all the dashboard one by one. You should  be able to see the data:

 

Once you will select the VMware vSphere - Overview dashboard, you should be able to see the data something like below. For this demo, I have integrated telegraf with 3 vCenters and the dashboard is going to look something like below one:

 

More tuning can be done at the top drop-down to select individual vCenter and then you can check their cluster level data. If required, you can create your own dashboard as well by simulating more InFluxQL queries.

Comments

Popular posts from this blog

VNC Configuration using Ansible in CentOS 7

How to build Ubuntu Server 20.04 LTS OVA with vAPP Properties ?

LVM Configuration using Ansible in CentOS 7