Archive | VisualStudio Authoring Console Extensions RSS feed for this section

Failed VSAE build with message: Could not load management pack System.AdminItem.Library

4 Nov

Again a new addition to the VSAE build errors KB.

Problem

You compile a VSAE project and you get the compile error below:

Severity    Code    Description    Project    File    Line    Suppression State

Error        Verification of Monitor Configuration with MonitorType schema for Monitor OpsLogix.IMP.VMWare.VirtualMachine.Monitoring.Monitor.VM.CPUUsage failed.

: Could not load management pack [ID=System.AdminItem.Library, KeyToken=31bf3856ad364e35, Version=7.5.8500.0]. The management pack was not found in the store.

An object of class ManagementPack with name System.AdminItem.Library was not found. (Path = OpsLogix.IMP.VMWare.VirtualMachine.Monitoring.Monitor.VM.CPUUsage)    OpsLogix.IMP.VMWare.VirtualMachine.Monitoring    Monitoring\Monitors\OpsLogix.IMP.VMWare.VirtualMachine.Monitoring.Monitor.VM.CPUUsage.mpx    4    

 

Investigation

 

Hue ? Could not load management pack System.AdminItem.Library ?

But I don’t use this one at all. So you could add this MP to the references and end up with a new error saying :

Verification of Monitor Configuration with MonitorType schema for Monitor OpsLogix.IMP.VMWare.VirtualMachine.Monitoring.Monitor.VM.CPUUsage failed.: Could not load management pack [ID=System.Software.Library, KeyToken=31bf3856ad364e35, Version=7.5.8501.0]. The management pack was not found in the store.An object of class ManagementPack with name System.Software.Library was not found. (Path = OpsLogix.IMP.VMWare.VirtualMachine.Monitoring.Monitor.VM.CPUUsage)

 

Again we add the missing MP : System.Software.Library

And now we get

Verification of Monitor Configuration with MonitorType schema for Monitor OpsLogix.IMP.VMWare.VirtualMachine.Monitoring.Monitor.VM.CPUUsage failed.

: Could not load management pack [ID=Microsoft.SystemCenter.NTService.Library, KeyToken=31bf3856ad364e35, Version=7.0.9538.0]. The management pack was not found in the store.

An object of class ManagementPack with name Microsoft.SystemCenter.NTService.Library was not found. (Path = OpsLogix.IMP.VMWare.VirtualMachine.Monitoring.Monitor.VM.CPUUsage)    OpsLogix.IMP.VMWare.VirtualMachine.Monitoring    Monitoring\Monitors\OpsLogix.IMP.VMWare.VirtualMachine.Monitoring.Monitor.VM.CPUUsage.mpx

 

So again we could add the MP ref but I can tell you now already that this won’t help at all. The compiler is just trying to search through known types to see if it can map a property.

Just jump to the solution because it very simple….

Solution

 

Just double check if the class properties you refer are correctly spelled (case sensitive!) . In this case the names were not correct.

Also it could be that it couldn’t find the property at all. Same error is displayed.

 

Hope this helps.

Happy Scomming

Michel Kamp

Debugging SCOM Workflows using PowerShell

22 Oct

Hi,

As promised during one of the SCOM MP authoring trainings I gave, here’s a short post about how to debug your SCOM Management Pack workflows. ( So Patrick you can stop spamming me (lol) )

Currently we have 5 options for debugging your workflows:

  1. Eventlog
  2. WFAnalyzer
  3. Trace by PowerShell
  4. TraceConfig ETW Tracer
  5. Microsoft Message Analyzer ** will make a separate post this this soon **

Some short explanations:

1.Eventlog

Trace by looking at healthservice events or log messages that you have put into your PS/VBS probes. However this doesn’t provide any information on if a condition connection fails or the PB passed ect.

Look the Operationsmanager eventlog for the following event ids , note there are a lot more id but this ones will give you a first detection:

ID

Description

1103

Summary: xxxx rule(s)/monitor(s) failed and got unloaded, 1 of them reached the failure limit that prevents automatic reload. Management group “xxx”. This is summary only event, please see other events with descriptions of unloaded rule(s)/monitor(s).

1102

Rule/Monitor “%4” running for instance “%3″ with id:”%2” cannot be initialized and will not be loaded. Management group “%1”    

1101

Host reference in workflow “%4”, running for instance “%3″ with id:”%2” cannot be resolved. Workflow will not be loaded. Management group “%1”   

1206

Rule/Monitor “%2”, running for instance “%3″ with id:”%4” failed, got unloaded and reached the failure limit that prevents automatic reload. Management group “%1”.  

4510

The Health Service encountered an error %5 causing the rule “%2” running for instance “%3″ with id:”%4” in management group “%1”.   

5412

Converting data batch to XML failed with error “%6” (%5) in rule “%2” running for instance “%3″ with id:”%4” in management group “%1”.%n  %n  The rule will be unloaded.    

5401

Failed to replace parameter while creating the alert for monitor state change.

2.WFAnalyzer

This is a tool provided by Microsoft. You will have to copy it from the VSAE installation media to the scom server installation directory since it needs some extra dlls. See for VSAE here: https://www.microsoft.com/en-us/download/details.aspx?id=30169

When you start the program you will be asked to apply a MS server and the Agent to trace. After this you will see a running workflows table. Pick one workflow you want to trace and right click -> Trace. Now a new trace window will be started with the formatted output of the trace.

I must say that using this tool is a must have for SCOM MP authors…. If it works … since SCOM 2012 R2 and above most of the time it fails to start a trace.

If it crashes you could try to do this:

  1. Open as administrator a CMD
  2. Execute : “C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\StopTracing.cmd”
  3. Execute: “C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\StartTracing.cmd”
  4. Execute : “C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\StopTracing.cmd”
  5. Execute: “C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\FormatTracing.cmd”

This will build new CAB/tmf files in the Tools (all.tmf) and Tools\TMF directory that is used to translate the ETW ids to readable messages.

And with a bit of luck it works. If it works, also have a look at the filter menu. Changing it to None will give you some more details if a WF fails.

Also keep in mind that this tool needs a SDK connection to execute the ‘get running workflows’ task and also to get WF/instance information from that task results. This information is used to provide you the UI table so you can select the WF to trace. So can I use it on a normal agent ? yes you can but as stated it needs a SDK connection to a MS server. Why ? When you start the WFanalyzer it will show you a box were you provide the SDK MS server and the Agent to debug. With this information it will trigger the task ‘get running workflows’ on that agent. The results are used to build a WF table. But again this is only for providing you the nice UI. Also I have rewritten the WFanalyzer UI a long time ago to fix this bugs and requirements as far I remember it was due to an invalid GUID that lets the UI table component crash when it updates the WF running states and also I changed the SDK connection mechanism to make it run on a agent. But due to MSFT copyright I can’t share it with you , sorry. (If someone from the MSFT SCOM team (Kevin ? ) reads this I am happy to share the issues I have fixed.)

But no worry , in the part below I explain how to do this using PowerShell so you don’t have this issues.

3.Trace by PowerShell

So If you can’t run the WFanalyzer as above. You could use the PowerShell scripts below.

What it will do:

  • Get the Workflow and Instance Id to trace
  • Create the TraceEnbled override and import the override MP
  • Start up a trace listener
  • Format real time the ETW messages to readable content and filter out some irrelevant strings
  • Stop the trace
  • Remove the override MP

If you run step 1,2 on a MS server to get the IDs you could use it to start the trace on a GW or Agent too.

Step 5 and 6 you should only run if you are done with tracing.

I have separate scripts for Rule , Monitor and Discovery WF tracing. See below:

Rule tracing

import-module operationsmanager

## monitor and target to debug

$targetName=“Target1”

$ruleName=“OpsLogix.IMP.Rule.Ping.WMIPingCheck”

## create override

$rule=Get-SCOMRule-name $ruleName

$ruleClass=get-scomclass id $($rule.Target).Id

$ruleTarget=Get-SCOMMonitoringObject Class
$ruleClass
|
?
{$_.Name like $targetName}

$ruleoverride=“<Overrides> <RulePropertyOverride ID=””DebugOverrideForRule$($rule.Name)”” Context=””$($ruleClass.Id)”” ContextInstance=””$($ruleTarget.Id)”” Enforced=””false”” Rule=””$($rule.Id)”” Property=””TraceEnabled””> <Value>true</Value> </RulePropertyOverride> </Overrides>”

$RuleMP=$rule.GetManagementPack()

$RuleMP.KeyToken

$mp=@”

<?xml version=”1.0″ encoding=”utf-8″?>

<ManagementPack ContentReadable=”true” SchemaVersion=”2.0″ OriginalSchemaVersion=”1.1″ xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”&gt;

<Manifest>

<Identity>

<ID>WorkflowTraceOverrideMP</ID>

<Version>1.0.0.0</Version>

</Identity>

<Name>WorkflowTraceOverrideMP</Name>

<References>

<Reference Alias=”$($RuleMP.Name)”>

<ID>$($RuleMP.Name)</ID>

<Version>$($RuleMP.Version)</Version>

<PublicKeyToken>$($RuleMP.KeyToken)</PublicKeyToken>

</Reference>

</References>

</Manifest>

<Monitoring>

<Overrides>

<RulePropertyOverride ID=”DebugOverrideForRule$($rule.Name)” Context=”$($RuleMP.Name)!$($ruleClass.Name)” ContextInstance=”$($ruleTarget.Id)” Enforced=”false” Rule=”$($RuleMP.Name)!$($rule.Name)” Property=”TraceEnabled”>

<Value>true</Value>

</RulePropertyOverride>

</Overrides>

</Monitoring>

<LanguagePacks>

<LanguagePack ID=”ENU” IsDefault=”false”>

<DisplayStrings>

<DisplayString ElementID=”DebugOverrideForRule$($rule.Name)”>

<Name>Workflow Trace Override used by the WorkflowDebugger</Name>

</DisplayString>

</DisplayStrings>

</LanguagePack>

</LanguagePacks>

</ManagementPack>

“@

$mpfile=“c:\temp\WorkflowTraceOverrideMP.xml”

$mp
| Out-File Encoding ascii $mpfile

Import-SCOMManagementPack $mpfile

# start trace

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\TraceLogSM.exe”
start “CustomWorkflowTrace”
flag 0xFF
level 5
ft 1
rt guid “#c85ab4ed-7f0f-42c7-8421-995da9810fdd”
b 1024

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\tracefmtsm.exe”
rt “CustomWorkflowTrace”
display nosummary o “C:\temp\WorkflowTrace.log”
tmf “C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\All.tmf”
| select-string Pattern “ModuleDebug”
NotMatch

# stop trace

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\TraceLogSM.exe”
stop “CustomWorkflowTrace”

# remove MP

Get-SCOMManagementPack name “WorkflowTraceOverrideMP”
| Remove-SCOMManagementPack


 

Monitor tracing

import-module operationsmanager

## monitor and target to debug

$targetName=“Target1”

$monitorName=“OpsLogix.IMP.Monitor.Ping.WMIPingCheck”

## create override

$monitor=Get-SCOMMonitor name $monitorName

$monitorClass=get-scomclass id $($monitor.Target).Id

$monitorTarget=Get-SCOMMonitoringObject Class
$monitorClass
|
?
{$_.Name like $targetName}

$monitoroverride=“<Overrides> <MonitorPropertyOverride ID=””DebugOverrideForMonitor$($monitor.Name)”” Context=””$($monitorClass.Id)”” ContextInstance=””$($monitorTarget.Id)”” Enforced=””false”” Monitor=””$($monitor.Id)”” Property=””TraceEnabled””> <Value>true</Value> </MonitorPropertyOverride> </Overrides>”

$monitoMP=$monitor.GetManagementPack()

$monitoMP.KeyToken

$mp=@”

<?xml version=”1.0″ encoding=”utf-8″?>

<ManagementPack ContentReadable=”true” SchemaVersion=”2.0″ OriginalSchemaVersion=”1.1″ xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”&gt;

<Manifest>

<Identity>

<ID>WorkflowTraceOverrideMP</ID>

<Version>1.0.0.0</Version>

</Identity>

<Name>WorkflowTraceOverrideMP</Name>

<References>

<Reference Alias=”$($monitoMP.Name)”>

<ID>$($monitoMP.Name)</ID>

<Version>$($monitoMP.Version)</Version>

<PublicKeyToken>$($monitoMP.KeyToken)</PublicKeyToken>

</Reference>

</References>

</Manifest>

<Monitoring>

<Overrides>

<MonitorPropertyOverride ID=”DebugOverrideForMonitor$($monitor.Name)” Context=”$($monitoMP.Name)!$($monitorClass.Name)” ContextInstance=”$($monitorTarget.Id)” Enforced=”false” Monitor=”$($monitoMP.Name)!$($monitor.Name)” Property=”TraceEnabled”>

<Value>true</Value>

</MonitorPropertyOverride>

</Overrides>

</Monitoring>

<LanguagePacks>

<LanguagePack ID=”ENU” IsDefault=”false”>

<DisplayStrings>

<DisplayString ElementID=”DebugOverrideForMonitor$($monitor.Name)”>

<Name>Workflow Trace Override used by the WorkflowDebugger</Name>

</DisplayString>

</DisplayStrings>

</LanguagePack>

</LanguagePacks>

</ManagementPack>

“@

$mpfile=“c:\temp\WorkflowTraceOverrideMP.xml”

$mp
| Out-File Encoding ascii $mpfile

Import-SCOMManagementPack $mpfile

# start trace

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\TraceLogSM.exe”
start “CustomWorkflowTrace”
flag 0xFF
level 5
ft 1
rt guid “#c85ab4ed-7f0f-42c7-8421-995da9810fdd”
b 1024

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\tracefmtsm.exe”
rt “CustomWorkflowTrace”
display nosummary o “C:\temp\WorkflowTrace.log”
tmf “C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\All.tmf”
| select-string Pattern “ModuleDebug”
NotMatch

# stop trace

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\TraceLogSM.exe”
stop “CustomWorkflowTrace”

# remove MP

Get-SCOMManagementPack name “WorkflowTraceOverrideMP”
| Remove-SCOMManagementPack


 

Discovery tracing

import-module operationsmanager

## monitor and target to debug

$targetName=“Vcenter01”

$discoveryName=“OpsLogix.IMP.VMWare.Discovery.Datacenter”

## create override

$discovery=Get-SCOMDiscovery name $discoveryName

$discoveryClass=get-scomclass id $($discovery.Target).Id

$discoveryTarget=Get-SCOMMonitoringObject Class
$discoveryClass
|
?
{$_.Name like $targetName}

$discoveryMP=$discovery.GetManagementPack()

$mp=@”

<?xml version=”1.0″ encoding=”utf-8″?>

<ManagementPack ContentReadable=”true” SchemaVersion=”2.0″ OriginalSchemaVersion=”1.1″ xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”&gt;

<Manifest>

<Identity>

<ID>WorkflowTraceOverrideMP</ID>

<Version>1.0.0.0</Version>

</Identity>

<Name>WorkflowTraceOverrideMP</Name>

<References>

<Reference Alias=”$($discoveryMP.Name)”>

<ID>$($discoveryMP.Name)</ID>

<Version>$($discoveryMP.Version)</Version>

<PublicKeyToken>$($discoveryMP.KeyToken)</PublicKeyToken>

</Reference>

</References>

</Manifest>

<Monitoring>

<Overrides>

<DiscoveryPropertyOverride ID=”DebugOverrideForDiscovery$($discovery.Name)” Context=”$($discoveryMP.Name)!$($discoveryClass.Name)” ContextInstance=”$($discoveryTarget.Id)” Enforced=”false” Discovery=”$($discoveryMP.Name)!$($discovery.Name)” Property=”TraceEnabled”>

<Value>true</Value>

</DiscoveryPropertyOverride>

</Overrides>

</Monitoring>

<LanguagePacks>

<LanguagePack ID=”ENU” IsDefault=”false”>

<DisplayStrings>

<DisplayString ElementID=”DebugOverrideForDiscovery$($discovery.Name)”>

<Name>Workflow Trace Override used by the WorkflowDebugger</Name>

</DisplayString>

</DisplayStrings>

</LanguagePack>

</LanguagePacks>

</ManagementPack>

“@

md c:\temp Force

$mpfile=“c:\temp\WorkflowTraceOverrideMP.xml”

$mp
| Out-File Encoding ascii $mpfile

Import-SCOMManagementPack $mpfile

# start trace

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\TraceLogSM.exe”
start “CustomWorkflowTrace”
flag 0xFF
level 6
ft 1
rt guid “#c85ab4ed-7f0f-42c7-8421-995da9810fdd”
b 1024

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\tracefmtsm.exe”
rt “CustomWorkflowTrace”
display nosummary o “C:\temp\WorkflowTrace.log”
tmf “C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\All.tmf”
| select-string Pattern “ModuleDebug”
NotMatch # | Select-Object Line | Out-StringNoWrap

# stop trace

&“C:\Program Files\Microsoft System Center 2016\Operations Manager\Server\Tools\TraceLogSM.exe”
stop “CustomWorkflowTrace”

# remove MP

Get-SCOMManagementPack name “WorkflowTraceOverrideMP”
| Remove-SCOMManagementPack

4.TraceConfig ETW Tracer

So if nothing above did help you getting a clue why your workflows are not working you a doomed to use the ETW tracer and go through tons of log lines….

For example you used 3 state monitor moduletype but specified only 2 state in the monitor…

To trace what is happening follow the steps below:

  1. Start a OpsMgrtrace using C:\Program Files\ Microsoft System Center 2016\Operations Manager\Server\Tools\TraceConfig.exe
  2. Select all trace providers from Trace Area: Healthservice and Modules
  3. Set the trace level to DEBUG
  4. Start the tracing
  5. After restarting the SCOM agent wait till you get the 1102 error
  6. Now stop the Trace
  7. Format the trace file to a log file . Use as Admin CMD and execute C:\Program Files\ Microsoft System Center 2016\Operations Manager\Server\Tools\FormatTracing.cmd
  8. Open the log file at : C:\Windows\Logs\OpsMgrTrace\OpsMgrCustom.log (tip VsCode is excellent for this)
  9. Look for the workflow name or
  10. Look for text : [ConfigurationManager] [] [Error] :CMonitoringResolver

For example:

[1]11632.15896::09/28/2017-14:45:27.661 [ConfigurationManager] [] [Error] :CMonitoringResolver::LookupHealth{MEMonitoringResolver_cpp2945}Cannot resolve operational state.

[1]11632.15896::09/28/2017-14:45:27.661 [Common] [] [Error] :Common::ParameterReplacement::ReplaceCommon{ParameterReplacement_cpp615}`hr` failed, returning ERROR: {hr= 0x8000ffff(E_UNEXPECTED)}

[1]11632.15896::09/28/2017-14:45:27.661 [ConfigurationManager] [] [Error] :CMonitoringResolver::ResolveOperationalStates{MEMonitoringResolver_cpp1022}Common::ParameterReplacement::Replace failed with code 0x8000ffff(E_UNEXPECTED).

[1]11632.15896::09/28/2017-14:45:27.661 [ConfigurationManager] [] [Error] :CMonitoringResolver::ResolveOperationalStates{MEMonitoringResolver_cpp960}ResolveOperationalState failed with code -2147418113(E_UNEXPECTED).

[1]11632.15896::09/28/2017-14:45:27.661 [ConfigurationManager] [] [Error] :CMonitoringResolver::ResolveMonitorModules{MEMonitoringResolver_cpp425}ResolveOperationalStates failed with code -2147418113(E_UNEXPECTED).

[1]11632.15896::09/28/2017-14:45:27.661 [ConfigurationManager] [] [Error] :CWorkflowsLoader::LoadUnitMonitor{MEWorkflowsLoader_cpp2877}ResolveMonitorModules for ‘OpsLogix.IMP.Oracle.Backup.ARCHIVELOG.Monitor’ failed with code -2147418113(E_UNEXPECTED).

[1]11632.15896::09/28/2017-14:45:27.661 [ConfigurationManager] [] [Error] :CWorkflowsLoader::LoadUnitMonitor{MEWorkflowsLoader_cpp2877}ResolveMonitorModules for ‘OpsLogix.IMP.Oracle.Backup.ARCHIVELOG.Monitor’ failed with code -2147418113(E_UNEXPECTED).

[0]11632.15896::09/28/2017-14:45:15.632 [HealthServiceCommon] [] [Error] :EventLogUtil::LogEvent{EventLogUtil_cpp379}Logging event 1102 from source “HealthService” with severity Error and description “Rule/Monitor “OpsLogix.IMP.Oracle.Backup.ARCHIVELOG.Monitor” running for instance “Backup state for DB11G07″ with id:”{7F1A7474-5A4F-6856-32D7-7FAA6022EC73}” cannot be initialized and will not be loaded. Management group “OM2012SP1Grp01″”.

Solution found to fix this :

Check the <operationalStates> it should match the 2 or 3 states defined the monitormoduletype.

For example the error above missed the Warning state.

<OperationalStates>

<OperationalState ID=”UIGeneratedOpStateIda836de3b0d3645dca0ecdc3b6374c3e4″ MonitorTypeStateID=”Healthy” HealthState=”Success” />

<OperationalState ID=”UIGeneratedOpStateIdaaa73a3abd5144eaa6bff6d72e1d3aaa” MonitorTypeStateID=”Warning” HealthState=”Warning” />

<OperationalState ID=”UIGeneratedOpStateIdc415176391694409926e21afb666c532″ MonitorTypeStateID=”Critical” HealthState=”Error” />

</OperationalStates>

The End

So hope this helps you getting to know why a workflow is not running OR what data a workflow is passing in a PropertyBag.

When I have some time left (and that’s spare) I will finish my post on using Microsoft Message Analyzer for SCOM WF tracing.

Happy SCOMMING

[BUG] VSAE with a PowerShell $Data parameter

27 May

Hi,

This time for a short post on a ‘possible’ bug i detected in VSAE

Problem:

You create a PowerShell script and want to include this script using the $includeFileContent/<script_name>$ tag.

For example

<ProbeAction
ID=Probe
TypeID=Windows!Microsoft.Windows.PowerShellProbe
RunAs=SystemCenter!Microsoft.SystemCenter.DatabaseWriteActionAccount>

<ScriptName>FixTopNQuery.ps1</ScriptName>

<ScriptBody>$IncludeFileContent/FixTopNQuery.ps1$</ScriptBody>

<TimeoutSeconds>300</TimeoutSeconds>

<StrictErrorHandling>true</StrictErrorHandling>

</ProbeAction>

(Added a screenshot below)

The FixTopNQuery.ps1 is a PS script added to the project as “Embedded Resource”.

Now you compile the project and you get a compile error:

Error    1176    The configuration specified for Module Probe is not valid.

: Incorrect expression specified: $DataSet=New-Object System.Data.DataSet

. Unable to resolve this expression. Check the expression for errors. (Hints: Check for correct character casing (upper case/lower case), mismatched “$” signs, double quotes(“), square brackets “[” or “]”). Here is a sample expression: $Data/EventNumber$

(Path = OpsLogix.IMP.Oracle.Dashboards.Task.FixTopNQuery/Probe)    C:\Program Files (x86)\MSBuild\Microsoft\VSAC\Microsoft.SystemCenter.OperationsManager.targets    255    6    Dashboards

(Added a screenshot below)


Hmmm.. Why ?

 

Analyze

After a lot of error and retry I found out that the problem is in the included powershell script. And exactly in this line below:

$DataSet=New-Object System.Data.DataSet

Hmm I hear you thinking, what’s wrong with this statement? That exactly what I was thinking…. But when I change the parameter name the compile was successful…

 

Solution

Do not start a parameter name with $Data in the powershell script. It looks like it’s a reserved word in VSAE.

 

I will share this issue also with the VSAA product team.

Happy Scomming

Michel Kamp

Extending HP network devices with CPU and Memory counters

25 May

Hi,

This blog I had prepared a long time ago but never published it. So now it’s the time to do it.  Since we all know that SCOM 2012 has build in network device monitoring we of course want to use it. This works perfectly , except I you are using devices that are not certified by SCOM. In that case you will not get the CPU and memory counter and Fan/PSU states. For example most of the Procurve network devices from HP are left in the dark. So..

The problem

We want to monitor also CPU and Memory usages from HP network devices.

The solution

I will keep it simple and clear. I will demonstrate the steps using VSAE and give you as bonus the MP at the end. I will use VSAE management pack templates just to illustrate the power of it.

The steps will be:

1. [Classes] create the memory and CPU classes

We just simple make use of on the memory and processor classes that are already present in the system center network library. So we create 2 classes based on that:

image

 

2. [Datasources] create the memory and CPU discovery datasources

Now we have to create the datasources for the discovery of the CPU and memory targets

image

The most important is that you set the device key correctly to the parent node. Otherwise the relationship between the new CPU / memory class and the network device node will not be set. And you will not see any CPU / Memory targets. This can sometime be a ‘error and retry’ process.

3. [Discovery’s] create discovery’s for the CPU and Memory targets

Now we have the discovery datasource we can create the 2 discovery rules for the CPU and Memory targets. We will use the VSAE discovery templates for this. Just simple add new ‘Discovery’ template and you add the 2 rules below.

image

Create the 2 new discovery’s and specify the correct datasources.

image

You specify the datasources we created above to the correct discovery rule. Fill in the correct OID to match the HP processor and Memory OIDs.

image

If you now import the MP will will see at a HP node the CPU and Memory classes created. So continue the the next step.

4) [Rules] create the memory and CPU collection rules

So now we can make the stuff we wanted to see. The Memory and CPU counters. So we just simple use the add new item ‘Rule (Performance Collection)’ template and make the 2 new rules. We are going to use the already build in performance collection rules for the network nodes.

image

image 

The most important is to specify the correct OID for the Memory and CPU counters at the datasource configuration. See below:

CPU: .1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0
Memory: .1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1.7 and .1.3.6.1.4.1.11.2.14.11.5.1.1.2.2.1.1.5

I am not going to do a deep dive on this. You can just simple reference to the downloadable project source at the end of this post to check the details out.

The results

Now you import the MP and you will see you most wanted performance counters !! Open the Network Summary Dashboards and Node dashboard for the CPU Usage to check it out.

SNAGHTML126f4134

And the ‘free Memory (Percent)’ performance view for the memory usage.

image 

And below the relation ship diagram.

image

The End

The next step could be to add monitors to alert on high Memory or CU usages. I am not going to give you this bonus because its better to get some VSAE practice you self’s… You can do this the same way you did with the collection rules. There is a template for monitors also.

Download VSAE project (for the diehards): http://sdrv.ms/11mkq9j

Download Management Pack example: http://sdrv.ms/11mku8S

Happy Scomming

Michel Kamp

Let SCOM check for Updated Management Packs

21 Apr

The challenge

Using the SCOM native console the import from the Microsoft Management Pack Catalog is a nice feature. I like also the feature to check and import updated MPs that you have already imported in your management group. But what I really miss and don’t understand : why did the product team removed the monitor that gives us a alert when a new MP version is in the MP catalog ?. This monitor was build in MOM 2005 but removed in the begin of SCOM 2007.

The solution

So since we are SCOM author diehards we are going to build our own MP update monitor. I am going to use VSAE to build it all. But wait even if you aren’t a SCOM author diehard it still worth reading this post because this time I will share the VSAE project and even the MP with you at the end!!!

Analyze

So I used my good old friend ‘Fiddler’ to backward-engineer what the scom console is doing when I press the ‘check for updated management packs’ button. It seems it sends a SOAP request to a webservice. The SOAP request contains a MP list of the MPs that you have already imported. The answer result of this request will be a MP list with the updated MP versions or an empty list if there aren’t any updates for you.

Building time

Below I’m going to give you a overview what I have done. You can look in the VSAE project for details on it. If you have any questions just let it know and I will help you out.

1) The datasource

So now we are going to make a datasource that runs a PowerShell script. This PowerShell script is simulating the webservice request.

Below a snippet of the code. (the full code is in the VSAE project). What I am doing here are 3 steps:

1) Build a SOAP request message that contains all my MP version meta data from all MPs that I have already imported in my management group.

2) I call the “ManagementPackCatalogWebService.asmx” and execute the method “FindManagementPacks”

3) as last step I check if there are any MPs returned and set the $Status flag according the result. And I return the scom property bag.

# step 1

$MPSoap = get_MP_List
$ret = Do-SOAPRequest -SOAPRequest $MPSoap -URL $MPCatalogURL -SOAPAction $SOAPAction

# step 2

## show MPs that have a Update
$MpList = $ret.Envelope.Body.FindManagementPacksResponse.FindManagementPacksResult.CatalogItem | where { $_.IsManagementPack -eq $true} | select-Object DisplayName

# step 3

## check MP returned

if ( $MpList.Count -eq 0)
{
$Status=”UPTODATE”
}
else
{
$Status=”NOTUPTODATE”
}

  # Create the property bags
$pb = $oAPI.CreatePropertyBag()
$pb.AddValue(“Status”,$Status)
$pb.AddValue(“MpList”,($MpList | Out-String))
$pb

The script above we are going to use in the datasource below

image

2) The Monitor

Now we are going to compose a 2 state UnitMonitorType that uses this datasource. The health state check is done with the “Status” value in the returned property bag.

image

Having this UnitMonitorType composed we can now use it in the real monitor KPI. See below for the KPI. The target is the Management server. I choose this target because I have only one MNG server in my test lab but if you have more it’s better to choose the RMS emulator target.

image

Now when the monitor is unhealthy it will generate an alert message constructed below:

image

 

The result

Building and importing the MP in your SCOM management group will show you the result below:

image

And of course a nice ALERT message also:

image

So now the part you are waiting for..

As promised I will share the VSAE project and the MP it self. Please notice that it is a show case alias prototype MP and so it is far from complete. For example not all display strings are applied and no knowledge is supplied. But that’s up to you to complete…. In my production version I have even build in a recovery/console task that also automatically imports the updated MPs.. Just a idea for you to work out…

MP download and VSAE project download: https://1drv.ms/f/s!Au2euLDFD_ovilTTrLl-XqSmd1tj

The End

Feel free to comment or contact me if you have any questions.

Happy SCOMMING

Michel Kamp

Get a grip on the DWH aggregations

24 Mar

 

The problem

If you run availability reports or performance reports with a aggregation type of daily or hourly the reports are empty. This problem is described a lot on the web. And I have also written a couple of blog post how to fix this issue. But as you know we are using scom to monitor stuff , so why not monitor this aggregation processing and alert if a processing delay is occurring. ? That’s our mission today….

Analyze

Using SQL enterprise manager and a SQL query on the data warehouse DB we can read out the aggregation processing. This query looks like this:

Select AggregationTypeId, Datasetid, (Select SchemaName From StandardDataSet Where Datasetid = StandardDataSetAggregationHistory.Datasetid) ,  COUNT(*) as ‘Count’, MIN(AggregationDateTime) as ‘First’, MAX(AggregationDateTime) as ‘Last’ From StandardDataSetAggregationHistory
Where LastAggregationDurationSeconds IS NULL
group by AggregationTypeId , Datasetid

The output will show us how many aggregations there have still to be processed /aggreationtype  (20=hourly , 30 = daily).

image

So in this case we have no problem. But I have seen scom environments where the state aggregations where so far behind that it was almost not possible to fix it. This bring up a point: especially the state aggregations are the tricky ones. If you have many ‘flipping’ monitors there will be a lot of state changes and so a lot of aggregations data to process. This process takes a lot of SQL CPU power and also disk space. In most of this cases it was the tempdb data space free or transaction log that was the root cause of the failure.

Solution

In scom we have for every aggregation an target. This target is named ‘Standard data set’. You can find it here:

image

If you compare the screenshot with the results on your scom console you will notice that you don’t have the green healthy state… And that’s why you are reading this post. So lets add this state.

I wanted to give every dataset that has to be processed a health state on how many aggregation it has still to process. So we make a monitor that executes for every data set the query above and if a threshold is hit the health state is changed. Also we will add a rule so that this aggregation behind count is put in a trend graph.

I have used VSAE for this , and I will not share the code but only the idea. Why not ? I believe you have to know what you are doing and by copy & pasting you don’t learn from it if you don’t have done it once from start till end.

The real work

Open a new VSAE project and add a empty MP fragment and a PowerShell fragment.

image

Then you make a datasource that reads the aggregation count. This is done using PowerShell and the SQL snapin.

image

The PowerShell script has as input the GUID of the dataset (property of the target) and as output a property bag with the aggregations count (daily and hourly). I made the script somewhat intelligent by reading out the registry where the data warehouse is located.

Now we use this datasource in a monitor module type to create a 3 state monitor. And since we have created a datasource module we can create also a rule that collects the aggregation behind for the trend graph. Yes know know this is easier to type as to do…

Below a snap of the datasource module

image

And below a snap of the monitor module type

image

and the monitor. Create one for hourly(not shown) an one for daily.

image

At last for trending we have to create a collection rule.

image

Notice that the monitor and collection rule are having as target the “Microsoft.SystemCenter.DataWarehouse.DataSet” alias “standard dataset” and notice the runas profile.

The result

When you have constructed the MP and build/deployed it you will see 2 extra monitors on the standard dataset targets as show above. Open the health explorer to see if all is ok.

image

Above dataset has had a problem. To see some details, view the performance counters and you will see the aggregations trend.

image

In this case the state hourly aggregations where way behind. So I followed one of my own blog posts to solve this one. Where I manually executed in a loop the state aggregation process to speed up the processing.

The End.

Yes I know this post is a bit ‘çloudy’ and not something you can download and import. But I hope by sharing the idea I triggered you to try it your self.

Happy SCOMMING!

Michel Kamp

Authoring SCOM Reports in VS 2010

14 Jan

Hi,

Short post on how to get you dev environment ready for authoring scom reports.

Challenge:

You have installed SCOM 2012 on SQL 2008. You want to author a custom report using Visual studio 2010. When you open visual studio you will notice that NO BI project template is shown. Normally you selected this project template and selected the new report project to make your custom report. How now to continue ?

Solved:

Grab a SQL 2012 ISO (YES 2012) and startup the setup.

1) Select installation:

SNAGHTML1045608b

2) New sql or add features

SNAGHTML104737a8

3) Select SQL features Install

SNAGHTML104bfe9e

4) Now the important step. Select the 3 options here. Most important is the “SQL Server Data Tools”. This features contains the VS BI project template.

SNAGHTML104f3ae3

5) Step though the install windows.

And now open Visual studio 2010 and create a new project. And what do we see ?

Yes the BI template Knipogende emoticon 

SNAGHTML1058011e

 

Now you can create the new SCOM reports. Notice also the NEW chart types !!!

image

 

Remember that if you use custom report code components you must copy the correct .dll assemble to the directory:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies

The End.

Happy Scomming

Michel Kamp