Configuration Management Pack Script Troubleshooting

Quick Post – SCOM Script Monitor Customizing Alert Name

This time I needed to build a two-state script monitor to test several file shares for availability. The script works in multiple steps…

  1. Try to access the shared folder
  2. Create a file within the share
  3. Check if the file exists
  4. Delete the file

If one of the tests above would fail, we need to get an alert. Well, this is actually not that hard to create and don’t worry I am not going to publish another VBScript. What is more interesting is to create a meaningful alert. It makes sense to have the file share name in the alert name e.g. “Failed to access share \\server01\temp”. But how are we going to achieve this?

Some might try to do something like this…

image

Well this would not work, the result would look like this…

image

What should we try to do instead? Well, try to use place holders like this…

image

Depending of the position of your parameters in your alert description you need to pick the proper “place holder”. Since the first parameter is $Data/Context/Property[@Name=’Folder’]$ we choose {0}. Cool and how does it look like?

image

Nice! For those who are MP authors they might are familiar with this technique, but for all others I think it is a smart quick tip 😉 . I don’t know if anybody has blogged about this before, in any case it might help you improving your alerts.

Update 07.03.2014: If you author your MP’s in VSAE it is just the other way around as you can see in this example below, there you must use e.g. $Data/Context/Property[@Name=’Folder’]$ …

image

VSAE will convert this appropriately.

8 Replies to “Quick Post – SCOM Script Monitor Customizing Alert Name

  1. Hi Stefan,
    thanks for this post !
    I always wondered why Alert Name didn’t take any placeholder…now I learn it was only my lack of knowledge.

  2. Would like to see the script you are executing. I have an internal customer with these exact requirements. While I have hacked together a script, I’m sure yours is cleaner.

  3. Hi.

    what will happen if two shared folder are not accessible at the same time? Will I get two alerts (Since it is a state base?.

  4. Hi,

    Thanks for the trick. But I’m facing issue when receiving mail in mailbox coming with parameter (like: Number of pending reports to upload on website Files {0}) and SCOM console is showing perfecly (like: Number of pending reports to upload on website Files 300). Please suggest why this is not coming proper in mail subject.

  5. Hi. Thanks for the good trick. But when I receiving a mail, there is still {0}. Can you help?

    1. Hi

      There is a downside using dynamic parameters. They don’t show up as soon they “leave” SCOM like sending mail, alert connector and you will only see the placeholder {0}, . They only show in the SCOM console properly.

      Bad news, I know but this is the way it is.

      Cheers,

      Stefan

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.