Pre-Reqs

Install Ubuntu Server 16.04 or 18.04 as you like. Then proceed with the instructions below to configure an all open source performance monitoring kit for your VMware vSphere infrastructure.

Here we will get everything setup, including InfluxDB, Grafana, PowerShell and PowerCLI. Please see my related github module Fluxor for gathering and writing stats to the system we build here today.

Learn more at https://github.com/vmkdaily/vFlux-Stats-Kit/

To see this deployment on CentOS, check out Collecting and Visualizing vSphere Performance Metrics with PowerCLI, InfluxDB and Grafana on CentOS 7


SECTION I - Users


Create Users

Optionally, add users.

sudo adduser influxdb
sudo adduser grafana
sudo adduser mike #yourname here

Add to sudo

usermod -aG sudo influxdb
usermod -aG sudo grafana
usermod -aG sudo mike #yourname here


SECTION II - Install PowerShell


Login as the user that will be running the stats collections.

Install PowerShell Core

For this step we will use a new feature and install PowerShell Core as a snap. This will install at the machine level and your other users will have access to this.

sudo snap install powershell --classic

In the above, --classic is a snap parameter and is not related to PowerShell. For more details about Linux snap apps see the official snapcraft documentation.

Launch PowerShell

For Powershell preview use pwsh-preview and for stable, use pwsh.

pwsh

Show version

$PSVersionTable

Check If PowerShell Profile Exists

First we will test if our PowerShell $PROFILE exists. If it does not, we will create one. The $PROFILE we create here is per user.

Test-Path $PROFILE

For the above (and all PowerShell), use your tab completion where possible. If you have sound, notice that you get a ding on failures to tab complete. This can get annoying and we will add the fix for that to our $PROFILE soon.

Create PowerShell Profile

If Test-Path $PROFILE returned $false above, then we create one now.

New-Item -Type File -Path $PROFILE -Force

Populate PowerShell Profile

Let's add our first entry to the profile. This will stop the console bell.

Add-Content -Path $PROFILE -Value 'Set-PSReadlineOption -BellStyle None'

Reload PowerShell

Test your tab complete one more time. That bell is still going on failures. We can relaunch PowerShell, or simply reload our profile.

& $PROFILE


SECTION III - Install PowerCLI


Check if PowerCLI is installed

Get-Module -ListAvailable -Name VMware.PowerCLI

Install PowerCLI

Install-Module VMware.PowerCLI -Scope CurrentUser

Show PowerCLI Configuration

Get-PowerCLIConfiguration -Scope User

Configure PowerCLI

Set-PowerCLIConfiguration -Scope User -InvalidCertificateAction Ignore
Set-PowerCLIConfiguration -Scope User -DisplayDeprecationWarnings:$false

SECTION IV - Install InfluxDB


Add InfluxDB Repository

curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/lsb-release
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

Install InfluxDB

sudo apt-get update
sudo apt-get install influxdb

Confirm influx binaries exist

which influx
which influxd

List InfluxDB related files

ls -lh /usr/bin/influx*

Optionally, Add permissions for influxdb

sudo chown influxdb:influxdb /usr/bin/influx*

Start InfluxDB

sudo systemctl start influxdb

Check InfluxDB Status

systemctl status influxdb

Use the InfluxCLI (required)

The InfluxDB commandline is used for creating users, databases, and more. To access the cli type the following from your SSH or console session:

influx

Create InfluxDB Users

Using the influx CLI, we will create a user called esx with a password of esx. Type the following into your influx CLI session and press enter.

CREATE USER esx WITH PASSWORD 'esx' WITH ALL PRIVILEGES

Tip: Influx commands only return interactive messages on failure. So after hitting enter above, if you get no feedback, this is good.


Note: For full details on InfluxDB authentication see https://docs.influxdata.com/influxdb/v1.6/administration/authentication_and_authorization

Create InfluxDB Databases

Here we create databases for iops, compute and summary.

CREATE DATABASE iops
CREATE DATABASE compute
CREATE DATABASE summary

Show InfluxDB Databases

From theinflux CLI, we can use the SHOW DATABASES command. We will always see _internal which is the default used by the system. We can also see the databases we added (iops, compute and summary ).


Connected to http://localhost:8086 version 1.6.1
InfluxDB shell version: 1.6.1
> SHOW DATABASES
name: databases
name
----
_internal
iops
compute
summary
>

Tip: To clear your screen in the CLI press <CTRL> + l (lower or uppercase L both work).


SECTION V - Install Grafana


Add the Grafana Repo

Here we will use vi to add the Grafana repo. If you prefer, you can use nano instead.

sudo vi /etc/apt/sources.list

Press i for insert mode, and paste in the following:

deb https://packagecloud.io/grafana/stable/debian/ stretch main

Type :wq! and hit <ENTER> to save.

Add the key

curl https://packagecloud.io/gpg.key | sudo apt-key add -

Install Grafana

sudo apt-get -y update
sudo apt-get -y install grafana

Enable Grafana

sudo systemctl daemon-reload
sudo systemctl enable grafana-server

Optionally, change owner

sudo chown grafana:grafana /usr/sbin/grafana*
sudo chown -R grafana:grafana /etc/grafana/

Start grafana-server

sudo systemctl start grafana-server

Show Grafana Status

systemctl status grafana-server

Login to Grafana Web interface

By default, the port used will be 3000. The login is admin admin. When prompted to reset it, you can press skip.

http://<IP Address or DNS Name>:3000

Add default databases

In Grafana, click Add Datasource and populate all desired fields. Be sure to click on the InfluxDB server url, change it into a drop-down, and then click it. You cannot target InfluxDB as a datasource until you change the text from gray to white by clicking it.

Example - Inactive datasource:
Grafana-Add-Datasources-URL-Inactive

Example - Active datasource
Grafana-Add-Datasources-URL-Active

Click the URL of the InfluxDB server to activate.

SCP the Scripts

Use WinSCP or similar to copy the desired .ps1 scripts or modules to the Ubuntu Server. If you will use the Fluxor module can you copy the entire Fluxor folder to your $HOME directory.

Summary

In this article we got you up and running with the basic framework to handle open source stats collection. Next, you can follow the Fluxor module documentation to learn how to run the scripts and schedule tasks with crontab.

https://github.com/vmkdaily/vFlux-Stats-Kit

Appendix

When creating dashboards in Grafana set the fill to none or the stats might not appear:
Example---Gathering-Initial-Compute-Stats---A-Test-Run