I didn't realize this feature got added – very nice.

 

In OpsMgr SP1 – we had to use some hacks to get the Alert Description formatted to be nicely readable.  I wrote about this HERE.  The problem was – we could add a </BR> to the alert description and get this to work in SP1 – but in the email subscriptions – it was not formatted the same way and showed the <BR /> in text.  You you could have good readable emails or good readable alerts – but not both.

 

Now – in R2 – this is a much better story.

 

When authoring a rule against a test event, I can now hit “Enter” and start a new line, just like it should be:

 

image

 

In the console, this now formats exceptionally well – as expected:

 

image

 

 

However – the email is close – but not perfect.  This works most of the time as designed – but occasionally the email subscription does not pick up on the carriage returns.

 

 

image

 

 

Note the blobs in yellow above – this is where the Carriage Return did not get picked up.

 

All is not lost!

 

One trick – is that this might be caused by ending the line with a variable – as is my example.  What I did – was to simply end each variable statement with a real character – I simply added a “period” after each variable as shown:

 

image

 

 

Which now shows the email formatting as desired:

image

 

 

 

The XML:

What this does – behind the scenes – is adds the following to the Alert Message ID Display String:  (Basically – you can just add carriage returns in the XML and it will be picked up correctly in R2):

 

        <DisplayString ElementID="MomUIGeneratedRule3407012ebced48c38440ed666eb0ae09.AlertMessage">
          <Name>Custom - Test alert on event 100 from rule</Name>
          <Description>A test event occurred.
The Event ID is: {0}.
The Logging Computer is: {1}.
The Event Source is: {2}.
The Event Level is: {3}.

Event Description = {4}</Description>
        </DisplayString>

 

What do the {numbers} mean?  Those are alert parameters.  It gets those from the Alert params section in the Rule XML:

 

<WriteAction ID="Alert" TypeID="Health!System.Health.GenerateAlert">
  <Priority>2</Priority>
  <Severity>2</Severity>
  <AlertOwner />
  <AlertMessageId>$MPElement[Name="MomUIGeneratedRule3407012ebced48c38440ed666eb0ae09.AlertMessage"]$</AlertMessageId>
  <AlertParameters>
    <AlertParameter1>$Data/EventNumber$</AlertParameter1>
    <AlertParameter2>$Data/LoggingComputer$</AlertParameter2>
    <AlertParameter3>$Data/EventSourceName$</AlertParameter3>
    <AlertParameter4>$Data/EventLevel$</AlertParameter4>
    <AlertParameter5>$Data/EventDescription$</AlertParameter5>
  </AlertParameters>
  <Suppression />
  <Custom1 />
  <Custom2 />
  <Custom3 />
  <Custom4 />
  <Custom5 />
  <Custom6 />
  <Custom7 />
  <Custom8 />
  <Custom9 />
  <Custom10 />
</WriteAction>