fjames
fjames

Reputation: 116

Create SCOM alert with SDK

I'm writing a SCOM inbound connector and want to create alerts programmatically. I have worked out how to query and resolve alerts using the SDK, but actually creating them has so far eluded me.

Surely there must be a way of doing this?

Thanks in advance for any suggestions.

Edit:

The documentation http://msdn.microsoft.com/en-us/library/hh329020.aspx clearly states that such a thing is possible:

You can use inbound connectors to insert performance, event, and alert data into Operations Manager from an external management system.

Upvotes: 2

Views: 3287

Answers (2)

fjames
fjames

Reputation: 116

I have now got a working solution to this problem. For those who are interested, this is what I did.

  1. Generate events using the SDK as normal. This amounts to calling InsertCustomMonitoringEvent in the way shown in the example.

  2. Write a Rule in the management pack that uses the data source Microsoft.SystemCenter.SdkEventProvider and the writer System.Health.GenerateAlert. The rule should target the objects which you generate the events for.

  3. Add a condition detection module to the rule which filters on the EventLevel property. This means you must have 3 copies of the rule for Informational, Warning and Error type alerts. This allows you to map the EventLevel=1 -> Severity=2 (Error), EventLevel=2 -> Severity=1 (Warning), EventLevel=4 -> Severity=0 (Informational).

You might also need to add a filter on the PublisherName of the event to map onto the correct Target object, using some unique key property of the $Target$.

With all this in place you will of course be generating both events and alerts with the same content, but it does at least give you a working method of generating alerts using the SDK. Quite why they didn't add a Microsoft.SystemCenter.SdkAlertProvider type data source I don't know... That would've made life much easier.

Upvotes: 2

Samjongenelen
Samjongenelen

Reputation: 401

Well, if you mean what i think you mean; Here's an example: http://msdn.microsoft.com/en-us/library/hh329020.aspx (the second code block, I think)

Upvotes: 0

Related Questions