ESXi SMART - Extract data and present as website

Recommended Posts

Good afternoon all, and a happy new year to you all.


So I use VMWare ESXi to host my Synology 6.2 - and though I know there's a plugin to retrieve SMART data, for me it doesn't work. Presumably because my server is a mish mash of random hardware; that or I'm too lazy to bugfix.

Something I've wanted to do for as long as I can remember is to extract SMART data from ESXi and add to a database, then present it as a website that's super easy to read.


What the site does

Well, as you can see from the image below, I have ESXi SMART data presented in an easy to read format for each of my drives, as well as other important information such as RDM location, what drive number the hard drive is on the vm host, if it's an SSD, etc, etc. It also presents you with 5 hours worth of temperature changes, just in case like me you panic every time the sun comes out.



How does it work?

OK so I'm a PowerShell developer. The site was built as a learning curve using PHP - it is not my natural environment. Bash is like a totally foreign language to me and one I'm not comfortable with, so I acknowledge this is a long ass way around doing this. Nevertheless, it works and I know every single aspect of what it's doing.

A PowerShell script runs as a scheduled task on a Windows machine, rips data straight out of ESXi and imports it into a MariaDB database. 

In my case I have a Windows 10 device on my ESXi host running said script, with my Xpenology OS hosting both the database and website. 


How do I install it?

You want a Windows device running 24/7, since this device will be ripping SMART data every thirty minutes (or whatever schedule you give it). With that in mind you're best off using your ESXi host for your Windows machine.


  • This website explains how to download Windows 10 without a key (this is totally legit. Downloading without a key is different to installing without a key which I do not recommend!)
  • Once you have your windows device up and running, open PowerShell as an administrator and type: 
    Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Confirm:$false


  • Next, you'll want to hit my BitBucket repo here and download both repos. The one specific to ripping data out is called ESXiSMART 
  • Extract the contents of the zip file and check out the file for complete instructions. This will explain how to set up a scheduled task.


NOTE: There are a few steps you need to take before the scheduled task will work.

  • Create your scheduled task .ps1 file as per the file, then wherever you save it, open PowerShell in the same folder and run the .ps1 file from the PowerShell console. This is important as it'll download the VMWare plugins and if MySQL dll file is missing, give you the link to download and install it. This information is contained within the file but the script will prompt you for action if you can't be bothered to read it.


OK I have a scheduled task running, and I can see the database on myphpadmin, now what?

Well now you want the website. Which can be found at the same BitBucket url.

There's instructions there on how to host. This has been tested on both XAMPP and Synology. 


It's working! But the temp graph is just showing the same temp every time!

Yeah it shows the last 10 entries, so just be patient.


It's not working! What should I do?

Post here obviously, with your bugs, and I'll try resolve it for you.


This is nice, but it could be better!

Oh totally. Well, feel free to make your own changes. Totally open source. Or, if you have suggestions and no coding skills, just let me know what you'd like.
I'd like to do a version 2 of the website which includes alerting. I can do this in PowerShell fairly easily but as I'm learning PHP would sooner take my time and do it through here.


You know there's an easier way to get smart data out of VMWare without a Windows machine and PowerCLI right? 

Yeah I know. But bash is alien to me. With PowerShell and PHP I know what each command does and the risks involved. With bash I'm just typing out stuff totally unknown to me and hoping very bad things aren't happening under the hood. So I totally welcome any easier approach to this. If you know bash and want to help out, I'm very keen to have you on board. In fact, I encourage it. There's a guide here on how to get extended SMART data from ESXi which includes Total Bytes Written on SSD's. But it means installing stuff on ESXi and I'm not comfortable doing it. If you want to help build a tool that installs smartctl and runs it as a scheduled task, please do. Not having to use a Windows box to get SMART data out is the perfect scenario.


Are there any licenses I should be aware of?

Nope. Well. A windows license, but (and this hasn't been tested as mine is totally legit) I believe you could run a scheduled task without activating Windows. If someone can confirm I'll update this post. MySQL is free, PowerCLI is free, and the images used on the website are from Pixabay under open source license agreements.  


  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.