Archive for the ‘SCOM 2012’ Category

We all know how to view RunAs accounts associated with RunAs profile being inside UI.
Like this. Administration->Profiles. Voilà.
RunAsProfile

Ho to do the same enumeration from PowerShell?

#connect to management group
$mg = new-object Microsoft.EnterpriseManagement.ManagementGroup("localhost")
#get 'Default Action Account' profile and assign its ID to variable
$RunAsProfileId = (Get-SCOMRunAsProfile -DisplayName 'Default Action Account').Id
# get Health Service array associated with the profile
$HSref=$mg.GetMonitoringSecureDataHealthServiceReferenceBySecureReferenceId($RunAsProfileId)
#enumerate accounts
$HSref | %{$_.GetMonitoringSecureData().Name}</code>
Advertisements

Another interesting thing came to my attention was about SCOM alerting and attachments.

Since SCOM was born (fall of 2006) and till present days SCOM poorly supports HTML rich text email and completely ignores (does not support)  attachments.
For us it means we can’t add additional information into alerts by means of standard SCOM capabilities and need to invent wheels every time we need to attach something. 

It had been true for a long time until SP1 was released for SCOM 2012. Since SP1 we can add attachments into email. 
But again, this is not documented well and as of now is used by APM and GSM modules for their own needs.

It’s a good R&D task. I eager to put my fingers into this topic. Stay tuned.

Good start point is the following blogpost of :

OM12 SP1 Q & A: Meet The Alert Attachment MP

  1. Is this functionality present by default in SCOM 2012 SP1?
  2. When this(Alert Attachments) MP is imported I am all set?
  3. OK, I have configured the MP and setup the file share. Now ALL the Alerts will have additional information attached to it?
  4. Can you tell me what MPs these might be?
  5. So I need to configure Team Foundation Server (TFS) as well? And how?
  6. So basically I can’t select what Alert will have additional information attached to it?
  7. I don’t use APM nor GSM. So changes are the Alert Attachment MP isn’t meant for me?

Together with my old fellow MVP Bob Cornelissen and friend of him David Scheltens we have recently created community SCOM management pack for measuring MS SQL IOPS.
The MP is finally polished and is posted MS Technet gallery.

Starting SQL 2005 SQL DBA’s have the possibility to use Dynamic Management Views and Functions to monitor the health of a server instance, diagnose problems, and tune performance. This management pack is specifically geared towards the sys.dm_io_virtual_file_stats view, which returns I/O statistics for data and log files. The view is used by DBA’s to view current counter values for each database file (data or log). It is a current point in time and these values are cumulative values since the last restart of the server. This management pack collects these values for use in viewing and reporting. There are no health state changes or alerts connected to these values.
This Management Pack is provided free of charge by the authors to the System Center community.

MSSQL_iops

Writers of this management pack:
Bob Cornelissen. Microsoft MVP System Center Cloud and Datacenter Management, Managing Consultant of BICTT in the Netherlands, Author of the book Mastering System Center 2012 Operations Manager.
David Scheltens. Senior SQL DBA and Owner of Multibyte in the Netherlands.
Pavel Dzemyantsau. Chief IT Engineer at EPAM Systems in Belarus. Contributor to the book Mastering System Center 2012 Operations Manager.

it has been hidden for ages 🙂

we do have a way to set dynamic severity or priority for SCOM 2007/2012 Alert Rule

all we need is to author it as follows:

<WriteAction ID="RuleId.WriteAction" TypeID="Health!System.Health.GenerateAlert">
            <Priority>$Data/...$</Priority>
            <Severity>$Data/...$</Severity>

In series of blog posts i’m going to show advanced technique of web application monitoring scenarios for SCOM.
This technique does not use standard Web Application template and is based on IE Automation.

I start from raw data for now. Later will add more details.

Part1: IE Automation.

Again, for now i’m just posting raw data.

LiveIDAutomation.vbs

  1. OpenStartPage https://login.live.com/.
  2. Check if elements User, Pass, SignIn are loaded
  3. Fill in User, Pass
  4. Click ‘SignIn’
  5. Check if ‘LiveId’ DOM element is loaded
  6. Get LiveID DOM element value and compare it with provided User
  7. Report scenario time

On each step script tries to report HTTP/Timeout errors and stops script execution.

'Author: Pavel Dzemyantsau
'Note:   Demonstrates POC of IE Automation for LiveID login.

strURL="https://login.live.com/"
strUser="User@hotmail.com"
strPass="password"

'create automation object
Set oIE = WScript.CreateObject("InternetExplorer.Application","IE_")

Timeout=60 'seconds
oIE.visible=1 : BeginTimer = Timer
oIE.Navigate strURL
i=0 : bElementsLoaded=false
Set DOM_Element_1 = Nothing : Set DOM_Element_2 = Nothing : Set DOM_Element_3 = Nothing
Do While (oIE.ReadyState<>4 Or Not(bElementsLoaded)) And i < Timeout
   WScript.Sleep(1000):i=i+1
   On Error Resume Next
      Set DOM_Element_1 = oIE.Document.getElementById("i0116")           'User
      Set DOM_Element_2 = oIE.Document.getElementById("i0118")           'Password
      Set DOM_Element_3 = oIE.Document.getElementById("idSIButton9") 'SignIn button
      If     (Not(DOM_Element_1 is Nothing)) _
         And (Not(DOM_Element_2 is Nothing)) _
         And (Not(DOM_Element_3 is Nothing)) Then
       'all elements we are going to use are loaded
        bElementsLoaded=true
      End If
   On Error Goto 0
Loop

If Not bElementsLoaded  Then
  WScript.Echo "Timeout"&Timeout&" seconds occured on action TODO:."
  WScript.Quit(-1)
End If

'Fill in User/Pass
DOM_Element_1.value=strUser 'TODO: loop to check if user has been set
DOM_Element_2.value=strPass 'TODO: loop to check if pass has been set
DOM_Element_3.Click()

Timeout=120 'seconds
i=0 : bElementsLoaded=false
Set DOM_Element_1 = Nothing
Do While (oIE.ReadyState<>4 Or Not(bElementsLoaded)) And i < Timeout
   WScript.Sleep(1000):i=i+1
   On Error Resume Next
      Set DOM_Element_1   = oIE.Document.getElementById("idWinLiveIdValue") ' LiveId
      If (Not(DOM_Element_1 is Nothing)) Then
       'element we are going to use is loaded, now is checking its attrubute 'title'
        Set DOM_Element_1_attribute_1 = DOM_Element_1.attributes.getNamedItem("title")
           If Not (DOM_Element_1_attribute_1 is Nothing) Then
              'attribute found
              If LCase(DOM_Element_1_attribute_1.value) = LCase(strUser) Then
                'attribute title has correct value
                bElementsLoaded=true
              End If
           End If
      End If
   On Error Goto 0
Loop
EndTimer = Timer

If Not bElementsLoaded  Then
  WScript.Echo "Timeout"&Timeout&" seconds occured on action TODO:."
  WScript.Quit(-1)
End If

Wscript.Echo "Scenario time(sec): "& (EndTimer-BeginTimer)

oIE.Stop : WScript.Sleep(5000) : oIE.Quit

Sub IE_NavigateError(ByVal pDisp,ByVal URL,ByVal TargetFrameName,ByVal StatusCode,ByRef Cancel)
    WScript.Echo "StatusCode="&StatusCode
    WScript.Quit(-1)
End sub