Monday, September 6, 2010

SCOM Tasks – Part IV – Lets Create a Simple Task

----------------------------------------------------------------------------------
Postings in the same series:
Part   IThe Introduction
Part  IIHow It Works
Part III To Serve And To Protect
----------------------------------------------------------------------------------

In the last posting of this series I will describe how to create a simple Task but one which many customers of mine like very much. So why not blog about it?

First some background information about how this Task came to be. Many times the SCOM Console shows Alerts which require a bit more investigation and/or explanation.

A way to go here (and I do import that MP for many of my customers) is to use the ResearchThis! MP from System Center Central. It is written by Cameron Fuller, a much respected fellow MVP and writer of the System Center Operations Manager Unleashed books.

But he is a busy man and you can’t expect him to write down every single Alert, its possible causes and solutions. So further investigation is required. But copying the Alert into a Bing or Google as a search query is a bit tedious to do. One or more Alerts isn’t a big issue. But when one has to do this 20 times a day and 5 days a week it becomes a whole different story.

So it was time to automate it, or better to create some kind of macro inside SCOM. With the Task we are going to create, the Tasks Bing it! and Google it! are shown for every single Alert. And when clicking on one of those Tasks, the Alert is parsed to Bing or Google and used as a query with its results neatly displayed in Internet Explorer. This safes one many mouse clicks a day! This time can be used to go for an extra cup of coffee for instance!

Lets start.

Preparations: Defining the correct localized queries
Before creating the Tasks one needs to know what localized version of Google one uses in order to get the required query right. Here in the Netherlands I am automatically redirected to http://www.google.nl/. And when I run a query (SCOM for instance) this is what the address bar of IE shows:
image

The most important part here is the yellow highlighted piece: http://www.google.nl/#hl=nl&source=hp&q=. This is the localized default Google query. Right after the equal sign (=) comes the item one searches for. Just try it in the address bar of IE in order to test the localized default Google query. Like this for instance: http://www.google.nl/#hl=nl&source=hp&q=SQL
image

and hit <enter>. When a search result is being shown you have found the correct localized default Google query. Copy it for later usage.
image

So for Google in the Netherlands one uses this localized default query: http://www.google.nl/search?hl=nl&source=hp&q=.

In the Netherlands this is the default Bing query: http://www.bing.com/search?q=.

Now its time to create the Tasks:

  1. Open the SCOM R2 Console with Admin permissions. Go to Authoring > Authoring > Management Pack Objects > Tasks. Click right, select Create a New Task

  2. Create a new MP for these Tasks, like this:
    image
    Give the MP a logical name and a good Description > Next > Create.

  3. Select Console Tasks > Alert Command Line > Next:
    image  

  4. Use Bing It! as Task Name. Give it a good Description as well > Next:
    image

  5. For Application type: C:\Program Files\Internet Explorer\iexplore.exe. As Parameter type http://www.bing.com/search?q=. Hit the arrow button and select the option Name:
    image

    Now it looks like this:
    image
    Deselect the option Display output then this task is run > Create. The Task is created now.

Repeat Steps 1 to 5 for the Task Google It!. use the same MP however and at Step 4 you name the Task Google It! with a logical Description:
image

At Step 5 you use the same application. As Parameters you use: http://www.google.nl/search?hl=nl&source=hp&q=. Now it looks like this:
image
Deselect the option Display output then this task is run > Create. The Task is created now.

Time to check whether all is well. Go to the Monitoring pane > Active Alerts. Select an Alert and look in the Actions Pane under the header Alert Tasks. The two new Tasks will be displayed now:
image

Click the first Task (Bing It!) in order to test it. IE will be opened and Bing will be queried with the Alert:
image

Repeat it but now with selecting the Task Google It!. When all is well IE is opened and Google is queried with the Alert:
image

When Google turns up empty there is a huge change you haven’t got the localized default Google query correct. Please resolve it by going through the steps as mentioned under the header Preparations: Defining the correct localized queries.

5 comments:

Rikard Ronnkvist said...

Nice idea!

Tip: To get your default webbrowser instead of MSIE you can use:

Application: %SystemRoot%\System32\rundll32.exe
Params: url.dll,FileProtocolHandler http://www.somesite....

Marnix Wolf said...

Hi Rikard.

Thanks for visiting my blog AND your comment. As you see, one always learns new stuff! Thanks for sharing. Much appreciated.

Cheers,
Marnix

KQ said...

hi

great ideas gentlemen !!!!
i didnt use tasks before but i will definately use it.

thankx for this nice blog.

regards

Unknown said...

Works, thank you both Marnix and Rikard!

Unknown said...

Hi, I really liked your idea of Bing it, it is much easier and better than doing it by PS.

On the screenshots, I see something share it, is there a way where I can directly share the alert details directly from scom console.