EzDevInfo.com

scom interview questions

Top scom frequently asked interview questions

Powershell on SCOM script, Capture output for field -Owner

Simple question i believe, but cant understand why my single liner do not print any output. I want ot filter Objects only with resolutions state (0 = new), and Owner area which is blank (not assigned). So i thoght that if it will be null, or i am understadnign not correctly. Thanks for any advice.

Get-SCOMAlert -ComputerName dbdtScomProd | Where-Object {$_.ResolutionState -eq “0” -and $_.Owner -eq “NULL”}

Source: (StackOverflow)

Using SCOM to collect Sharepoint usage statistics?

We’re running System Center 2012 with SharePoint Management Pack installed. It’s not really used in anger, but recently we have been asked to output stats on user logins and concurrent connections from the reporting console.

Having reviewed the guide for the 2013 SharePoint MP, I can’t see any monitors or rules that would enable this. Unless I’m missing something?

Does this mean it would have to be done at a Windows server level, and if so what are the monitors that would enable the stat to be collected in the Data Warehouse?

Any help appreciated. Thank you!


Source: (StackOverflow)

Advertisements

how can i retrieve the name of iis server where azure websites are deployed

Can i connect remotely to azure IIS server where all the azure websites are deployed and monitor all those web applications using system center operations manager 2012 r2.Is it possible to get the name or ip address of the iis server under a azure subscription. Thanks In Advance Suresh Gaddam


Source: (StackOverflow)

SCOM isn't recording Performance Counters for SQL

I am working on a installation of SCOM, monitoring some SQL Servers. However, I am having an issue collecting the performance counters.

In particular, in SCOM it is showing that the Page Life Expectancy is 0 for all of my SQL Server, when in fact is above 20,000 on most of the servers.

I can't see anything in the SCOM Logs to suggest why this is happening. Any suggestions as to the possible cause, or places to look for more information will be greatly appreciated.

James


Source: (StackOverflow)

Matching a property string from an array of keywords

I am working on a SCOM script to sort alerts based on MonitoringObjectName , Since there are servers with different names , I want to match this (MonitoringObjectName) property string against a list of keywords. I was wondering how can I match the property against the keywords placed in an array

$keywords = @("ABC","DEF","XYZ","GHI")
Get-SCOMAlert | ? ($_.MonitoringObjectName -like "*$keyword*"

Looking for ideas/hints how this can be done


Source: (StackOverflow)

Way to use powershell params in comparison?

I have some ps code, that downloads xml via http and check some xml in it

[xml]$stuff = $wc.DownloadString('url') 

$xmlvalue = $stuff.SelectSingleNode('xpath') 

if ($xmlvalue.'#text' -eq "value")

{
$state = 'OK'
Write-Host 'ok'    
}

All i need is an ability to run that script as

script.ps1 -url -xpath -operator -value

It`s no problem at all, except -operator

I can`t use param like -operator "-eq", because it will be an error

Any way to do it ?


Source: (StackOverflow)

Finding regular expressions on files takes a long time

I'm developing a VBS script for finding 3 cases of regular expressions contained into files. I've already my own script that works fine finding but it takes a long time in execution.

The 3 cases of regular expresions are:

Case 1
    Begin pattern:

          ^[0-9]{2}/[0-9]{2} +[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{2} +[a-zA-Z0-9_\.]+ +pdm_mail_nxd +[0-9]+ +SIGNIFICANT +pdm_mail_nxd\.c +[0-9]+ +Mail Stats: Received\([0-9]+\) Sent\(0\) In Queue\([1-9][0-9]*\) In Work\([0-9]+\) Max Sessions\([0-9]+\) Errors\([0-9]+\) Invalid Msgs\([0-9]+\) Tracing\((Yes|No)\)$

     End patern:
          ^[0-9]{2}/[0-9]{2} +[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{2} +[a-zA-Z0-9_\.]+ +pdm_mail_nxd +[0-9]+ +SIGNIFICANT +pdm_mail_nxd\.c +[0-9]+ +Mail Stats: Received\([0-9]+\) Sent\([1-9][0-9]*\) In Queue\([0-9]+\) In Work\([0-9]+\) Max Sessions\([0-9]+\) Errors\([0-9]+\) Invalid Msgs\([0-9]+\) Tracing\((Yes|No)\)$


Case 2
     Begin pattern:
          ^[0-9]{2}/[0-9]{2} +[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{2} +[a-zA-Z0-9_\.]+ +slump_nxd +[0-9]+ +SIGNIFICANT +socket_port\.c +[0-9]+ +Unable to write to \(pdm_mail_nxd\) for [1-9][0-9]* seconds\.
     End pattern (1):
          ^[0-9]{2}/[0-9]{2} +[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{2} +[a-zA-Z0-9_\.]+ +slump_nxd +[0-9]+ +SIGNIFICANT +socket_port\.c +[0-9]+ +Successful write to \(pdm_mail_nxd\) occurred\. Error cleared after [0-9]+ seconds\.
     End pattern (2):
          ^[0-9]{2}/[0-9]{2} +[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{2} +[a-zA-Z0-9_\.]+ +pdm_mail_nxd +[0-9]+ +SIGNIFICANT +pdm_mail_nxd\.c +[0-9]+ +STARTUP of pdm_mail_nxd

Case 3
     Begin pattern:
          ^[0-9]{2}/[0-9]{2} +[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{2} +[a-zA-Z0-9_\.]+ +slump_nxd +[0-9]+ +SIGNIFICANT +socket_port\.c +[0-9]+ +Too long in error state - dropping connection to SOCKET_PORT\(0x[0-9A-F]+\) description = socket port port_name = pdm_mail_nxd
     End pattern:
          ^[0-9]{2}/[0-9]{2} +[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{2} +[a-zA-Z0-9_\.]+ +pdm_mail_nxd +[0-9]+ +SIGNIFICANT +pdm_mail_nxd\.c +[0-9]+ +STARTUP of pdm_mail_nxd

... And this is my script:

Dim oAPI, oBag
Dim objFso, objFile, objTextFile, obj_Carpeta
Dim str_Path, strFile, stdlog, fileName, text, i, j, LineCount, sline, strlog, fLines
Dim strMatch_Start1, strMatch_End1, strMatch_Start2, strMatch_End2A, strMatch_End2B, strMatch_Start3, strMatch_End3
Dim exp_Start1, exp_Start2, exp_Start3, exp_End1, exp_End2A, exp_End2B, exp_End3
Dim case1, case2, case3

str_Path = "E:\CA\Service Desk Manager\log2"

'CASE 1
exp_Start1 = "^[0-9]{2}/[0-9]{2} +[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{2} +[a-zA-Z0-9_\.]+ +pdm_mail_nxd +[0-9]+ +SIGNIFICANT +pdm_mail_nxd\.c +[0-9]+ +Mail Stats: Received\([0-9]+\) Sent\(0\) In Queue\([1-9][0-9]*\) In Work\([0-9]+\) Max Sessions\([0-9]+\) Errors\([0-9]+\) Invalid Msgs\([0-9]+\) Tracing\((Yes|No)\)$"
exp_End1   = "^[0-9]{2}/[0-9]{2} +[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{2} +[a-zA-Z0-9_\.]+ +pdm_mail_nxd +[0-9]+ +SIGNIFICANT +pdm_mail_nxd\.c +[0-9]+ +Mail Stats: Received\([0-9]+\) Sent\([1-9][0-9]*\) In Queue\([0-9]+\) In Work\([0-9]+\) Max Sessions\([0-9]+\) Errors\([0-9]+\) Invalid Msgs\([0-9]+\) Tracing\((Yes|No)\)$"
'CASE 2
exp_Start2 = "^[0-9]{2}/[0-9]{2} +[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{2} +[a-zA-Z0-9_\.]+ +slump_nxd +[0-9]+ +SIGNIFICANT +socket_port\.c +[0-9]+ +Unable to write to \(pdm_mail_nxd\) for [1-9][0-9]* seconds\."
exp_End2A  = "^[0-9]{2}/[0-9]{2} +[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{2} +[a-zA-Z0-9_\.]+ +slump_nxd +[0-9]+ +SIGNIFICANT +socket_port\.c +[0-9]+ +Successful write to \(pdm_mail_nxd\) occurred\. Error cleared after [0-9]+ seconds\." 
exp_End2B  = "^[0-9]{2}/[0-9]{2} +[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{2} +[a-zA-Z0-9_\.]+ +pdm_mail_nxd +[0-9]+ +SIGNIFICANT +pdm_mail_nxd\.c +[0-9]+ +STARTUP of pdm_mail_nxd"
'CASE 3
exp_Start3 = "^[0-9]{2}/[0-9]{2} +[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{2} +[a-zA-Z0-9_\.]+ +slump_nxd +[0-9]+ +SIGNIFICANT +socket_port\.c +[0-9]+ +Too long in error state - dropping connection to SOCKET_PORT\(0x[0-9A-F]+\) description = socket port port_name = pdm_mail_nxd"
exp_End3   = "^[0-9]{2}/[0-9]{2} +[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{2} +[a-zA-Z0-9_\.]+ +pdm_mail_nxd +[0-9]+ +SIGNIFICANT +pdm_mail_nxd\.c +[0-9]+ +STARTUP of pdm_mail_nxd"

Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()

Set objFso = CreateObject("Scripting.FileSystemObject")
Set obj_Carpeta = objFso.GetFolder(str_Path)

'Check valid path
If not objFso.FolderExists(str_Path) Then
    WScript.Echo "Error: " & str_Path & " -- not found."
    'Call oAPI.LogScriptEvent("mail_queue SDM",9551,0, "Process pdm_mail_nxd: path not found" )
    Set objFso = Nothing
    WScript.Quit 2
End If

'Call oAPI.LogScriptEvent("mail_queue SDM",9552,0, "init monitor" )

 For i = 0 to 8 
    For Each objFile In obj_Carpeta.Files
        'Check if it has files    
        stdlog = "stdlog." &i
        fileName = objFile.Name
        case1 = "False" 
        case2 = "False"
        case3 = "False"
        WScript.echo fileName
        WScript.echo stdlog
        If fileName = stdlog Then
            'Have file
            text = "" 
            i = i+1 
            strFile = str_Path & "\" & fileName
            WScript.echo strFile
            'Set objTextFile = objFile.OpenAsTextStream(ForReading)   
            text = objFile.OpenAsTextStream(ForReading).ReadAll
            WScript.echo "Reading File ..."
            'Split by lines, put into an array
            fLines = Split(text,vbCrLf)
            'Use UBound to count the lines
            LineCount = UBound(fLines)
            Set objFile = Nothing 'Cleanup
            WScript.echo "File read...   " & LineCount  & " lines" & vbCrLf


            If (InStr(1,text,"pdm_mail_nxd") > 0) Then
                'exp_Start1, exp_End1, exp_End2B, exp_End3
                WScript.echo "WORD pdm_mail_nxd FOUND!!" 
                For j = 0 to LineCount
                    sline = fLines(j)

                    'Match expression
                    strMatch_Start1 = TestRegExp (exp_Start1 , sline)
                    strMatch_End1 = TestRegExp (exp_End1 , sline)
                    'strMatch_End2B = TestRegExp (exp_End2B , sline)
                    'strMatch_End3 = TestRegExp (exp_End3 , sline)

                    If strMatch_Start1  = "True" Then

                        WScript.echo "------>   CASe 1 open"    
                        case1 = "True"      
                        strlog = sline
                        WScript.echo strlog
                        'j = j+1
                    Else

                        If strMatch_End1  = "True" Then 
                            case1 = "False" 
                        End If
                        case2 = "False"
                        case3 = "False"
                    End If
                Next
            End If

            If (InStr(1,text,"slump_nxd") > 0) Then
                'strMatch_Start2, strMatch_End2A, exp_Start3
                WScript.echo "WORD pdm_mail_nxd FOUND!!"    & vbCrLf
                For j = 0 to LineCount
                    sline = fLines(j)   
                    'Match expression
                    strMatch_Start2 = TestRegExp (exp_Start2 , sline)
                    strMatch_End2A = TestRegExp (exp_End2A , sline)
                    strMatch_Start3 = TestRegExp (exp_Start3 , sline)
                    If strMatch_Start2  = "True" Then

                        WScript.echo "-----> CASe 2 open"   
                        case2 = "True"
                        strlog = sline
                        WScript.echo strlog                 
                        'j = j+1
                    ElseIf strMatch_Start3  = "True" Then

                        WScript.echo "----> CASe 3 open"    
                        case3 = "True"                      
                        strlog = sline
                        WScript.echo strlog
                        'j = j+1
                    Else

                        case1 = "False" 
                        'case2 = "False"
                        'case3 = "False"
                    End If
                Next
            End If      
        End if
        WScript.echo "***************"
    Next
Next

If ((case1 = "True") or (case2 = "True") or (case3 = "True")) Then
    Call oAPI.LogScriptEvent("mail_queue SDM",9552,0, "DELAY -->  " & StdlogValue )
    Call oBag.AddValue("Status","Demora en envio de correo")
    Call oBag.AddValue("StdlogValue",strlog)
Else
    Call oAPI.LogScriptEvent("mail_queue SDM",9552,0, "NO DELAY")
    Call oBag.AddValue("Status","Ok")
End If

Function TestRegExp (myPattern , myString)
   Dim objRegExp, objMatch, colMatches, RetStr

   ' Create a regular expression object
   Set objRegExp = CreateObject("VBScript.RegExp")  
   objRegExp.IgnoreCase = True ' Set Case Insensitivity
   objRegExp.Global = True 'Set global applicability
   'Set the pattern by using the Pattern property
   objRegExp.Pattern = myPattern

   'Test whether the String can be compared
    If objRegExp.Test(myString) = True Then
       'Get the matches
        Set colMatches = objRegExp.Execute(myString)  ' Execute search
        For Each objMatch In colMatches   ' Iterate Matches collection
          RetStr = RetStr & objMatch.Value 
        Next
        If IsNull(RetStr) then
            RetStr = "False"
        Else
            RetStr = "True"
        End if
   Else
    ' String Matching Failed
     RetStr = "False"
   End If
   TestRegExp = RetStr

End Function    

'Call oAPI.LogScriptEvent("mail_queue SDM",9552,0, "End monitor" )
oAPI.Return(oBag)

'Cleanup objects 
Set objFSO = Nothing 
Set objFile = Nothing 
Set strlog = Nothing
WScript.Quit()

Can anyone tell me what I'm doing wrong? Any solution or suggestion to make it faster?


Source: (StackOverflow)

SCOM Monitor not reporting

I am running into a bit of an issue with SCOM. I have create the script below to monitor an application. It creates an entry in the Event log when the script runs and I have configured the alerts for a specific group in which the monitor is running on.

Am I not creating the script right is my question?

Here is an error that I got when I changed oAPI.Return(oBag) to oAPI.ReturnItems

The process started at 2:24:23 PM failed to create System.PropertyBagData. Errors found in output:

C:\Program Files\System Center Operations Manager\Agent\Health Service State\Monitoring Host Temporary Files 84\29451\voxwareMonitor.vbs(33, 2) Microsoft VBScript runtime error: Invalid procedure call or argument

Dim proc, serv, oArgs, oAPI, oBag

sComputerName = "."
Set objWMIService = GetObject("winmgmts:\\" & sComputerName & "\root\cimv2")
sQueryPro = "SELECT * FROM Win32_Process"
sQuerySer = "SELECT * FROM Win32_Service"
Set objProcs = objWMIService.ExecQuery(sQueryPro)
Set objServ = objWMIService.ExecQuery(sQuerySer)

Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()

For Each objItem In objProcs
    If objItem.Name = "javaw.exe" Then
        proc = True
    End If
Next

For Each objS In objServ
    If objS.Name = "vlsoperatorconsole_voxwarevls" Then
        serv = True
    End If
Next

If proc = True And serv = True Then
    Call oBag.AddValue("Service", "Running")
    Call oBag.AddValue("Process", "Running")
    oAPI.LogScriptEvent "Voxware Monitor", 411, 0, "Application and Services are   running"
    Call oAPI.Return(oBag)
Else
    If proc = False Then
        Call oBag.AddValue("Process", "Stopped")
        oAPI.LogScriptEvent "Voxware Monitor", 911, 1, "Process has stopped"
        Call oAPI.Return(oBag)
    End If
    If serv = False Then
        Call oBag.AddValue("Service", "Stopped")
        oAPI.LogScriptEvent "Voxware Monitor", 911, 1, "Service has stopped"
        Call oAPI.Return(oBag)
    End If
End If

Source: (StackOverflow)

SCOM: How to display custom perf counters from Services

I have a number of Windows Services written in .NET/C# and each of these have custom performance counters added via the System.Diagnostics.CounterCreationData and System.Diagnostics.CounterCreationDataCollection classes. In System Center 2012 I have a Dashboard for each of these Services in which I want to display/graph the values from my custom counters. However, I only see the standard performance counters which are the same for all Services and can not find my custom counters anywhere. My counters are visible via PerfMon but SCOM does not see them. Is it possible to do what I want, and how?

Thanks


Source: (StackOverflow)

What is best way to call SCOM SDK Inbound connector from managment pack?

I have created a SCOM inbound connector based on the example code from How to Create Inbound Connectors. I run the code and my objects appear in operations manager as expected.

I cannot find any guidance as to how to get my discovery executable to get automatically called - ideally it would be run just like a "Discovery" snippet in the management pack. Another option I thought of would be a Agent Task but I'm not sure that can be scheduled. A third option would just be to install the code as a service completely outside of the management pack.

Is there a best practices on how to execute / schedule the execution of a custom inbound connector?


Source: (StackOverflow)

Using Microsoft SCOM to scan log4j files

I am looking to have alerting using the SCOM utility based on scanning of log files written by log4j, eg using the DailyRollingFileAppender standard appender.

However, the SCOM documentation specifically states that it keeps a high water mark line number on a log file, and if it is truncated within a minute, it will not take notice of log entries before that line number.

Unless I missed something, this would seem to be an issue for all the standard appenders, which do specifically that (ie they always log to a single file name, then when he wrap criteria are met, they copy the contents of the file to an archive, and then clear (somehow) the same file name.

Can anyone solve this for me (eg identify another way that SCOM can be used, or point me at an alternative appender?)

SCOM Document extract... If a logfile is deleted and recreated with the same name within the same minute, the high water mark will not be reset, and log entries will be ignored until the high water mark is exceeded.

Thanks


Source: (StackOverflow)

OpsMgr 2012 agent installation fails with "One or more computers you are trying to manage are already in the process of being managed" [closed]

I am authoring a management pack in XML and using the authoring console in System Center. For testing the MP I created, I need to install agents on machines that have my distributed app running.

SCOM Operations Manager 2012 agent installation fails with

One or more computers you are trying to manage are already in the process of being managed

I know this issue should be resolved from the database - do you know what SQL queries I should run to remove the machines I am trying to install agents on from the pending actions table?


Source: (StackOverflow)

Run PowerShell Script In SCOM Via Windows Command Line

I am working with a 3rd party application which creates powershell scripts to place SCOM objects into and out of maintenance mode. How can SCOM be invoked via windows 2012 R2 command line by this 3rd party app and told to execute the script?


Source: (StackOverflow)

SCOM diagnostic and recovery script starting service remains in "Starting" mode

I have a diagnostic and recovery script to stop and start service. After SCOM runs the powershell script, the service stops successfully and when trying to start it remains in "started" mode. There needs to be a 15 seconds timeout before starting the service and SCOM is not waiting for the 15 seconds. The windows service has 25 threads running and it takes time to stop this service gracefully.

The powershell script works from Dos Prompt. Just does not work from SCOM diagnostic and recovery. The timeout for the management pack has been increased to 600 seconds.


Source: (StackOverflow)

SCOM recovery script - want to start a new independent process

I am running a SCOM recovery script and it is timing out. I have a launcher.bat file which calls "start cmd /c a.bat" and a.bat does all the work.

The issue is that when the parent process dies, the a.bat process also stops without completing. Is there anyway to keep the a.bat process running independently of the launcher.bat.

Thanks


Source: (StackOverflow)