Archive | AUTHORING 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

Computer property Organizational Unit is Empty

30 Oct

 

The problem:

 

For a show case I had to make a group based on the computer OU. I ‘m using SCOM 2016 and had installed only the basic out of the box MPs.

I noticed that the Organizational Unit property was empty. Hmm why ? do I miss a MP doing this ??


 

The investigation:

 

So first I searched for a discovery filling this property. It is internal id is named : Microsoft.SystemCenter.DiscoverWindowsComputerProperties

See here : https://systemcenter.wiki/?GetElement=Microsoft.SystemCenter.DiscoverWindowsComputerProperties&Type=Discovery&ManagementPack=Microsoft.SystemCenter.Internal&Version=7.0.8443.6

Next I had a look at the datasource and took out the PS script part.

See here : https://systemcenter.wiki/?GetElement=Microsoft.SystemCenter.WindowsComputerPropertyDiscovery&Type=DataSourceModuleType&ManagementPack=Microsoft.SystemCenter.Internal&Version=7.0.8443.6

I opened a ISE on that server and copied the script into the editor.

Changed the initial params as :

#param($SourceType, $SourceId, $ManagedEntityId, $ComputerIdentity)

 

$SourceType=0

$SourceId=
[guid]::newguid()

$ManagedEntityId
=
[guid]::newguid()

$ComputerIdentity=“SCOMADMIN11.contoso.com”

 

And executed the script. And I got a error indicating that the $computer was empty. Searched and i noticed that the $ADSISearcher.Filter  is incorrect so the computer object isn’t populated from LDAP.

 

it is  

$ADSISearcher.Filter = ‘(&(DNSHostName=’ + $strDNSComputerName + ‘)(Name=’ + $strNetBIOSComputerName + ‘)(objectClass=computer))’;

but should be 

$ADSISearcher.Filter = ‘(&(DNSHostName=’ + $strDNSComputerName + ‘)(Name=’ + $strNetBIOSComputerName + ‘)(objectClass=computer))’;
    

So it’s a bug 😉

Solution:

 

Till the responsible Microsoft team isn’t going to fix this you will have to make you own discovery workflow to fill this property.

Hope this helps

Happy SCOMMING.

VSAE malicious compiling challenges

25 Oct

Below a memory dump for myself.

The challenge

 

During compiling your management Pack in VSAE you get this nice blurry error message:

Detected malicious verification code when verifying element of type Microsoft.EnterpriseManagement.Configuration.ManagementPackRule with inner exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Microsoft.EnterpriseManagement.Configuration.ManagementPackRule.VerifyDataTypes(Dictionary`2 moduletypes) at Microsoft.EnterpriseManagement.Configuration.ManagementPackRule.Verify(VerificationContext context) at Microsoft.EnterpriseManagement.Configuration.Verification.VerificationEngine.VerifyCollectionItems(Object context) (Path = OpsLogix.IMP.VMWare.VirtualMachine.Monitoring)

 

The Investigation

 

Out of my almost 13 years for MP authoring experience I know most of the time this error above is due to a missing end tag $ of a property reference or a misspelled property name.

For example

<License>$Target/Property[Type=”OpsLogix.IMP.VMWare.VirtualMachine”]/LicenseKey</License>

Should be

<License>$Target/Property[Type=”OpsLogix.IMP.VMWare.VirtualMachine”]/LicenseKey$</License>

But this time it’s different … after doing some investigations by setting the management fragments “Build Action” to “None” in the VSAE project I found out that it was due to the external referenced datatasource Accessibility property.

The solution

 

So after I changed the Accessibility property of the external referenced datasource from :

<DataSourceModuleType
ID=OpsLogix.IMP.VMware.Collector.DataSource.LicenseActions
Accessibility=Internal
Batching=false>

To..

<DataSourceModuleType
ID=OpsLogix.IMP.VMware.Collector.DataSource.LicenseActions
Accessibility=Public
Batching=false>

… my project compiled fine.

What makes of course sense and if I was using the autocomplete in VSAE this was never happened since the autocomplete will not provide you any Internal references at all…. But of course to be faster I copied it over manually , so my bad … at the end I lost my time due to investigations anyway hope you won’t.

The end

 

Hope I saved you some time.

Happy scomming

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

Using PowerShell to add update and delete Class instances in SCOM

29 Nov

Challenge

This short post will provide some PowerShell scripting to let you play with class instances in SCOM. Since there’s not much information on the web on this topic and I had a request from a partner I will provide some code below how to handle this.

In the examples below I will use a class from the OpsLogix VMware management pack, but you can use any (public) class you want. All code just be run on a SCOM MS server. All examples are separate runnable.

Add a class instance

In the example below, I will add a new VMWare ESX host to a datacenter belonging to a vCenter connection. As below:

Before we run the script, we will have to know the Key properties so we can configure the parent child relationship. In this case the we have the following relationship:

vCenter01:7443 -> Datacenter01 -> My_ESX_Host

In this case the Host we want to add is called “My_ESX_Host” and we set the “AssetTag” to “unkown” .

## ======================================================================

## example script how to add a class instance in SCOM

## ======================================================================

## Michel Kamp

## ======================================================================

New-SCOMManagementGroupConnection
-ComputerName
“localhost”

$mg
=
Get-SCOMManagementGroup

$ClassInstanceDisplayName=
“My_ESX_Host”

$Class
=
Get-SCOMClass
-Name
OpsLogix.IMP.VMWare.ESXHost

##================= create/add class instance

$ClassObject
=
New-Object
Microsoft.EnterpriseManagement.Common.CreatableEnterpriseManagementObject($mg,$class)

# set the KEY props

$ClassObject[$Class.FindHostClass().FindHostClass(),“vCenterHostName”].Value = “vCenter01:7443”

$ClassObject[$Class.FindHostClass(),“DatacenterName”].Value = “Datacenter01”

$ClassObject[$Class,“ESXServerName”].Value =
$ClassInstanceDisplayName

# Set NON key props

$ClassObject[$Class,“AssetTag”].Value = “unkown”

# add and write back to scom

$discovery
=
New-Object
Microsoft.EnterpriseManagement.ConnectorFramework.IncrementalDiscoveryData

$discovery.Add($ClassObject)

$discovery.Overwrite($mg)

##================= END ================================================

Change a property of a class instance

Below we change a property called “AssetTag” to “test tag 123” of the ESXHost class instance “My_ESX_Host”. Keep in mind that only NON-Key properties can be changed.

See script below:

## ======================================================================

## example script how to change a class instance in SCOM

## ======================================================================

## Michel Kamp

## ======================================================================

New-SCOMManagementGroupConnection
-ComputerName
“localhost”

$mg
=
Get-SCOMManagementGroup

$ClassInstanceDisplayName=
“My_ESX_Host”

$Class
=
Get-SCOMClass
-Name
OpsLogix.IMP.VMWare.ESXHost

##================= change property of class instance

## get the just created class

$ClassInstance
=
Get-SCOMMonitoringObject
-Class
$Class
|
where { $_.DisplayName -eq $ClassInstanceDisplayName}

# change the properties

# only NON-KEY props can be changed

$ClassInstance[$Class,“AssetTag”].Value = “test tag 123”

# write it to scom

$ClassInstance.Overwrite()

##================= END ================================================

Delete a Class Instance

In this example we delete the ESXHost class instance “My_ESX_Host”.

## ======================================================================

## example script how to delete a class instance in SCOM

## ======================================================================

## Michel Kamp

## ======================================================================

New-SCOMManagementGroupConnection
-ComputerName
“localhost”

$mg
=
Get-SCOMManagementGroup

$ClassInstanceDisplayName=
“My_ESX_Host”

$Class
=
Get-SCOMClass
-Name
OpsLogix.IMP.VMWare.ESXHost

##============== remove a class instance

## get the class instance to remove

$ClassInstance
=
Get-SCOMMonitoringObject
-Class
$Class
|
where { $_.DisplayName -eq $ClassInstanceDisplayName}

# add the class instance to delete

$discovery
=
New-Object
Microsoft.EnterpriseManagement.ConnectorFramework.IncrementalDiscoveryData

$discovery.RemoveInternal($ClassInstance,$ClassInstance.GetClasses()[0])

## execute the delete

$discovery.Commit($mg)

##================= END ================================================

Happy SCOM’ing

Michel Kamp

TOUCHING SCOM

https://michelkamp.wordpress.com/

ARM: A parameter cannot be found that matches parameter name ‘_artifactsLocationSasToken’

5 Dec

 

Short note to myself.

Problem

If you are trying to deploy an ARM template using Visual studio and you get the error below…..

AzureRmResourceGroupDeployment : A parameter cannot be found that matches parameter name ‘_artifactsLocationSasToken’

… do not spend 1 hour on trying to figure out why the parameter isn’t found. Just continue reading the solution below.

Solution

 

Scan your ARM template(s) if it has the correct formatting!!! Even when the deployment doesn’t mention any validation errors (because the deploy hasn’t reached this step yet)

So in my case I had one } too much , so the next part was seen as a parameter for the main resource. The compiler and syntax highlight didn’t complain but the deployment gave the ‘_artifactsLocationSasToken’ error.

So just be warned 😉

 

Happy Azurering

Michel Kamp

Michelkamp.wordpress.com

Azure Marketplace Solution UI Test

29 Nov

Hi,

A quick note for all DevOps under us:

Currently I am doing an investigation on how to publish a solution to the Azure marketplace. You have 2 ways to do this. A Virtual Machine offer or a Solution template offer.

A Virtual Machine offer will be a sysprep’d VM that will contain all your pre-installed software and just will be deployed as a new virtual machine. So you will have to prepare a VM and sysprep/generalize it and upload it to Azure.

A Solution template offer is somehow more advanced. Here you don’t have to configure a sysprep’d VM image but you just use an ARM template to rollout a brand new VM and then use a script extension resource to deploy your artifacts (aka your software to install). The cool part is that you can also change the UI interface on the Azure portal when configuring the deployment. This is done with the createUiDefinition.json file that has to be a part of the solution zip file you upload to azure.

An example of this can be found here: https://github.com/Azure/azure-quickstart-templates/tree/master/marketplace-samples

So when you have created all your ARM templates and put it into a Solution zip file (aka just zip all the ARM templates in one file) you will upload it using the https://publish.windowsazure.com portal and make a staged publish. (aka test rollout/publish)

Now you have to wait for a couple of hours before it will be ready to test it out. And this is the part that is annoying. There is no way to test the custom UI interface without having to do a staged publish and wait for a couple of hours a again……

Or is there …. ??

Yes there is! Thanks to this link I was able to test my custom deployment UI.

All you will have to do is:

  1. Create using the Azure storage explorer a new public container. (so set the public access level). For example named : “test”
  2. Copy the file “createUiDefinition.json” to this container.
  3. Check if you can open the file using the “copy Url” in a new browser.
  4. Now you will have to encode this URL , you can use http://meyerweb.com/eric/tools/dencoder/ for this.
  5. The URL looks like this now: https%3A%2F%2Fegnlmkotkizce.blob.core.windows.net%2Ftest%2FcreateUiDefinition.json
  6. Now replace the URL in the text below: (note: if you see ” replace it by the normal double quotes , this is a WordPress issue)

    https://portal.azure.com/#blade/Microsoft_Azure_Compute/CreateMultiVmWizardBlade/internal_bladeCallId/anything/internal_bladeCallerParams/{“initialData”:{},”providerConfig”:{“createUiDefinition”:”URL from step 5“}}

     

  7. The end result could look like this:

    https://portal.azure.com/#blade/Microsoft_Azure_Compute/CreateMultiVmWizardBlade/internal_bladeCallId/anything/internal_bladeCallerParams/{“initialData”:{},”providerConfig”:{“createUiDefinition”:”https%3A%2F%2Fegnlmkotkizce.blob.core.windows.net%2Ftest%2FcreateUiDefinition.json“}}

     

  8. Open a new browser and paste in the URL from step 7. And the result will be ….

 

Super handy and cool!

 

Happy scomming azuring

Michel Kamp

https://michelkamp.wordpress.com