Share via

SCOM - Powershell to send SQL Data (Value) to SCOM Alert Console and Notification

Saiyad Rahim 431 Reputation points
2020-09-21T00:13:18.85+00:00

I need assistance in the following:

  • Powershell to look at a Table Cell in a Database (Not SCOM DB) and if there is No Data in the Cell...do nothing.
  • Check again, if there is Value in that Cell...do the following:
  • Want SCOM to pick up Data from that Database Table Cell and create an Alert on the SCOM Console
  • In the Console Alerts Description, show this Value with other Test that I can write/customise.
  • Also, I want to use this Value in the E-Mail notifications I send from SCOM.

Has anyone out here have done this before?

I know there is need to create and use Property Bags etc but i have no experience in P/shell

Even if showing the Value on the Alerts Description is not possible, can this Value be shown in the Alert Context ...when looking at Health Explorer>State Change Events> Details ...Context: .

Any assistance on this will be appreciated.

System Center Operations Manager
System Center Operations Manager

A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.

0 comments No comments

Answer accepted by question author

Crystal-MSFT 54,306 Reputation points Microsoft External Staff
2020-09-21T02:58:11.977+00:00

@Saiyad Rahim , From your description, I know you want to use Powershell to query SQL table and generate alert and notification according the cell value. if there's any misunderstanding, feel free to let us know.

As this is SCOM forum, we are not familiar with Powershell or SQL. We suggest to contact SQL and Powershell support team to get the Powershell script to accomplish what we want.
https://learn.microsoft.com/en-us/answers/topics/sql-server-general.html
https://learn.microsoft.com/en-us/answers/topics/windows-server-powershell.html

Afterwards, we can set up a custom monitor in SCOM with a Powershell Script. Here is an example for the reference:
https://blog.ctglobalservices.com/powershell/clm/example-of-setting-up-a-custom-monitor-in-scom-with-a-powershell-script-monitor-nic-teams-in-scom/
Note: Non-microsoft link, just for the reference.

To pass Powershell result to Alert Description, here is a link for the reference:
https://community.squaredup.com/answers/question/pass-powershell-result-to-alert-description/
Note: Non-microsoft link, just for the reference.

After the alert is generated, we can configure email notification refer to the steps in following link,
https://kevinholman.com/2012/04/27/opsmgr-2012-configure-notifications/
Note: Non-microsoft link, just for the reference.

Hope it can help.


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?


2 additional answers

Sort by: Most helpful
  1. Saiyad Rahim 431 Reputation points
    2020-09-21T19:33:11.273+00:00

    Thanks guys.
    I think i have enough ammo to get started.

    Was this answer helpful?


  2. CyrAz 5,181 Reputation points
    2020-09-21T10:48:19.17+00:00

    As an additional info, Kevin Holman has a sample of exactly that kind of monitor in his VSAE library : https://github.com/thekevinholman/FragmentLibrary/blob/master/Monitor.TimedScript.PowerShell.SQLQuery.mpx

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.