I created a new class and a custom Discovery that reads a text file provided by our Networking team.  When the discovery runs, all of 1,700 devices are “discovered” and show up in the correct class within SCOM (via the Discovered Inventory node).

My problem is that when the monitor I wrote runs, it runs 1,700 times causing an extended increase in CPU usage on the agent where this MP is targeted.  Put simply, for each discovered object, the monitor starts, opens the text file, scans for its status, closes the file and the health state is updated if it changes.

What I think I would like to do instead is write a custom monitor that runs once for all 1,700 devices (for everything in that custom class) and only update the Health status for those objects that have a change in health (the text file is updated every 5 minutes).  I think this would have the benefit of having only one monitor running that only opens the file once, thereby reducing the CPU spike.

Is that possible?  And if so, are there any resources to reference?

Now, that said, I’m also looking at changing the discovery from a file based discovery to a database discovery, but I don’t know if that changes the problem enough since the monitor will still be running once for each instance of the class…


CyrAz answered
    • Is it/could it be a PowerShell monitor? This popped up on my radar recently: https://github.com/proxb/PoshRSJob - It would allow you to run the job in batches, rather than all at once.