This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Including specific $Message variables in e-mail alerts from PowerShell monitors that contain multiple mess/stat pairs

Good Afternoon,

We are on SAM 6.4 / NPM 12.2. I have several PowerShell monitors that have multiple pairs of Messages/Statistics. I am aware of two ways to write out the message in the email alert:

${ComponentMessage}

${N=SwisEntity;M=ComponentAlert.MultiValueMessages}

The first writes out a single message. If your monitor has multiple messages, from what I can tell is it'll use either the first message or the one that caused the monitor to trigger. I am really not sure on what decides which single message is used when using the ${ComponentMessage} variable. The second variable writes out every single message variable that the monitor contains in a single line.

For example here is the end of my powershell monitor's script:

# Writing the results out for SolarWinds

Write-Host "Message.GoodTasks: Tasks in a Good state: $mess1";

Write-Host "Statistic.GoodTasks: $stat1";

Write-Host "Message.BadTasks: Tasks in a Bad state: $mess2";

Write-Host "Statistic.BadTasks: $stat2";

Write-Host "Message.RunningTasks: Tasks in a Running state: $mess3";

Write-Host "Statistic.RunningTasks: $stat3";

Write-Host "Message.DisabledTasks: Tasks in a Disabled state: $mess4";

Write-Host "Statistic.DisabledTasks: $stat4";

And here is how ${N=SwisEntity;M=ComponentAlert.MultiValueMessages} would write out in my e-mail:

BadTasks:Tasks in a Bad state:, DisabledTasks:Tasks in a Disabled state:, GoodTasks:Tasks in a Good state: Task1, Task2, RunningTasks:Tasks in a Running state:

This is not ideal. I would much rather have more control over how and what are displayed in the e-mail. Now, I did experiment with using a single message variable that included the info I wanted + the HTML formatting to make it attractive. I am not a fan of that work around though. It would be really cool if something like ${ComponentMessage.<messagevariablename>} would work, but it does not. Are there any other solutions for this outside of dumping all $mess variables into a single one and utilizing HTML to get the format I want?