How to: Setup ESXi alerting monitor with email notification

Many times I wanted to see if I could send a notification by mail about the status of my ESXi machines. There seems to be a solution by using PERL and VMWare VSphere CLI. Firstly you will need to download and install the PERL and VMWare VSphere CLI and here are the links to download them.

Note: This is for the free ESXi version


VMWare VSphere CLI

After you download the above, install them. It’s simple as it’s just Next, Next, Next.

Now to create the batch file script. Use the following to send an email of the ESXi server with all the information including alerts.

"C:\Program Files\VMware\VMware vSphere CLI\Perl\bin\perl.exe" --server [serverip] --username [username] --password [password] --mailhost [smtpserver] --maildomain [domain name] --mailfrom --mailto;

If you want to send only an email with alerts (if there are) use the following batch file script

"C:\Program Files\VMware\VMware vSphere CLI\Perl\bin\perl.exe" --server [serverip] --username [username] --password [password] --mailhost [smtpserver] --maildomain [domain name] --mailfrom --mailto; --cpuwarnpc 85 --memwarnpc 85 --dswarnpc 25 --dscriticalpc 10 --warnofsnapshots --warnonchange --warnonalerts --concise --logfile esx-health.log --statusfile esx-health-status.txt

Note: The script is looking for the perl.exe under the VMWare CLI. If you change the location of the CLI installation, change the first part of the script.

Script download:

Leave a Reply

Your email address will not be published. Required fields are marked *