login vsi company logo login vsi company logo 250x40
header-05.jpg

How to configure Login PI to send alerts via e-mail

How to configure Login PI to send alerts via e-mail

A huge advantage of Login PI is the fact that it will automatically generate alerts about performance in your virtualized desktop environment--before your end users start to notice issues. These alerts are displayed in the Login PI event log. But what if you are not checking the interface because you are off getting a nice cup of coffee? Wouldn’t it be great if you could automatically receive these alerts in your email Inbox as well? In this blog post I will explain how to set up Login PI to send alerts via email.

You may also be interested my colleague Omar’s recent post that goes into greater detail on associating tasks with PI alerts – today’s post shows how you can generate an email in one of those tasks.

Login PI writes every warning/error in the event log. With the task scheduler (built into Windows) you can attach tasks to the event log. So, let’s get started.

First, we should create a script that can mail the event logs. An easy way to do this is by copying the one I’ve made below. Don’t forget to adjust the email addresses and SMTP server settings: username, password, SMTP server and port (otherwise I will receive all your alerts ). Save the file afterwards as a PowerShell file (.ps1). Remember the location where you saved it because we will need it later on.

$event = get-eventlog -LogName "PI - Alerts" -newest 1
$EmailBody = $event.Message
$EmailFrom = "change.this@example.com"
$EmailTo = "change.this@example.com" 
$SMTPServer = "smtp.office365.com"
$username = "change.this@example.com"
$passwordtext = "MyP@ssw0rd!"
$password = ConvertTo-SecureString -AsPlainText $passwordtext -Force
$credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
if ($event.EntryType -eq "Warning")
{
    Write-host "Sending Email Warning"
    $EmailSubject = "Login PI - Warning"
}
elseif ($event.EntryType -eq "Error")
{
    Write-host "Sending Email Error"
    $EmailSubject = "Login PI - Error"
}
Send-MailMessage -From $EmailFrom -To $EmailTo –Subject $EmailSubject –Body $EmailBody -SmtpServer $SMTPServer -Credential $credentials -UseSsl -Port 587 

Now that we have created a mail script, we can open the event log. On the server where Login PI is installed, we go to Application and Services Logs -> PI Alerts. Right-click PI - Alerts and click Attach a Task To this Log.

how to configure login pi to send alerts via e mail attach a task to this log

A Create Basic Task Wizard will appear. Enter your task a name and continue until you can add the program or script. Add the powershell.exe in the program/script bar and add the mail script as argument. Place the ‘-file’ parameter in front of it. Be aware that if your PowerShell- or mail script location contains white spaces you will need to add quotes.

how to configure login pi to send alerts via e mail create a basic task

After we’ve added the script and pressed Next, we should mark as open the properties of the new task. Also make sure to select ‘Run whether user is logged on or not’ option, otherwise you will not be notified when you are logged off.

how to configure login pi to send alerts via e mail jasper geelen

The job is done! Time to relax and grab a cup of coffee until you get alerted.

About the author

Jasper Geelen (@jaspergeelen) has a background in ICT and joined Login VSI as a pre-sales engineer in 2015. He loves drinking a lot of coffee (some might call him an addict). In his spare time, Jasper enjoys a beer and he is part of a football / soccer team. He also coaches a team of younger football players.


Tags: How-to, Login PI, Monitoring, Best Practices, Support, Scripts

What our customers are saying

Chris Gebhardt - NetApp

“We use Login VSI to make sure that what we are recommending to our customers is much better than what their guesses are. Because if you don't do proper assessment and if you don’t use Login VSI, your architecture is just a guess.”

Chris Gebhardt, Senior Technical Marketing Engineer at NetApp


Shaun Donaldson - Bitdefender

"As a software vendor, the reason that we became a Login VSI customer is that we wanted to see how we compared to our competitors. After talking to VMware and Citrix about how they test their products, it became clear to me that we needed to follow our strategic partners and be able to show how our product compares favorably to our competitors. We just completed a round of tests using Login VSI and you will see white papers showing performance data."

Shaun Donaldson, Alliances Director at Bitdefender


Manoj Doshi - Aetna

"Login VSI gives you a true picture of performance in your environment, whether you’ve built it right or need to make changes. When you don’t have room for mistakes, Login VSI provides you with the confidence and assurance that the environment is going to work."

Manoj Doshi, Director - Client Technology Innovation at Aetna

Login VSI, Inc.

300 Tradecenter

Suite 3460
Woburn, MA 01801

Phone: +1 844 828 3693

Login VSI B.V.

De Entree 85
1101 BH Amsterdam
The Netherlands

Phone: +31 20 705 1200