21 Mart 2015 Cumartesi

Can Alert Names contain dynamic data?

A customer wanted to place dynamic data into the Alert Name field.  Can this be done?
Yes, it can.
It works the same way that we display resolved dataitems in the workflow, into the alert description.  For instance, here is an alert description that uses many resolved dataitems from the workflow:
image

What this does in the XML – is define each DataItem as an Alert parameter in the Alert write action:
          <WriteAction ID="Alert" TypeID="Health!System.Health.GenerateAlert">
            <Priority>1</Priority>
            <Severity>1</Severity>
            <AlertOwner />
            <AlertMessageId>$MPElement[Name="opsmgrnet.Custom.Rules.TestRuleEvent100.AlertMessage"]$</AlertMessageId>
            <AlertParameters>
              <AlertParameter1>$Data/EventNumber$</AlertParameter1>
              <AlertParameter2>$Data/LoggingComputer$</AlertParameter2>
              <AlertParameter3>$Data/EventSourceName$</AlertParameter3>
              <AlertParameter4>$Data/EventLevel$</AlertParameter4>
              <AlertParameter5>$Data/EventDescription$</AlertParameter5>
              <AlertParameter6>$Data/@time$</AlertParameter6>
              <AlertParameter7>$Target/Host/Property[Type="MicrosoftWindowsLibrary6062780!Microsoft.Windows.Computer"]/IPAddress$</AlertParameter7>
            </AlertParameters>
            <Custom1>$Data/Params/Param[1]$</Custom1>
            <Custom2 />
            <Custom3 />
            <Custom4 />
            <Custom5 />
            <Custom6 />
            <Custom7 />
            <Custom8 />
            <Custom9 />
            <Custom10 />
          </WriteAction>
However, when you look at the DisplayString, which is how the text will be viewed into the console – you will see:
        <DisplayString ElementID="opsmgrnet.Custom.Rules.TestRuleEvent100.AlertMessage">
          <Name>{0} Custom - Test alert on event 100 from rule {1}</Name>
          <Description>A test event was detected.
The Event ID is: {0}.
The Logging Computer is: {1}.
The Event Source is: {2}.
The Event Level is: {3}.

Event Description = {4}

Time event generated = {5}

Custom IP Address:  {6}</Description>
        </DisplayString>
As you can see, {0} corresponds to the first alert parameter, {1} corresponds to the second, etc…
So – in the Alert Name field, we can do something like this:
image


Which turns out really nice looking alerts in the console:

image


Now – the big downside?  Email notifications display this field as text, and do not resolve the Alert Data Items.  Sad smile

image

Kevin Holman

Silect MP Author releases SP3

This tool is getting more and more powerful every day!
From their page:
MP Author is better than ever. The SP3 release of MP Author includes the following updates:
  • Improved knowledge viewing and editing in multiple language environments
  • Improved XML editing
  • New feature to "Check for missing display names"
  • Added ability to use base classes other than LocalApplication when creating new classes
  • Additional MP elements are displayed
  • Added a drop down list of $$ parameters for alert messages
  • Schedule property grid made more user friendly
  • Improvements to memory usage
  • We've also fixed a number of bugs in this release.
Request your free download here:   http://www.silect.com/content/mp-author-free-download-form