I have been working on a daily check report for our VMware environment so that we don’t have to manually check each morning.
The report uses PowerCli to generate information and then output the results to a HTML file.
The report requires a few that either the old PowerCLI snapin is available or preferably the PowerCLi PowerShell module.
The script can either be run directly by a users with rights to query vCenter or by setting up a scheduled task.
The following prerequisite will be needed for the script to run.
PowerShell V4 or V 5
PowerCLI 6.0 or later version
vCenter 6.0 or later version
There will also need to be a mail server or relay server available for the report to be emailed.
This has been tested on PowerCLI version 6.0 and above. The version on the server I will be running from is 12.3.0 which is the latest release at this time.
The report checks
VMware tools check
Snapshot older than the specified snapshots days
vCenter Alerts over the last 12 hours
Datastore under specified % free space
There are mandatory parameter that are required for the script to run and send the report.
VCServer = vCenter Server address
SMTPServer = Mail server address
Toaddress = destination email
Fromaddress = sending address
Report Export = folder report will be exported to
There are some variables at the start of the script that can be set to customize the report to only show the required snapshots days and datastore % free. In my case I wanted 3 days and below 20% free on datastores.
I have embedded the html CSS format in the script so it can be update to change the color, font size or font type.
We first checked the temporary location that feature update deploys to c:\$Windows.~BT, to check if there was any issue in the compatibility xml file or in the setup logs under sources\panther, but there was no folders other than sources.
Since there was no files I though this might be a space issue so ran some remote WMI commands to check the disk space available. I used the below PowerShell using Get-WMIObject.
In the previous seven post’s we went through installing and configuring the vROps virtual appliance, connecting to vCenter server, configuring Window Active directory as an identity source, create custom alerts and notifications, creating dashboards, upgrading the appliance to the latest version and requesting / configuring a custom SSL cert.
In this post we will be going through installing the Windows agent and configuring the management pack to alert on Windows server OS level alerts like performance, services and application. This can be useful for monitoring physical servers running Windows.
Below is a link to the VMware document on vROps agent deployment I used for reference.
Once we have the agent, we can deploy to the servers that need to be monitored.
Copy the file to the server and run installer.
Add in the vROps server when prompted to
Next the installer will look for the thumbprint for the cert that is used for vROps. Logon to https://vrops/admin and click on the cert icon on the top right to view the current cert details.
Enter the user name and password that will be used to connect to vROps.
Set the install location the default is to install in c:\ep-agent this can be change if required.
The agent should now start to install.
We can run ep-agent.bat query from the install folder ep-agent\bin to confirm the agent has installed correctly.
Once completed we can check vROps to confirm the agent is reporting back, to view the agent in vROps logon to the web client > Administration > End Point Operations.
To view details for the server go to Environment > Operating Systems > Operating System World > Windows and select the server to view.
Once the server is added we can now monitor disk, CPU, memory and other metrics.
We can also monitor services.
To add a service to be monitored,
Go to server and click on action > monitor os object > monitor windows service
Give the monitor a name, select the object type and add in the service name (this needs to be the actual name and not the display name)
Set the collection interval. Click ok to to create the monitor.
Click on Environment and we can view the service monitor we just added.
If we stop the service the next time the collection runs the service should show a critical alert.
We can add addtional metrics if needed. In this example we might want to see the logical disk space % free.
First we either need to modify the existing policy or create a new policy.
In this example we will be adding a new policy and inherting from the default policy.
Go to Policies and click add, give the policy a name and select where it will be inherit from. Then click create policy.
Go to the policies and click on the policy we just created and go to edit policy.
We will be adding a metric so we will select metrics and properties and enable the required metrics.
% free is under EP Ops Adapter > Windows >Fileserver Logical Disk > Utilization and % Free space (%).
Set the policy state to enabled.
Next we can apply the policy to either the object or if there are a lot of device it would be easier to create and apply to a custom group.
Now we can go to the server and confirm the policy is applied.
After a few minutes we can check the server object we can see the new metric and the data start to be shown.
Now that we have the metric showing next we can create an alert.
First we will need to create a symptom definition. Go to symptom definitions and click add.
Select the metric that will be used and give the symptom a name and set the threshold.
We can search to for the symptom to confirm it exist.
Next we need to create the alert. Go to alert definitions and click add.
Give the Alert a name and select Windows as the base object type.
Next we need to add the symptom we created.
Add a recommendation if any are applicable or create a recommendation (this is not required but can be usefully)
We need to add to a policy in this case it’s the Windows_Server_Agent and create a notification if this is required.
We can search for the alert to confirm it has been created and to view the details.
Now when the server goes below 10% free disk space the server will alert.
Below is what the email notification will look like, we have configured email notification in a previous post so we wont go back over it here.
There are many metrics and alerts that can be configure this is just an example of one type. We can also create multiple alerts so that we get warning alerts at maybe 20% before getting a critical alert.