question

shaikso-3463 avatar image
0 Votes"
shaikso-3463 asked AliBurakGenc edited

Is it possible to running one time script for all Child Instances of Discovered Instances SCOM

Suppose I have Class B instances Hosted by Class A. Where I am running a discovery for A Target to Appliance.

Where I have 10 instances Class A.
Here my second discovery for Class B runs by Targeting Class A. So here script will run 10 times. Can apply any cookdown here where as i can run script one time for class B instances.

msc-operations-manager
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,

To better understand this question, could you give us a specific example to help understand your request?

0 Votes 0 ·

hi Xin.

Actually we are running discoveries in scom for hosts in Appliances, Where we have host discovery which runs one time and collect all hosts data under Appliance, where our host is targeted to Appliance. under host we have some subcomponents. we have second discovery which will collect all the subcomponents of hosts.

Where our script will take host id and run the script to collect subcomponents. so our subcomponent is targeted to host instance.

Example 1. Appliance-> 10 hosts-> 100 subcomponents(each host has 10 subcomponents).

first Discovery runs one time on each interval
Second Discovery runs 10 times on each discovery interval

Here i would like to run second discovery also 1 time to collect all subcomponent


Is there any cookdown approach for discovery

0 Votes 0 ·
CyrAz avatar image
1 Vote"
CyrAz answered shaikso-3463 commented

It is possible to use cookdown with discoveries, but it's really hard to tell you more without seeing the actual script or even better the full MP code

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

hi CyrAz Thanks for reply.


Can I get any Example code samples for Discovery with Cookdown.

0 Votes 0 ·
AliBurakGenc avatar image
0 Votes"
AliBurakGenc answered AliBurakGenc edited

Hi @shaikso-3463 , I have written an MP for VROPS integration and I use following approach where I could discover all instances of a class running a script only once a day.

A Watcher Class -> Cluster Class -> HostSystem Class (ESX) -> Datastore etc

All classes are hosted by previous class and has relationship set. All of the class discoveries are targeted to Watcher Class.
This way all the scripts run on the same windows server set as watcher and all of the instances of a class can be discovered at once.

Of course VROPS API makes things easy for this approach but I believe you might also be using such an API if you are working with an appliance.

Regards
Ali

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

hi AliBurakGen

Yaah I have done by changing the Target to Watcher Class but what happened its throwing some exception in Event Log
Microsoft.EnterpriseManagement.Common.DiscoveryDataInvalidRelationshipSourceException,The relationship source specified in the discovery data item is not valid.

A--->B-->C--D-->

When B targets A
and C targets A

both the discoveries started parallelly i think C related discovery started first and later B started so its failing.





0 Votes 0 ·

Hi @shaikso-3463 , that I handled by Synctime setting. I have set the earliest time for the first class and have given enough time for the discovery to complete and set the next one.

Even though you target all the discoveries for A, when discovering C you should include all of the class information prior to the one you are discovering where in this case it is Class B and Class A. That might be problem.

Here is a part from my code ;

$instance = $discoveryData.CreateClassInstance("$MPElement[Name='vROps.Datacenter.Class']$") --> Class D
$Instance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $HostID ) --> Class A --> WatcherNode
$instance.AddProperty("$MPElement[Name='vROps.Installation.Class']/Name$", $vROpsName ) --> Class B
$instance.AddProperty("$MPElement[Name='vROps.Vcenter.Class']/Id$", $ResourceID ) --> Class C
$instance.AddProperty("$MPElement[Name='vROps.Datacenter.Class']/Name$", $DcName ) --> Class D

0 Votes 0 ·